Class: IpwhoApi::GeoData

Inherits:
Struct
  • Object
show all
Defined in:
lib/ipwho.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#connectionObject

Returns the value of attribute connection

Returns:

  • (Object)

    the current value of connection



166
167
168
# File 'lib/ipwho.rb', line 166

def connection
  @connection
end

#currencyObject

Returns the value of attribute currency

Returns:

  • (Object)

    the current value of currency



166
167
168
# File 'lib/ipwho.rb', line 166

def currency
  @currency
end

#flagObject

Returns the value of attribute flag

Returns:

  • (Object)

    the current value of flag



166
167
168
# File 'lib/ipwho.rb', line 166

def flag
  @flag
end

#geoLocationObject

Returns the value of attribute geoLocation

Returns:

  • (Object)

    the current value of geoLocation



166
167
168
# File 'lib/ipwho.rb', line 166

def geoLocation
  @geoLocation
end

#ipObject

Returns the value of attribute ip

Returns:

  • (Object)

    the current value of ip



166
167
168
# File 'lib/ipwho.rb', line 166

def ip
  @ip
end

#securityObject

Returns the value of attribute security

Returns:

  • (Object)

    the current value of security



166
167
168
# File 'lib/ipwho.rb', line 166

def security
  @security
end

#timezoneObject

Returns the value of attribute timezone

Returns:

  • (Object)

    the current value of timezone



166
167
168
# File 'lib/ipwho.rb', line 166

def timezone
  @timezone
end

#userAgentObject

Returns the value of attribute userAgent

Returns:

  • (Object)

    the current value of userAgent



166
167
168
# File 'lib/ipwho.rb', line 166

def userAgent
  @userAgent
end

Class Method Details

.from_hash(hash) ⇒ Object



170
171
172
173
174
175
176
177
178
179
180
181
# File 'lib/ipwho.rb', line 170

def self.from_hash(hash)
  new(
    ip:          hash["ip"] || "",
    geoLocation: hash["geoLocation"] ? GeoLocation.from_hash(hash["geoLocation"]) : nil,
    timezone:    hash["timezone"]    ? Timezone.from_hash(hash["timezone"])       : nil,
    flag:        hash["flag"]        ? Flag.from_hash(hash["flag"])               : nil,
    currency:    hash["currency"]    ? Currency.from_hash(hash["currency"])       : nil,
    connection:  hash["connection"]  ? Connection.from_hash(hash["connection"])   : nil,
    security:    hash["security"]    ? Security.from_hash(hash["security"])       : nil,
    userAgent:   hash["userAgent"]   ? UserAgent.from_hash(hash["userAgent"])     : nil
  )
end