Class: RMeetup::Type::Event

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event = {}) ⇒ Event

Returns a new instance of Event.



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

def initialize(event = {})
  self.event = event
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/event.rb', line 22

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

Instance Attribute Details

#eventObject

Returns the value of attribute event.



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

def event
  @event
end

Instance Method Details

#idObject

Special accessors that need typecasting or other parsing



27
28
29
# File 'lib/rmeetup/type/event.rb', line 27

def id
  self.event['id'].to_i
end

#latObject



30
31
32
# File 'lib/rmeetup/type/event.rb', line 30

def lat
  self.event['lat'].to_f
end

#lonObject



33
34
35
# File 'lib/rmeetup/type/event.rb', line 33

def lon
  self.event['lon'].to_f
end

#rsvpcountObject



36
37
38
# File 'lib/rmeetup/type/event.rb', line 36

def rsvpcount
  self.event['rsvpcount'].to_i
end

#timeObject



42
43
44
# File 'lib/rmeetup/type/event.rb', line 42

def time
  DateTime.parse(self.event['time'])
end

#updatedObject



39
40
41
# File 'lib/rmeetup/type/event.rb', line 39

def updated
  DateTime.parse(self.event['updated'])
end