Class: Foursquared::Response::Photo

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

Overview

Photo response

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/foursquared/response/photo.rb', line 5

def client
  @client
end

#responseObject (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

#checkinFoursquared::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_atTime

The time at which the photo was created

Returns:

  • (Time)


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

def created_at
  Time.at(response["createdAt"]) if response["createdAt"]
end

#heightInteger

Height of the original photo in pixels

Returns:

  • (Integer)


61
62
63
# File 'lib/foursquared/response/photo.rb', line 61

def height
  response["height"]
end

#idString

The ID of the photo

Returns:

  • (String)


13
14
15
# File 'lib/foursquared/response/photo.rb', line 13

def id
  response["id"]
end

#prefixString

Start of the URL for this photo.

Returns:

  • (String)


30
31
32
# File 'lib/foursquared/response/photo.rb', line 30

def prefix
  response["prefix"]
end

#sourceObject

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

#suffixString

End of the URL for this photo.

Returns:

  • (String)


36
37
38
# File 'lib/foursquared/response/photo.rb', line 36

def suffix
  response["suffix"]
end

#tipFoursquared::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

#urlsHash

URLs for each photo size

Returns:

  • (Hash)


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

#userFoursquared::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

#venueFoursquared::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

#visibilityString

Who all can see the photo

Returns:

  • (String)


73
74
75
# File 'lib/foursquared/response/photo.rb', line 73

def visibility
  response["visibility"]
end

#widthInteger

Width of the original photo in pixels

Returns:

  • (Integer)


67
68
69
# File 'lib/foursquared/response/photo.rb', line 67

def width
  response["width"]
end