amazon_pa_api 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ccb8fa07ef8b4597a684d2f01a543a246f3f9a57
|
4
|
+
data.tar.gz: e66b403f8ee967a51d4de8f3cf096c139e379686
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad29ba00ab9c5cd7f5fb91fe24e146cab281f1844050b2123719cdee586c3b643166d45eb1b94026a2e3eb06c477cf9a3af39712e7360caa199638755367093d
|
7
|
+
data.tar.gz: f565708c1ebe243bddd581e090d069f88bad5bc6af387777991798889c7cac158838f0724cc355fc5638a640efb8909569da11e3359c49ee4520110dc19bd4bf
|
data/README.md
CHANGED
@@ -6,6 +6,7 @@ Supported Amazon Product Advertising API operations.
|
|
6
6
|
* ItemLookup
|
7
7
|
* ItemSearch
|
8
8
|
* SimilarityLookup
|
9
|
+
* BrowseNodeLookup
|
9
10
|
|
10
11
|
## Installation
|
11
12
|
|
@@ -25,7 +26,7 @@ Or install it yourself as:
|
|
25
26
|
|
26
27
|
## Usage
|
27
28
|
|
28
|
-
You can use easily Amazon Product Advertising API calls, like this
|
29
|
+
You can use easily Amazon Product Advertising API calls, like this:
|
29
30
|
|
30
31
|
```
|
31
32
|
item_lookup = AmazonPaApi::ItemLookup.new('B0026IAWMU')
|
@@ -36,7 +37,7 @@ You can use easily Amazon Product Advertising API calls, like this.
|
|
36
37
|
puts item_lookup.get.body # => XML
|
37
38
|
```
|
38
39
|
|
39
|
-
Or you can set Amazon credentials as hash, like this
|
40
|
+
Or you can set Amazon credentials as hash, like this:
|
40
41
|
|
41
42
|
```
|
42
43
|
credentials = { access_key_id: "Your Amazon AWS access key id",
|
@@ -52,10 +53,22 @@ Or you can set Amazon credentials as hash, like this.
|
|
52
53
|
puts item_lookup.get.body # => XML
|
53
54
|
```
|
54
55
|
|
55
|
-
If you want to choice Amazon ECommerce end point
|
56
|
+
If you want to choice Amazon ECommerce end point:
|
56
57
|
|
57
58
|
```
|
59
|
+
# :ca, :de, :fr, :jp, :uk or :us.
|
58
60
|
item_lookup = AmazonPaApi::ItemLookup.new('B00NLDYGDK', region: :uk)
|
61
|
+
puts item_lookup.get.body # => XML
|
62
|
+
|
63
|
+
# or like this:
|
64
|
+
item_lookup = AmazonPaApi::ItemLookup.new('B0026IAWMU')
|
65
|
+
item_lookup.credentials = credentials
|
66
|
+
puts item_lookup.get.body # => XML
|
67
|
+
|
68
|
+
item_lookup.region = :uk
|
69
|
+
item_lookup.item_id = 'B00NLDYGDK'
|
70
|
+
puts item_lookup.get.body # => XML
|
71
|
+
|
59
72
|
```
|
60
73
|
|
61
74
|
You can use Amazon Product Advertising API operation's request parameters as instance methods.
|
@@ -67,6 +80,57 @@ You can use Amazon Product Advertising API operation's request parameters as ins
|
|
67
80
|
puts item_search.get.body # => XML
|
68
81
|
```
|
69
82
|
|
83
|
+
### ItemLookup
|
84
|
+
|
85
|
+
```
|
86
|
+
credentials = { access_key_id: "Your Amazon AWS access key id",
|
87
|
+
secret_access_key: "Your Amazon AWS secret key",
|
88
|
+
associate_tag: "Your Amazon associate tag"
|
89
|
+
}
|
90
|
+
|
91
|
+
item_lookup = AmazonPaApi::ItemLookup.new('B0026IAWMU')
|
92
|
+
item_lookup.credentials = credentials
|
93
|
+
puts item_lookup.get.body # => XML
|
94
|
+
|
95
|
+
```
|
96
|
+
|
97
|
+
### ItemSearch
|
98
|
+
|
99
|
+
```
|
100
|
+
credentials = { access_key_id: "Your Amazon AWS access key id",
|
101
|
+
secret_access_key: "Your Amazon AWS secret key",
|
102
|
+
associate_tag: "Your Amazon associate tag"
|
103
|
+
}
|
104
|
+
item_search = AmazonPaApi::ItemSearch.new('Attack on Titan', 'Books')
|
105
|
+
item_search.credentials = credentials
|
106
|
+
puts item_search.get.body # => XML
|
107
|
+
```
|
108
|
+
|
109
|
+
### SimilarityLookup
|
110
|
+
|
111
|
+
```
|
112
|
+
credentials = { access_key_id: "Your Amazon AWS access key id",
|
113
|
+
secret_access_key: "Your Amazon AWS secret key",
|
114
|
+
associate_tag: "Your Amazon associate tag"
|
115
|
+
}
|
116
|
+
similarity_lookup = AmazonPaApi::SimilarityLookup.new('B0026IAWNU')
|
117
|
+
similarity_lookup.credentials = credentials
|
118
|
+
puts similarity_lookup.get.body # => XML
|
119
|
+
```
|
120
|
+
|
121
|
+
### BrowseNodeLookup
|
122
|
+
|
123
|
+
```
|
124
|
+
credentials = { access_key_id: "Your Amazon AWS access key id",
|
125
|
+
secret_access_key: "Your Amazon AWS secret key",
|
126
|
+
associate_tag: "Your Amazon associate tag"
|
127
|
+
}
|
128
|
+
|
129
|
+
browse_node_lookup = AmazonPaApi::BrowseNodeLookup(71443051)
|
130
|
+
browse_node_lookup.credentials = credentials
|
131
|
+
puts browse_node_lookup.get.body # => XML
|
132
|
+
```
|
133
|
+
|
70
134
|
## Development
|
71
135
|
|
72
136
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/amazon_pa_api.rb
CHANGED
@@ -3,6 +3,7 @@ require "amazon_pa_api/extensions"
|
|
3
3
|
require "amazon_pa_api/operations/item_lookup"
|
4
4
|
require "amazon_pa_api/operations/item_search"
|
5
5
|
require "amazon_pa_api/operations/similarity_lookup"
|
6
|
+
require "amazon_pa_api/operations/browse_node_lookup"
|
6
7
|
|
7
8
|
require "net/http"
|
8
9
|
require "cgi"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'amazon_pa_api/operations/operation'
|
2
|
+
|
3
|
+
module AmazonPaApi
|
4
|
+
class BrowseNodeLookup < AmazonPaApi::Operation
|
5
|
+
# This is list of Amazon Product Advertising API request parameters.
|
6
|
+
REQUEST_PARAMETERS = [
|
7
|
+
:browse_node_id,
|
8
|
+
:response_group,
|
9
|
+
]
|
10
|
+
|
11
|
+
# BrowseNodeLookup required browse_node_id
|
12
|
+
def initialize(browse_node_id, region: :jp)
|
13
|
+
super()
|
14
|
+
self.browse_node_id = browse_node_id
|
15
|
+
self.region = region
|
16
|
+
self.operation = "BrowseNodeLookup"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon_pa_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sakura-computer
|
@@ -73,6 +73,7 @@ files:
|
|
73
73
|
- bin/setup
|
74
74
|
- lib/amazon_pa_api.rb
|
75
75
|
- lib/amazon_pa_api/extensions.rb
|
76
|
+
- lib/amazon_pa_api/operations/browse_node_lookup.rb
|
76
77
|
- lib/amazon_pa_api/operations/item_lookup.rb
|
77
78
|
- lib/amazon_pa_api/operations/item_search.rb
|
78
79
|
- lib/amazon_pa_api/operations/operation.rb
|