Module: PaapiMini

Defined in:
lib/paapi_mini.rb,
lib/aws_v4_auth.rb,
lib/http_client.rb,
lib/paapi_mini/version.rb

Defined Under Namespace

Modules: Http Classes: Auth, Error

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.search_items(access_key, secret_key, partner_tag, keywords, item_page: 1, min_price: 1, max_price: 100000, min_review_rating: 1, host: "webservices.amazon.co.jp", region: "us-west-2", market_place: "www.amazon.co.jp") ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/paapi_mini.rb', line 10

def self.search_items(access_key,
                     secret_key,
                     partner_tag,
                     keywords,
                     item_page: 1,
                     min_price: 1,
                     max_price: 100000,
                     min_review_rating: 1,
                     host: "webservices.amazon.co.jp",
                     region: "us-west-2",
                     market_place: "www.amazon.co.jp")

  aws_auth = Auth.create_search_items(access_key,
                                      secret_key,
                                      partner_tag,
                                      keywords: keywords,
                                      item_page: item_page,
                                      min_price: min_price,
                                      max_price: max_price,
                                      min_review_rating: min_review_rating,
                                      host: host,
                                      region: region,
                                      market_place: market_place)

  aws_auth_headers = aws_auth.make_headers
  aws_auth_headers['Content-Type'] = 'application/json; charset=utf-8'

  return Http.post(aws_auth.make_uri, aws_auth.payload, aws_auth_headers)
end