Class: Nineflats::Photo

Inherits:
Base
  • Object
show all
Defined in:
lib/nineflats-api/photo.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

base_url, client_app_key, client_app_key=, object_link

Constructor Details

#initialize(json) ⇒ Photo

Returns a new instance of Photo.



5
6
7
8
9
10
11
# File 'lib/nineflats-api/photo.rb', line 5

def initialize(json)
  photo = json.first[1]

  @title   = photo["title"]
  @caption = photo["caption"]
  @url     = photo["url"]
end

Instance Attribute Details

#captionObject

Returns the value of attribute caption.



3
4
5
# File 'lib/nineflats-api/photo.rb', line 3

def caption
  @caption
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/nineflats-api/photo.rb', line 3

def title
  @title
end

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/nineflats-api/photo.rb', line 3

def url
  @url
end

Class Method Details

.api_call(slug) ⇒ Object



13
14
15
# File 'lib/nineflats-api/photo.rb', line 13

def self.api_call(slug)
  base_url + "/places/#{slug}/photos?client_id=#{Nineflats::Base.client_app_key}"
end