Class: TroveOAuth::Photo

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, date, original_url) ⇒ Photo

Returns a new instance of Photo.



5
6
7
8
9
10
# File 'lib/trove_oauth/photo.rb', line 5

def initialize(id, date, original_url)
  self.id = id
  self.date = date
  self.urls = {:original => original_url}
  self.tags = []
end

Instance Attribute Details

#album_idObject

Returns the value of attribute album_id.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def album_id
  @album_id
end

#dateObject

Returns the value of attribute date.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def date
  @date
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def description
  @description
end

#heightObject

Returns the value of attribute height.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def height
  @height
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def id
  @id
end

#latObject

Returns the value of attribute lat.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def lat
  @lat
end

#licenseObject

Returns the value of attribute license.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def license
  @license
end

#lngObject

Returns the value of attribute lng.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def lng
  @lng
end

#original_web_urlObject

Returns the value of attribute original_web_url.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def original_web_url
  @original_web_url
end

#ownerObject

Returns the value of attribute owner.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def owner
  @owner
end

#photo_publicObject

Returns the value of attribute photo_public.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def photo_public
  @photo_public
end

#serviceObject

Returns the value of attribute service.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def service
  @service
end

#tagsObject

Returns the value of attribute tags.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def tags
  @tags
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def title
  @title
end

#urlsObject

Returns the value of attribute urls.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def urls
  @urls
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'lib/trove_oauth/photo.rb', line 3

def width
  @width
end

Instance Method Details

#set_location(lat, lng) ⇒ Object



12
13
14
15
# File 'lib/trove_oauth/photo.rb', line 12

def set_location(lat, lng)
  self.lat = lat
  self.lng = lng
end

#to_jsonObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/trove_oauth/photo.rb', line 17

def to_json
  {
    'album_id' => album_id,
    'date' => date.to_s,
    'description' => description,
    'height' => height,
    'id' => id,
    'license' => license,
    'loc' => [lat, lng],
    'original_web_url' => original_web_url,
    'owner' => owner,
    'public' => photo_public,
    'service' => service,
    'tags' => tags,
    'title' => title,
    'urls' => urls,
    'width' => width
  }.to_json
end