Module: Gurunavi::Photos
- Included in:
- Client
- Defined in:
- lib/gurunavi/photos.rb
Instance Method Summary collapse
-
#map_photos_from_response(res) ⇒ Object
therefore convert response for photos, it means convert response to that: [ hashie, … ].
- #photo_search(options = {}) ⇒ Object
Instance Method Details
#map_photos_from_response(res) ⇒ Object
therefore convert response for photos, it means convert response to that: [
{photo hashie},
...
]
51 52 53 54 55 56 57 58 59 |
# File 'lib/gurunavi/photos.rb', line 51 def map_photos_from_response(res) index = 0 photos = Hashie::Array.new while res.include?(index.to_s) photos.push(res[index.to_s].photo) index += 1 end photos end |
#photo_search(options = {}) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/gurunavi/photos.rb', line 5 def photo_search(={}) response = connection.get do |req| req.url "PhotoSearchAPI/#{@api_version}", end # if error happens, raise APIError from return_error_or_body function. body = return_error_or_body(response, response.body.response) map_photos_from_response(body) end |