class RMeetup::Type::Event
RMeetup::Type::Event
¶ ↑
Data wrapper for an Event
Used to access result attributes as well as programatically fetch relative data types based on this event.
Attributes
event[R]
to_h[R]
Public Class Methods
new(event = {})
click to toggle source
# File lib/rmeetup/type/event.rb, line 12 def initialize(event = {}) @event = event end
Public Instance Methods
id()
click to toggle source
Special accessors that need typecasting or other parsing
# File lib/rmeetup/type/event.rb, line 27 def id event['id'].to_i end
lat()
click to toggle source
# File lib/rmeetup/type/event.rb, line 30 def lat event['lat'].to_f end
lon()
click to toggle source
# File lib/rmeetup/type/event.rb, line 33 def lon event['lon'].to_f end
method_missing(id, *args)
click to toggle source
# File lib/rmeetup/type/event.rb, line 18 def method_missing(id, *args) if event.has_key?(id.id2name) event[id.id2name] else fail NoMethodError.new('no method') end end
rsvpcount()
click to toggle source
# File lib/rmeetup/type/event.rb, line 36 def rsvpcount event['rsvpcount'].to_i end
time()
click to toggle source
# File lib/rmeetup/type/event.rb, line 42 def time Time.at(self.event['time']/1000).to_datetime end
updated()
click to toggle source
# File lib/rmeetup/type/event.rb, line 39 def updated DateTime.parse(self.event['updated']) end
venue()
click to toggle source
# File lib/rmeetup/type/event.rb, line 45 def venue OpenStruct.new( self.event['venue'] ) end