Class: RMeetup::Type::Comment

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(comment = {}) ⇒ Comment

Returns a new instance of Comment.



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

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

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

Instance Attribute Details

#commentObject

Returns the value of attribute comment.



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

def comment
  @comment
end

Instance Method Details

#createdObject



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

def created
  return DateTime.parse(self.comment['created'])
end

#latObject



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

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

#lonObject



37
38
39
# File 'lib/rmeetup/type/comment.rb', line 37

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

#ratingObject

Special accessors that need typecasting or other parsing



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

def rating
  return self.comment['rating'].to_i
end