Class: Unsplash::Search

Inherits:
Client
  • Object
show all
Defined in:
lib/unsplash/search.rb

Overview

Unsplash Search operations

Class Method Summary collapse

Methods inherited from Client

#connection, connection, connection=, #initialize, #reload!, #to_h

Constructor Details

This class inherits a constructor from Unsplash::Client

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Unsplash::Client

Class Method Details

.search(url, klass, params) ⇒ SearchResult

Helper class to facilitate search on multiple classes

Parameters:

  • url (String)

    Url to be searched into

  • klass (Class)

    Class to instantiate the contents with

  • params (Hash)

    Params for the search

Returns:


28
29
30
31
# File 'lib/unsplash/search.rb', line 28

def search(url, klass, params)
  list = JSON.parse(connection.get(url, params).body)
  SearchResult.new(list, klass)
end