Class: RMeetup::Type::City

Inherits:
Object
  • Object
show all
Defined in:
lib/rmeetup/type/city.rb

Overview

Edited by Jason Berlinsky on 1/20/11 to allow for arbitrary data access See www.meetup.com/meetup_api/docs/cities/ for available fields

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(city = {}) ⇒ City

Returns a new instance of City.



18
19
20
# File 'lib/rmeetup/type/city.rb', line 18

def initialize(city = {})
  self.city = city
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args) ⇒ Object



22
23
24
# File 'lib/rmeetup/type/city.rb', line 22

def method_missing(id, *args)
  return self.city[id.id2name]
end

Instance Attribute Details

#cityObject

Returns the value of attribute city.



16
17
18
# File 'lib/rmeetup/type/city.rb', line 16

def city
  @city
end

Instance Method Details

#latObject

Special accessors that need typecasting or other parsing



28
29
30
# File 'lib/rmeetup/type/city.rb', line 28

def lat
  return self.city['lat'].to_f
end

#lonObject



31
32
33
# File 'lib/rmeetup/type/city.rb', line 31

def lon
  return self.city['lon'].to_f
end

#membersObject



34
35
36
# File 'lib/rmeetup/type/city.rb', line 34

def members
  return self.city['members'].to_i
end