Class: Edmunds::Photo
Instance Attribute Summary
Attributes inherited from API
#api_key, #base, #base_url, #format, #image_base_url
Instance Method Summary collapse
-
#find_by_style_id(style_id) ⇒ Object
get an array of images available from this style id.
-
#find_sample_by_style_id(style_id) ⇒ Object
get the array of images, then sample one image from the group of exterior and front quarter panel (FQ) shots, then go ahead and append the base url so you can view the image directly.
Methods inherited from API
#call_api, #initialize, #set_key
Constructor Details
This class inherits a constructor from Edmunds::API
Instance Method Details
#find_by_style_id(style_id) ⇒ Object
get an array of images available from this style id
5 6 7 8 9 |
# File 'lib/edmunds/photo.rb', line 5 def find_by_style_id(style_id) @url = "photo/service/findphotosbystyleid?styleId=#{style_id}&" call_api @json end |
#find_sample_by_style_id(style_id) ⇒ Object
get the array of images, then sample one image from the group of exterior and front quarter panel (FQ) shots, then go ahead and append the base url so you can view the image directly. if no sample is found, just return the entire array.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/edmunds/photo.rb', line 13 def find_sample_by_style_id(style_id) if style_id.is_a?(Array) style_id.each do |id| fetch_image_groups(id) break if @json.present? end else fetch_image_groups(style_id) end select_group concatenate rescue @json end |