Class: RakutenApi::GenreSearch::Client

Inherits:
Base::Client show all
Defined in:
lib/rakuten_api/genre_search/client.rb

Defined Under Namespace

Classes: Params

Constant Summary collapse

REQUEST_PATH =
"/services/api/IchibaGenre/Search/20120723"

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base::Client

#add_param, #connection, #initialize, #new_connection, #params

Constructor Details

This class inherits a constructor from RakutenApi::Base::Client

Class Method Details

.root_categories(application_id = nil, affiliate_id = nil) ⇒ Array<RakutenApi::GenreSearch::Model>

get rakuten root genres

Parameters:

  • application_id (String) (defaults to: nil)
  • affiliate_id (String) (defaults to: nil)

Returns:

Raises:



20
21
22
23
24
25
26
# File 'lib/rakuten_api/genre_search/client.rb', line 20

def self.root_categories(application_id = nil, affiliate_id = nil)
  response = self.new(application_id, affiliate_id) do |params|
    params.add_param :genre_id, 0
  end.request
  raise ::RakutenApi::ServerError.new($response.error_message, $response.status) if response.error?
  response.children
end

Instance Method Details

#getObject



8
9
10
# File 'lib/rakuten_api/genre_search/client.rb', line 8

def get
  connection.get(REQUEST_PATH, params)
end

#init_params(application_id, affiliate_id) ⇒ Object



28
29
30
# File 'lib/rakuten_api/genre_search/client.rb', line 28

def init_params(application_id, affiliate_id)
  @params = Params.new(application_id, affiliate_id)
end

#requestObject



12
13
14
# File 'lib/rakuten_api/genre_search/client.rb', line 12

def request
  Response.new(get)
end