Class: Rapa::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rapa/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(access_key_id:, associate_tag:, secret_access_key:) ⇒ Client

Returns a new instance of Client.

Parameters:

  • access_key_id (String)
  • associate_tag (String)
  • secret_access_key (String)


10
11
12
13
14
# File 'lib/rapa/client.rb', line 10

def initialize(access_key_id:, associate_tag:, secret_access_key:)
  @access_key_id = access_key_id
  @associate_tag = associate_tag
  @secret_access_key = secret_access_key
end

Instance Method Details

#connectionFaraday::Connection

Returns:

  • (Faraday::Connection)


17
18
19
20
21
22
23
# File 'lib/rapa/client.rb', line 17

def connection
  @connection ||= ::Faraday::Connection.new do |connection|
    connection.response :xml
    connection.options.params_encoder = ::Rapa::Encoder.new
    connection.adapter :net_http
  end
end

#list_items(item_ids:, domain:, id_type: nil, related_item_page: nil, relationship_type: nil, response_groups: nil, search_index: nil) ⇒ Rapa::Responses::ListItemsResponse

Parameters:

  • item_ids (Array<String>)
  • domain (String)
  • id_type (String, nil) (defaults to: nil)
  • related_item_page (Integer, nil) (defaults to: nil)
  • relationship_type (String, nil) (defaults to: nil)
  • response_groups (Array<String>, nil) (defaults to: nil)

Returns:



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/rapa/client.rb', line 50

def list_items(
  item_ids:,
  domain:,
  id_type: nil,
  related_item_page: nil,
  relationship_type: nil,
  response_groups: nil,
  search_index: nil
)
  send_request(
    item_ids: item_ids,
    domain: domain,
    id_type: id_type,
    query_class: ::Rapa::Queries::ListItemsQuery,
    related_item_page: related_item_page,
    relationship_type: relationship_type,
    response_class: ::Rapa::Responses::ListItemsResponse,
    response_groups: response_groups,
    search_index: search_index
  )
end

#lookup_browse_node(browse_node_id:, domain:, response_groups: nil) ⇒ Rapa::Responses::LookupBrowseNodeResponse

Parameters:

  • browse_node_id (Integer)
  • domain (String)
  • response_groups (Array<String>, nil) (defaults to: nil)

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/rapa/client.rb', line 29

def lookup_browse_node(
  browse_node_id:,
  domain:,
  response_groups: nil
)
  send_request(
    browse_node_id: browse_node_id,
    domain: domain,
    query_class: ::Rapa::Queries::LookupBrowseNode,
    response_class: ::Rapa::Responses::LookupBrowseNodeResponse,
    response_groups: response_groups
  )
end

#search_items(browse_node_id: nil, domain:, item_page: nil, keywords: nil, power: nil, related_item_page: nil, relationship_type: nil, response_groups: nil, search_index: nil) ⇒ Rapa::Responses::SearchItemsResponse

Parameters:

  • browse_node_id (Integer) (defaults to: nil)
  • domain (String)
  • item_page (Integer, nil) (defaults to: nil)
  • keywords (Array<String>, nil) (defaults to: nil)
  • power (String, nil) (defaults to: nil)
  • related_item_page (Integer, nil) (defaults to: nil)
  • relationship_type (String, nil) (defaults to: nil)
  • response_groups (Array<String>, nil) (defaults to: nil)
  • search_index (String, nil) (defaults to: nil)

Returns:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/rapa/client.rb', line 82

def search_items(
  browse_node_id: nil,
  domain:,
  item_page: nil,
  keywords: nil,
  power: nil,
  related_item_page: nil,
  relationship_type: nil,
  response_groups: nil,
  search_index: nil
)
  send_request(
    browse_node_id: browse_node_id,
    domain: domain,
    item_page: item_page,
    keywords: keywords,
    power: power,
    query_class: ::Rapa::Queries::SearchItemsQuery,
    related_item_page: related_item_page,
    relationship_type: relationship_type,
    response_class: ::Rapa::Responses::SearchItemsResponse,
    response_groups: response_groups,
    search_index: search_index,
  )
end