Class: Fleakr::Objects::Search
- Inherits:
-
Object
- Object
- Fleakr::Objects::Search
- Defined in:
- lib/fleakr/objects/search.rb
Instance Method Summary collapse
- #add_parameter(parameter) ⇒ Object
-
#initialize(*parameters) ⇒ Search
constructor
Create a new search.
-
#results ⇒ Object
Retrieve search results from the API.
- #tags ⇒ Object
Constructor Details
Instance Method Details
#add_parameter(parameter) ⇒ Object
13 14 15 16 |
# File 'lib/fleakr/objects/search.rb', line 13 def add_parameter(parameter) value = parameter.is_a?(String) ? {:text => parameter} : parameter @parameters.merge!(value) end |
#results ⇒ Object
Retrieve search results from the API
23 24 25 26 27 28 |
# File 'lib/fleakr/objects/search.rb', line 23 def results @results ||= begin response = Fleakr::Api::MethodRequest.with_response!('photos.search', parameters) (response.body/'rsp/photos/photo').map {|p| Photo.new(p) } end end |
#tags ⇒ Object
18 19 20 |
# File 'lib/fleakr/objects/search.rb', line 18 def Array(@parameters[:tags]) end |