Class: Foursquare::Photo
- Inherits:
-
Object
- Object
- Foursquare::Photo
- Defined in:
- lib/foursquare/photo.rb
Instance Method Summary collapse
- #created_at ⇒ Object
- #id ⇒ Object
-
#initialize(foursquare, json) ⇒ Photo
constructor
A new instance of Photo.
- #name ⇒ Object
- #sizes ⇒ Object
- #square_100 ⇒ Object
- #square_100_url ⇒ Object
- #square_300 ⇒ Object
- #square_300_url ⇒ Object
- #square_36 ⇒ Object
- #square_36_url ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(foursquare, json) ⇒ Photo
Returns a new instance of Photo.
3 4 5 |
# File 'lib/foursquare/photo.rb', line 3 def initialize(foursquare, json) @foursquare, @json = foursquare, json end |
Instance Method Details
#created_at ⇒ Object
15 16 17 |
# File 'lib/foursquare/photo.rb', line 15 def created_at @json["createdAt"] end |
#id ⇒ Object
7 8 9 |
# File 'lib/foursquare/photo.rb', line 7 def id @json["id"] end |
#name ⇒ Object
11 12 13 |
# File 'lib/foursquare/photo.rb', line 11 def name @json["name"] end |
#sizes ⇒ Object
23 24 25 |
# File 'lib/foursquare/photo.rb', line 23 def sizes @json["sizes"] end |
#square_100 ⇒ Object
35 36 37 |
# File 'lib/foursquare/photo.rb', line 35 def square_100 @square_100 ||= @json["sizes"]["items"].select { |i| i["width"] == 100 }.first end |
#square_100_url ⇒ Object
39 40 41 |
# File 'lib/foursquare/photo.rb', line 39 def square_100_url square_100["url"] end |
#square_300 ⇒ Object
27 28 29 |
# File 'lib/foursquare/photo.rb', line 27 def square_300 @square_300 ||= @json["sizes"]["items"].select { |i| i["width"] == 300 }.first end |
#square_300_url ⇒ Object
31 32 33 |
# File 'lib/foursquare/photo.rb', line 31 def square_300_url square_300["url"] end |
#square_36 ⇒ Object
43 44 45 |
# File 'lib/foursquare/photo.rb', line 43 def square_36 @square_36 ||= @json["sizes"]["items"].select { |i| i["width"] == 36 }.first end |
#square_36_url ⇒ Object
47 48 49 |
# File 'lib/foursquare/photo.rb', line 47 def square_36_url square_36["url"] end |
#url ⇒ Object
19 20 21 |
# File 'lib/foursquare/photo.rb', line 19 def url @json["url"] end |