Class: Foursquare::Photo

Inherits:
Object
  • Object
show all
Defined in:
lib/foursquare/photo.rb

Instance Method Summary collapse

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_atObject



15
16
17
# File 'lib/foursquare/photo.rb', line 15

def created_at
  @json["createdAt"]
end

#idObject



7
8
9
# File 'lib/foursquare/photo.rb', line 7

def id
  @json["id"]
end

#nameObject



11
12
13
# File 'lib/foursquare/photo.rb', line 11

def name
  @json["name"]
end

#sizesObject



23
24
25
# File 'lib/foursquare/photo.rb', line 23

def sizes
  @json["sizes"]
end

#square_100Object



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_urlObject



39
40
41
# File 'lib/foursquare/photo.rb', line 39

def square_100_url
  square_100["url"]
end

#square_300Object



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_urlObject



31
32
33
# File 'lib/foursquare/photo.rb', line 31

def square_300_url
  square_300["url"]
end

#square_36Object



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_urlObject



47
48
49
# File 'lib/foursquare/photo.rb', line 47

def square_36_url
  square_36["url"]
end

#urlObject



19
20
21
# File 'lib/foursquare/photo.rb', line 19

def url
  @json["url"]
end