Class: Location
Overview
Class Location represents structure of location:
location = Location.new
location.countryRank # => Integer
location.country # => String
location.cityRank # => Integer
location.city # => String
location.stateCode # => String
location.stateName # => String
location.code # => String
location.latitude # => Float
location.longitude # => Float
location.from_array(array) # => Array of Location objects
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#cityRank ⇒ Object
Returns the value of attribute cityRank.
-
#code ⇒ Object
Returns the value of attribute code.
-
#country ⇒ Object
Returns the value of attribute country.
-
#countryRank ⇒ Object
Returns the value of attribute countryRank.
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
-
#stateCode ⇒ Object
Returns the value of attribute stateCode.
-
#stateName ⇒ Object
Returns the value of attribute stateName.
Class Method Summary collapse
-
.from_array(array) ⇒ Object
Method
from_array
returns array of locations(create from json).
Methods inherited from Struct
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city
16 17 18 |
# File 'lib/models/location.rb', line 16 def city @city end |
#cityRank ⇒ Object
Returns the value of attribute cityRank
16 17 18 |
# File 'lib/models/location.rb', line 16 def cityRank @cityRank end |
#code ⇒ Object
Returns the value of attribute code
16 17 18 |
# File 'lib/models/location.rb', line 16 def code @code end |
#country ⇒ Object
Returns the value of attribute country
16 17 18 |
# File 'lib/models/location.rb', line 16 def country @country end |
#countryRank ⇒ Object
Returns the value of attribute countryRank
16 17 18 |
# File 'lib/models/location.rb', line 16 def countryRank @countryRank end |
#latitude ⇒ Object
Returns the value of attribute latitude
16 17 18 |
# File 'lib/models/location.rb', line 16 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude
16 17 18 |
# File 'lib/models/location.rb', line 16 def longitude @longitude end |
#stateCode ⇒ Object
Returns the value of attribute stateCode
16 17 18 |
# File 'lib/models/location.rb', line 16 def stateCode @stateCode end |
#stateName ⇒ Object
Returns the value of attribute stateName
16 17 18 |
# File 'lib/models/location.rb', line 16 def stateName @stateName end |
Class Method Details
.from_array(array) ⇒ Object
Method from_array
returns array of locations(create from json). Takes value of array objects as json parameter array.
Example:
Location.from_array([...array of JSON objects...]) # => Array of Location
25 26 27 28 29 |
# File 'lib/models/location.rb', line 25 def self.from_array(array) array.collect do |element| Location.new(element) end end |