1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
require 'geocoder/results/base'
module Geocoder
module Result
class AbstractApi < Base
##
# Geolocation
def state
@data['region']
end
def state_code
@data['region_iso_code']
end
def city
@data["city"]
end
def city_geoname_id
@data["city_geoname_id"]
end
def region_geoname_id
@data["region_geoname_id"]
end
def postal_code
@data["postal_code"]
end
def country
@data["country"]
end
def country_code
@data["country_code"]
end
def country_geoname_id
@data["country_geoname_id"]
end
def country_is_eu
@data["country_is_eu"]
end
def continent
@data["continent"]
end
def continent_code
@data["continent_code"]
end
def continent_geoname_id
@data["continent_geoname_id"]
end
##
# Security
def is_vpn?
@data.dig "security", "is_vpn"
end
##
# Timezone
def timezone_name
@data.dig "timezone", "name"
end
def timezone_abbreviation
@data.dig "timezone", "abbreviation"
end
def timezone_gmt_offset
@data.dig "timezone", "gmt_offset"
end
def timezone_current_time
@data.dig "timezone", "current_time"
end
def timezone_is_dst
@data.dig "timezone", "is_dst"
end
##
# Flag
def flag_emoji
@data.dig "flag", "emoji"
end
def flag_unicode
@data.dig "flag", "unicode"
end
def flag_png
@data.dig "flag", "png"
end
def flag_svg
@data.dig "flag", "svg"
end
##
# Currency
def currency_currency_name
@data.dig "currency", "currency_name"
end
def currency_currency_code
@data.dig "currency", "currency_code"
end
##
# Connection
def connection_autonomous_system_number
@data.dig "connection", "autonomous_system_number"
end
def connection_autonomous_system_organization
@data.dig "connection", "autonomous_system_organization"
end
def connection_connection_type
@data.dig "connection", "connection_type"
end
def connection_isp_name
@data.dig "connection", "isp_name"
end
def connection_organization_name
@data.dig "connection", "organization_name"
end
end
end
end
|