Class: Foursquared::Response::Checkin
- Inherits:
-
Object
- Object
- Foursquared::Response::Checkin
- Defined in:
- lib/foursquared/response/checkin.rb
Overview
Checkin response
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#add_comment(options = {}) ⇒ Object
Add a comment to a check-in.
-
#comments ⇒ Hash
Count and items for comments on this checkin.
-
#created_at ⇒ Time
The time at which the checkin was created.
-
#delete_comment(options = {}) ⇒ Foursquared::Response::Checkin
Remove commment from check-in.
-
#full_comments ⇒ Hash
Full list of comments for this checkin.
-
#full_likes ⇒ Hash
The full groups of users who have liked the checkin.
-
#full_photos ⇒ Hash
The count and items of all the photos associated with the checkin.
-
#id ⇒ String
ID of the checkin.
-
#initialize(client, response) ⇒ Checkin
constructor
A new instance of Checkin.
-
#like(options = {}) ⇒ Object
Like or unlike a checkin.
-
#like? ⇒ Boolean
Whether the acting user likes the checkin.
-
#likes ⇒ Hash
Groups of users who have liked the checkin.
-
#location ⇒ Hash
The current location of the user.
-
#overlaps ⇒ Hash
Optional count and items of checkins from friends checked into the same venue around the same time.
-
#photos ⇒ Hash
The count and items of photos associated with the checkin.
-
#private ⇒ Object
If present, it indicates the checkin was marked as private and not sent to friends.
-
#score ⇒ Hash
Total and scores for this checkin.
-
#shout ⇒ String
Message from check-in, if present and visible to the acting user.
-
#source ⇒ Hash
If present, the name and url for the application that created this checkin.
-
#time_zone_offset ⇒ String
String representation of the time zone where this check-in occurred.
-
#type ⇒ String
One of checkin, shout, or venueless.
-
#user ⇒ Foursquared::Response::User
If the user is not clear from context, then a compact user is present.
-
#venue ⇒ Foursquared::Response::Venue
The venue of checkin.
Constructor Details
#initialize(client, response) ⇒ Checkin
Returns a new instance of Checkin.
6 7 8 9 |
# File 'lib/foursquared/response/checkin.rb', line 6 def initialize client, response @client = client @response = response end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/foursquared/response/checkin.rb', line 5 def client @client end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/foursquared/response/checkin.rb', line 5 def response @response end |
Instance Method Details
#add_comment(options = {}) ⇒ Object
Add a comment to a check-in
151 152 153 154 155 156 |
# File 'lib/foursquared/response/checkin.rb', line 151 def add_comment ={} response = post("/checkins/#{id}/addcomment", )["response"] @comment = response["comment"] @comment["user"] = Foursquared::Response::User.new(client, @comment["user"]) @comment end |
#comments ⇒ Hash
Count and items for comments on this checkin.
56 57 58 |
# File 'lib/foursquared/response/checkin.rb', line 56 def comments response["comments"] end |
#created_at ⇒ Time
The time at which the checkin was created
19 20 21 |
# File 'lib/foursquared/response/checkin.rb', line 19 def created_at Time.at(response["createdAt"]) if response["createdAt"] end |
#delete_comment(options = {}) ⇒ Foursquared::Response::Checkin
Remove commment from check-in
162 163 164 165 |
# File 'lib/foursquared/response/checkin.rb', line 162 def delete_comment ={} response = post("/checkins/#{id}/deletecomment", )["response"] @checkin = Foursquared::Response::Checkin.new(client, response["checkin"]) end |
#full_comments ⇒ Hash
Full list of comments for this checkin
62 63 64 |
# File 'lib/foursquared/response/checkin.rb', line 62 def full_comments client.get("/checkin/#{id}/comments")["comments"] end |
#full_likes ⇒ Hash
The full groups of users who have liked the checkin
122 123 124 125 126 127 128 |
# File 'lib/foursquared/response/checkin.rb', line 122 def full_likes @likes = client.get("/checkins/#{id}/likes")["response"]["likes"] @likes["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::User.new(client, item)} end @likes end |
#full_photos ⇒ Hash
The count and items of all the photos associated with the checkin
140 141 142 143 144 145 |
# File 'lib/foursquared/response/checkin.rb', line 140 def full_photos resp = get("/checkins/#{id}/photos") @photos = resp["photos"] @photos["items"].map!{|item| Foursquared::Response::Photo.new(client, item)} @photos end |
#id ⇒ String
ID of the checkin
13 14 15 |
# File 'lib/foursquared/response/checkin.rb', line 13 def id response["id"] end |
#like(options = {}) ⇒ Object
Like or unlike a checkin
170 171 172 173 174 175 176 |
# File 'lib/foursquared/response/checkin.rb', line 170 def like ={} response = post("/checkins/#{id}/like", )["response"]["likes"] response["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::User.new(client, item)} end response end |
#like? ⇒ Boolean
Whether the acting user likes the checkin
86 87 88 |
# File 'lib/foursquared/response/checkin.rb', line 86 def like? response["like"] end |
#likes ⇒ Hash
Groups of users who have liked the checkin
112 113 114 115 116 117 118 |
# File 'lib/foursquared/response/checkin.rb', line 112 def likes @likes = response["likes"] @likes["groups"].each do |group| group["items"].map!{|item| Foursquared::Response::User.new(client, item)} end @likes end |
#location ⇒ Hash
The current location of the user
42 43 44 |
# File 'lib/foursquared/response/checkin.rb', line 42 def location response["location"] end |
#overlaps ⇒ Hash
Optional count and items of checkins from friends checked into the same venue around the same time.
48 49 50 51 52 |
# File 'lib/foursquared/response/checkin.rb', line 48 def overlaps @overlaps = response["overlaps"] @overlaps["items"].map!{|item| Foursquared::Response::Checkin.new(client, item)} if @overlaps @overlaps end |
#photos ⇒ Hash
The count and items of photos associated with the checkin
104 105 106 107 108 |
# File 'lib/foursquared/response/checkin.rb', line 104 def photos @photos = response["photos"] @photos["photos"]["items"].map!{|item| Foursquared::Response::Photo.new(client, item)} if response["photos"] @photos end |
#private ⇒ Object
If present, it indicates the checkin was marked as private and not sent to friends
30 31 32 |
# File 'lib/foursquared/response/checkin.rb', line 30 def private response["private"] end |
#score ⇒ Hash
Total and scores for this checkin
80 81 82 |
# File 'lib/foursquared/response/checkin.rb', line 80 def score response["score"] end |
#shout ⇒ String
Message from check-in, if present and visible to the acting user.
68 69 70 |
# File 'lib/foursquared/response/checkin.rb', line 68 def shout response["shout"] end |
#source ⇒ Hash
If present, the name and url for the application that created this checkin.
74 75 76 |
# File 'lib/foursquared/response/checkin.rb', line 74 def source response["source"] end |
#time_zone_offset ⇒ String
String representation of the time zone where this check-in occurred.
92 93 94 |
# File 'lib/foursquared/response/checkin.rb', line 92 def time_zone_offset response["timeZoneOffset"] end |
#type ⇒ String
One of checkin, shout, or venueless.
25 26 27 |
# File 'lib/foursquared/response/checkin.rb', line 25 def type response["type"] end |
#user ⇒ Foursquared::Response::User
If the user is not clear from context, then a compact user is present
36 37 38 |
# File 'lib/foursquared/response/checkin.rb', line 36 def user Foursquared::Response::User.new(client, response["user"]) if response["user"] end |
#venue ⇒ Foursquared::Response::Venue
The venue of checkin
98 99 100 |
# File 'lib/foursquared/response/checkin.rb', line 98 def venue Foursquared::Response::Venue.new(client, response["venue"]) end |