Class: Lonelyplanet::Geotaxonomy

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

Defined Under Namespace

Classes: Parent

Instance Attribute Summary collapse

Instance Method Summary collapse

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_idObject (readonly)

Returns the value of attribute destination_id.



169
170
171
# File 'lib/lonely_planet.rb', line 169

def destination_id
  @destination_id
end

#languageObject (readonly)

Returns the value of attribute language.



170
171
172
# File 'lib/lonely_planet.rb', line 170

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



168
169
170
# File 'lib/lonely_planet.rb', line 168

def name
  @name
end

#parentsObject (readonly)

Returns the value of attribute parents.



171
172
173
# File 'lib/lonely_planet.rb', line 171

def parents
  @parents
end