Class: GooglePlaces::Photo
- Inherits:
-
Object
- Object
- GooglePlaces::Photo
- Defined in:
- lib/google_places/photo.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
Returns the value of attribute height.
-
#html_attributions ⇒ Object
Returns the value of attribute html_attributions.
-
#photo_reference ⇒ Object
Returns the value of attribute photo_reference.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#fetch_url(maxwidth, options = {}) ⇒ URL
Search for a Photo’s url with its reference key.
-
#initialize(width, height, photo_reference, html_attributions, api_key) ⇒ Photo
constructor
A new instance of Photo.
Constructor Details
#initialize(width, height, photo_reference, html_attributions, api_key) ⇒ Photo
Returns a new instance of Photo.
5 6 7 8 9 10 11 |
# File 'lib/google_places/photo.rb', line 5 def initialize(width, height, photo_reference, html_attributions, api_key) @width = width @height = height @photo_reference = photo_reference @html_attributions = html_attributions @api_key = api_key end |
Instance Attribute Details
#height ⇒ Object
Returns the value of attribute height.
3 4 5 |
# File 'lib/google_places/photo.rb', line 3 def height @height end |
#html_attributions ⇒ Object
Returns the value of attribute html_attributions.
3 4 5 |
# File 'lib/google_places/photo.rb', line 3 def html_attributions @html_attributions end |
#photo_reference ⇒ Object
Returns the value of attribute photo_reference.
3 4 5 |
# File 'lib/google_places/photo.rb', line 3 def photo_reference @photo_reference end |
#width ⇒ Object
Returns the value of attribute width.
3 4 5 |
# File 'lib/google_places/photo.rb', line 3 def width @width end |
Instance Method Details
#fetch_url(maxwidth, options = {}) ⇒ URL
Search for a Photo’s url with its reference key
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/google_places/photo.rb', line 23 def fetch_url(maxwidth, = {}) language = .delete(:language) = .delete(:retry_options) || {} unless @fetched_url @fetched_url = Request.photo_url( :maxwidth => maxwidth, :photoreference => @photo_reference, :key => @api_key, :retry_options => ) end @fetched_url end |