Class: Foursquare::Checkin
- Inherits:
-
Object
- Object
- Foursquare::Checkin
- Defined in:
- lib/foursquare/checkin.rb
Instance Method Summary collapse
- #created_at ⇒ Object
- #fetch ⇒ Object
- #id ⇒ Object
-
#initialize(foursquare, json) ⇒ Checkin
constructor
A new instance of Checkin.
- #mayor? ⇒ Boolean
- #shout ⇒ Object
- #shout? ⇒ Boolean
- #timezone ⇒ Object
- #type ⇒ Object
- #user(full = false) ⇒ Object
- #venue ⇒ Object
Constructor Details
#initialize(foursquare, json) ⇒ Checkin
Returns a new instance of Checkin.
3 4 5 |
# File 'lib/foursquare/checkin.rb', line 3 def initialize(foursquare, json) @foursquare, @json = foursquare, json end |
Instance Method Details
#created_at ⇒ Object
24 25 26 |
# File 'lib/foursquare/checkin.rb', line 24 def created_at Time.at(@json["createdAt"].to_i) end |
#fetch ⇒ Object
11 12 13 14 |
# File 'lib/foursquare/checkin.rb', line 11 def fetch @json = @foursquare.get("checkins/#{id}")["checkin"] self end |
#id ⇒ Object
7 8 9 |
# File 'lib/foursquare/checkin.rb', line 7 def id @json["id"] end |
#mayor? ⇒ Boolean
32 33 34 |
# File 'lib/foursquare/checkin.rb', line 32 def mayor? @json["isMayor"] end |
#shout ⇒ Object
28 29 30 |
# File 'lib/foursquare/checkin.rb', line 28 def shout @json["shout"] end |
#shout? ⇒ Boolean
20 21 22 |
# File 'lib/foursquare/checkin.rb', line 20 def shout? type == "shout" end |
#timezone ⇒ Object
36 37 38 |
# File 'lib/foursquare/checkin.rb', line 36 def timezone @json["timeZone"] end |
#type ⇒ Object
16 17 18 |
# File 'lib/foursquare/checkin.rb', line 16 def type @json["type"] end |
#user(full = false) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/foursquare/checkin.rb', line 44 def user(full=false) fetch unless @json["user"] if full @foursquare.users.find(@json["user"]["id"]) else Foursquare::User.new(@foursquare, @json["user"]) end end |
#venue ⇒ Object
40 41 42 |
# File 'lib/foursquare/checkin.rb', line 40 def venue @json["venue"] && Foursquare::Venue.new(@foursquare, @json["venue"]) end |