Class: Lonelyplanet::Geotaxonomy
- Inherits:
-
Object
- Object
- Lonelyplanet::Geotaxonomy
- Defined in:
- lib/lonely_planet.rb
Defined Under Namespace
Classes: Parent
Instance Attribute Summary collapse
-
#destination_id ⇒ Object
readonly
Returns the value of attribute destination_id.
-
#language ⇒ Object
readonly
Returns the value of attribute language.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parents ⇒ Object
readonly
Returns the value of attribute parents.
Instance Method Summary collapse
-
#initialize(payload) ⇒ Geotaxonomy
constructor
A new instance of Geotaxonomy.
Constructor Details
#initialize(payload) ⇒ Geotaxonomy
Returns a new instance of Geotaxonomy.
173 174 175 176 177 178 |
# File 'lib/lonely_planet.rb', line 173 def initialize(payload) @name = payload['term'][0]['name'].to_s @destination_id = payload['term'][0]['destination_id'].to_s @language = payload['language'].to_s @parents = payload['parents'][0]['parent'].compact.map { |parent| Parent.new(parent) } end |
Instance Attribute Details
#destination_id ⇒ Object (readonly)
Returns the value of attribute destination_id.
169 170 171 |
# File 'lib/lonely_planet.rb', line 169 def destination_id @destination_id end |
#language ⇒ Object (readonly)
Returns the value of attribute language.
170 171 172 |
# File 'lib/lonely_planet.rb', line 170 def language @language end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
168 169 170 |
# File 'lib/lonely_planet.rb', line 168 def name @name end |
#parents ⇒ Object (readonly)
Returns the value of attribute parents.
171 172 173 |
# File 'lib/lonely_planet.rb', line 171 def parents @parents end |