Class: Foursquare::Checkin
- Inherits:
-
Object
- Object
- Foursquare::Checkin
- Defined in:
- lib/foursquare/checkin.rb
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
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.
5 6 7 |
# File 'lib/foursquare/checkin.rb', line 5 def initialize(foursquare, json) @foursquare, @json = foursquare, json end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
3 4 5 |
# File 'lib/foursquare/checkin.rb', line 3 def json @json end |
Instance Method Details
#created_at ⇒ Object
26 27 28 |
# File 'lib/foursquare/checkin.rb', line 26 def created_at Time.at(@json["createdAt"].to_i) end |
#fetch ⇒ Object
13 14 15 16 |
# File 'lib/foursquare/checkin.rb', line 13 def fetch @json = @foursquare.get("checkins/#{id}")["checkin"] self end |
#id ⇒ Object
9 10 11 |
# File 'lib/foursquare/checkin.rb', line 9 def id @json["id"] end |
#mayor? ⇒ Boolean
34 35 36 |
# File 'lib/foursquare/checkin.rb', line 34 def mayor? @json["isMayor"] end |
#shout ⇒ Object
30 31 32 |
# File 'lib/foursquare/checkin.rb', line 30 def shout @json["shout"] end |
#shout? ⇒ Boolean
22 23 24 |
# File 'lib/foursquare/checkin.rb', line 22 def shout? type == "shout" end |
#timezone ⇒ Object
38 39 40 |
# File 'lib/foursquare/checkin.rb', line 38 def timezone @json["timeZone"] end |
#type ⇒ Object
18 19 20 |
# File 'lib/foursquare/checkin.rb', line 18 def type @json["type"] end |
#user(full = false) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'lib/foursquare/checkin.rb', line 46 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
42 43 44 |
# File 'lib/foursquare/checkin.rb', line 42 def venue @json["venue"] && Foursquare::Venue.new(@foursquare, @json["venue"]) end |