Class: Foursquared::Response::Photo
- Inherits:
-
Object
- Object
- Foursquared::Response::Photo
- Defined in:
- lib/foursquared/response/photo.rb
Overview
Photo 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
-
#checkin ⇒ Foursquared::Response::Checkin
The checkin for which the photo was taken.
-
#created_at ⇒ Time
The time at which the photo was created.
-
#height ⇒ Integer
Height of the original photo in pixels.
-
#id ⇒ String
The ID of the photo.
-
#initialize(client, response) ⇒ Photo
constructor
A new instance of Photo.
-
#prefix ⇒ String
Start of the URL for this photo.
-
#source ⇒ Object
The name and url for the application that created this photo.
-
#suffix ⇒ String
End of the URL for this photo.
-
#tip ⇒ Foursquared::Response::Tip
Tip corresponding to the photo.
-
#urls ⇒ Hash
URLs for each photo size.
-
#user ⇒ Foursquared::Response::User
The user to which the photo belongs.
-
#venue ⇒ Foursquared::Response::Venue
Venue at which the photo was taken.
-
#visibility ⇒ String
Who all can see the photo.
-
#width ⇒ Integer
Width of the original photo in pixels.
Constructor Details
#initialize(client, response) ⇒ Photo
Returns a new instance of Photo.
6 7 8 9 |
# File 'lib/foursquared/response/photo.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/photo.rb', line 5 def client @client end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
5 6 7 |
# File 'lib/foursquared/response/photo.rb', line 5 def response @response end |
Instance Method Details
#checkin ⇒ Foursquared::Response::Checkin
The checkin for which the photo was taken
91 92 93 |
# File 'lib/foursquared/response/photo.rb', line 91 def checkin Foursquared::Response::Checkin.new(client, response["checkin"]) if response["checkin"] end |
#created_at ⇒ Time
The time at which the photo was created
19 20 21 |
# File 'lib/foursquared/response/photo.rb', line 19 def created_at Time.at(response["createdAt"]) if response["createdAt"] end |
#height ⇒ Integer
Height of the original photo in pixels
61 62 63 |
# File 'lib/foursquared/response/photo.rb', line 61 def height response["height"] end |
#id ⇒ String
The ID of the photo
13 14 15 |
# File 'lib/foursquared/response/photo.rb', line 13 def id response["id"] end |
#prefix ⇒ String
Start of the URL for this photo.
30 31 32 |
# File 'lib/foursquared/response/photo.rb', line 30 def prefix response["prefix"] end |
#source ⇒ Object
The name and url for the application that created this photo.
24 25 26 |
# File 'lib/foursquared/response/photo.rb', line 24 def source response["source"] end |
#suffix ⇒ String
End of the URL for this photo.
36 37 38 |
# File 'lib/foursquared/response/photo.rb', line 36 def suffix response["suffix"] end |
#tip ⇒ Foursquared::Response::Tip
Tip corresponding to the photo
85 86 87 |
# File 'lib/foursquared/response/photo.rb', line 85 def tip Foursquared::Response::Tip.new(client, response["tip"]) if response["tip"] end |
#urls ⇒ Hash
URLs for each photo size
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/foursquared/response/photo.rb', line 48 def urls @urls = { "36x36" => url(36,36), "100x100" => url(100,100), "300x300" => url(300,300), "500x500" => url(500,500) } @urls.merge!({"original" => url(width, height)}) if (width and height) @urls end |
#user ⇒ Foursquared::Response::User
The user to which the photo belongs
42 43 44 |
# File 'lib/foursquared/response/photo.rb', line 42 def user Foursquared::Response::User.new(client, response["user"]) if response["user"] end |
#venue ⇒ Foursquared::Response::Venue
Venue at which the photo was taken
79 80 81 |
# File 'lib/foursquared/response/photo.rb', line 79 def venue Foursquared::Response::Venue.new(client, response["venue"]) if response["venue"] end |
#visibility ⇒ String
Who all can see the photo
73 74 75 |
# File 'lib/foursquared/response/photo.rb', line 73 def visibility response["visibility"] end |
#width ⇒ Integer
Width of the original photo in pixels
67 68 69 |
# File 'lib/foursquared/response/photo.rb', line 67 def width response["width"] end |