rakuten_product_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +13 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +12 -0
- data/Gemfile.lock +48 -0
- data/LICENSE.txt +21 -0
- data/README.md +133 -0
- data/Rakefile +16 -0
- data/bin/console +16 -0
- data/bin/setup +8 -0
- data/lib/rakuten_product_api.rb +34 -0
- data/lib/rakuten_product_api/client.rb +133 -0
- data/lib/rakuten_product_api/item.rb +83 -0
- data/lib/rakuten_product_api/response.rb +18 -0
- data/lib/rakuten_product_api/version.rb +5 -0
- data/rakuten_product_api.gemspec +38 -0
- metadata +90 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e1fd5a4ee5820366f85f0c1266d2f0edd5ce8375343e64cccd6c55ab95274619
|
4
|
+
data.tar.gz: 56e0a89e406c5d7e16cf7b9cc80be336eba8d9ae1fc1c01c94d6088d980c8815
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 67867a384786c0c5f316fb228a130c5e8593a8d7e18639d305de3849a7d78a467c19c57f5ec1406bc0e5ef674031c4834c280abf9a974bf9b5f0f86fb53b7994
|
7
|
+
data.tar.gz: e27d9b209f5f6ac43cbd9ae8af25a0ccb74d343ec89e11601604cbbbae85f538521db537a85ec4bafb235b306777b18ba0fd0c91839ad926a8b914495df40061
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rakuten_product_api (0.1.0)
|
5
|
+
byebug
|
6
|
+
nokogiri
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
ast (2.4.2)
|
12
|
+
byebug (11.1.3)
|
13
|
+
minitest (5.14.3)
|
14
|
+
nokogiri (1.11.1-x86_64-darwin)
|
15
|
+
racc (~> 1.4)
|
16
|
+
parallel (1.20.1)
|
17
|
+
parser (3.0.0.0)
|
18
|
+
ast (~> 2.4.1)
|
19
|
+
racc (1.5.2)
|
20
|
+
rainbow (3.0.0)
|
21
|
+
rake (13.0.3)
|
22
|
+
regexp_parser (2.0.3)
|
23
|
+
rexml (3.2.4)
|
24
|
+
rubocop (1.9.1)
|
25
|
+
parallel (~> 1.10)
|
26
|
+
parser (>= 3.0.0.0)
|
27
|
+
rainbow (>= 2.2.2, < 4.0)
|
28
|
+
regexp_parser (>= 1.8, < 3.0)
|
29
|
+
rexml
|
30
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
31
|
+
ruby-progressbar (~> 1.7)
|
32
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
33
|
+
rubocop-ast (1.4.1)
|
34
|
+
parser (>= 2.7.1.5)
|
35
|
+
ruby-progressbar (1.11.0)
|
36
|
+
unicode-display_width (2.0.0)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
x86_64-darwin-20
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
minitest (~> 5.0)
|
43
|
+
rake (~> 13.0)
|
44
|
+
rakuten_product_api!
|
45
|
+
rubocop (~> 1.7)
|
46
|
+
|
47
|
+
BUNDLED WITH
|
48
|
+
2.2.8
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Dan Milne
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
# RakutenProductApi
|
2
|
+
|
3
|
+
To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
## API Documentation
|
6
|
+
|
7
|
+
The API documentation can be found at the following links.
|
8
|
+
- [API Documentation PDF](https://developers.rakutenmarketing.com/console/registry/resource/_system/governance/apimgt/applicationdata/provider/RakutenMarketing/artifacts/API_Developer_Portal-Acquiring_Your_Access_Token_Guide.pdf)
|
9
|
+
- [API Overview](https://developers.rakutenmarketing.com/subscribe/)
|
10
|
+
- [API Keys](https://developers.rakutenmarketing.com/subscribe/site/pages/subscriptions.jag)
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add this line to your application's Gemfile:
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem 'rakuten_product_api'
|
18
|
+
```
|
19
|
+
|
20
|
+
And then execute:
|
21
|
+
|
22
|
+
$ bundle install
|
23
|
+
|
24
|
+
Or install it yourself as:
|
25
|
+
|
26
|
+
$ gem install rakuten_product_api
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
|
30
|
+
The library can be configured with an initializer. For Rails, create the file `config/initializers/rakuten.rb`
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
RakutenProductApi.configure do |config|
|
34
|
+
config.sid = 'your-site-id'
|
35
|
+
config.username = 'your-rakuten-username'
|
36
|
+
config.password = 'your-rakuten-password'
|
37
|
+
config.consumer_key = 'your-consumer-key'
|
38
|
+
config.consumer_secret = 'your-consumer-secret'
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
Additionally, you can configure a mid (Merchant ID). This will be applied to all requests and restrict queries to that merchant.
|
43
|
+
|
44
|
+
Once you have configured the library, you can create a client.
|
45
|
+
|
46
|
+
```ruby
|
47
|
+
client = RakutenProductApi::Client.new
|
48
|
+
|
49
|
+
client.username
|
50
|
+
=> "dkam"
|
51
|
+
```
|
52
|
+
|
53
|
+
### Search
|
54
|
+
Search for keywords:
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
results = client.search(keyword: 'Murderbot', mid: 38131)
|
58
|
+
results.items.count
|
59
|
+
=> 7
|
60
|
+
|
61
|
+
results.items[0].merchant
|
62
|
+
=> "Rakuten Kobo Australia"
|
63
|
+
|
64
|
+
results.items[0].isbn
|
65
|
+
=> "9781250185464"
|
66
|
+
|
67
|
+
results.items[0].title
|
68
|
+
=> "Exit Strategy"
|
69
|
+
|
70
|
+
results.items[0].price
|
71
|
+
=> ["15.06", "AUD"]
|
72
|
+
|
73
|
+
results.items[0].rrp
|
74
|
+
=> ["18.70", "AUD"]
|
75
|
+
```
|
76
|
+
|
77
|
+
Search for ISBNs:
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
results = client.search(keyword: '9781501977824', mid: 38131)
|
81
|
+
results.items[0].gtin
|
82
|
+
=> "9781501977824"
|
83
|
+
results.items[0].title
|
84
|
+
=> "All Systems Red"
|
85
|
+
```
|
86
|
+
|
87
|
+
The API also allows other attribute:
|
88
|
+
|
89
|
+
* exact
|
90
|
+
* one
|
91
|
+
* none
|
92
|
+
* sort & sorttype
|
93
|
+
|
94
|
+
When using sort, you must also use sorttype ( 'asc' or 'dsc'). See the documentation for more.
|
95
|
+
|
96
|
+
This client should be threadsafe. Configuration values are local to your instance.
|
97
|
+
|
98
|
+
## TODO
|
99
|
+
|
100
|
+
This library implement the parts I need. For example, it doesn't handle paging through results as I don't need it, but I'm happy to accept pull request.
|
101
|
+
|
102
|
+
## Notes
|
103
|
+
|
104
|
+
* ISBN is taken from either the `sku` or the `keywords` fields and mached against a regular expression `/97[98]\d{10}/` as there's no specific field for it.
|
105
|
+
* Condition is guessed by looking for the string "Used" in the description. This is a terrible idea, but there is no field for condition.
|
106
|
+
* This library aliases rrp -> price and price -> saleprice. When sorting you need to use the original attribute names ( price / saleprice )
|
107
|
+
|
108
|
+
## Development
|
109
|
+
|
110
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
111
|
+
|
112
|
+
If you create a file `config.rb`, it will be loaded by `bin/console`, allowing you to configure keys and markets.
|
113
|
+
|
114
|
+
```ruby
|
115
|
+
RakutenProductApi.configure do |config|
|
116
|
+
config.sid = 'your-site-id'
|
117
|
+
config.username = 'your-rakuten-username'
|
118
|
+
config.password = 'your-rakuten-password'
|
119
|
+
config.consumer_key = 'your-consumer-key'
|
120
|
+
config.consumer_secret = 'your-consumer-secret'
|
121
|
+
end
|
122
|
+
```
|
123
|
+
|
124
|
+
|
125
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
126
|
+
|
127
|
+
## Contributing
|
128
|
+
|
129
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dkam/rakuten_product_api.
|
130
|
+
|
131
|
+
## License
|
132
|
+
|
133
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rake/testtask"
|
5
|
+
|
6
|
+
Rake::TestTask.new(:test) do |t|
|
7
|
+
t.libs << "test"
|
8
|
+
t.libs << "lib"
|
9
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
require "rubocop/rake_task"
|
13
|
+
|
14
|
+
RuboCop::RakeTask.new
|
15
|
+
|
16
|
+
task default: %i[test rubocop]
|
data/bin/console
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "rakuten_product_api"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
load "config.rb" if File.exist? "config.rb"
|
16
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "json"
|
4
|
+
require_relative "rakuten_product_api/version"
|
5
|
+
require_relative "rakuten_product_api/client"
|
6
|
+
require_relative "rakuten_product_api/response"
|
7
|
+
require_relative "rakuten_product_api/item"
|
8
|
+
|
9
|
+
module RakutenProductApi
|
10
|
+
class Error < StandardError; end
|
11
|
+
|
12
|
+
APPLICATION_END_POINT = "https://api.rakutenmarketing.com/productsearch/1.0"
|
13
|
+
|
14
|
+
class << self
|
15
|
+
attr_accessor :sid,
|
16
|
+
:username,
|
17
|
+
:password,
|
18
|
+
:consumer_key,
|
19
|
+
:consumer_secret,
|
20
|
+
:mid,
|
21
|
+
:sort,
|
22
|
+
:sorttype
|
23
|
+
|
24
|
+
def configure
|
25
|
+
yield self
|
26
|
+
true
|
27
|
+
end
|
28
|
+
alias config configure
|
29
|
+
|
30
|
+
def hello
|
31
|
+
puts "Oh Hai"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require "uri"
|
2
|
+
require "net/http"
|
3
|
+
require "net/https"
|
4
|
+
require "base64"
|
5
|
+
require "nokogiri"
|
6
|
+
|
7
|
+
module RakutenProductApi
|
8
|
+
class Client
|
9
|
+
REFRESH_TOKEN_LEEWAY = 60 * 10 # Ten minutes prior to expiry we should refresh token
|
10
|
+
|
11
|
+
attr_accessor :sid, :username, :password, :consumer_key, :consumer_secret, :mid, :auth_expires_at
|
12
|
+
|
13
|
+
def initialize(sid: RakutenProductApi.sid,
|
14
|
+
username: RakutenProductApi.username,
|
15
|
+
password: RakutenProductApi.password,
|
16
|
+
consumer_key: RakutenProductApi.consumer_key,
|
17
|
+
consumer_secret: RakutenProductApi.consumer_secret,
|
18
|
+
mid: RakutenProductApi.mid,
|
19
|
+
sort: RakutenProductApi.sort,
|
20
|
+
sorttype: RakutenProductApi.sorttype)
|
21
|
+
|
22
|
+
@sid = sid
|
23
|
+
@username = username
|
24
|
+
@password = password
|
25
|
+
@consumer_key = consumer_key
|
26
|
+
@consumer_secret = consumer_secret
|
27
|
+
@mid = mid
|
28
|
+
@sort = sort
|
29
|
+
@sorttype = sorttype
|
30
|
+
|
31
|
+
@auth_expires_at = nil
|
32
|
+
end
|
33
|
+
|
34
|
+
def default_params
|
35
|
+
dp = {}
|
36
|
+
dp[:mid] = @mid unless @mid.nil?
|
37
|
+
dp[:sort] = @sort unless @sort.nil?
|
38
|
+
dp[:sorttype] = @sorttype unless @sorttype.nil?
|
39
|
+
dp
|
40
|
+
end
|
41
|
+
|
42
|
+
def request_auth_token
|
43
|
+
Base64.strict_encode64("#{@consumer_key}:#{@consumer_secret}").strip
|
44
|
+
end
|
45
|
+
|
46
|
+
def request_auth_token_header
|
47
|
+
"Authorization: Basic #{request_auth_token}"
|
48
|
+
end
|
49
|
+
|
50
|
+
def api_request_auth
|
51
|
+
res = auth_request(
|
52
|
+
"https://api.rakutenmarketing.com/token",
|
53
|
+
{ grant_type: "password", username: @username, password: @password, scope: @sid }
|
54
|
+
)
|
55
|
+
|
56
|
+
process_auth_response(res)
|
57
|
+
|
58
|
+
@auth_expires_at = Time.now.to_i + @expires_in
|
59
|
+
end
|
60
|
+
|
61
|
+
def refresh_api_request_auth
|
62
|
+
res = auth_request(
|
63
|
+
"https://api.rakutenmarketing.com/token",
|
64
|
+
{ grant_type: "refresh_token", refresh_token: @refresh_token, scope: "Production" }
|
65
|
+
)
|
66
|
+
|
67
|
+
process_auth_response(res)
|
68
|
+
|
69
|
+
@auth_expires_at = Time.now.to_i + @expires_in
|
70
|
+
end
|
71
|
+
|
72
|
+
def process_auth_response(res)
|
73
|
+
if res.code == "200"
|
74
|
+
doc = JSON.parse(res.body)
|
75
|
+
@expires_in = doc["expires_in"].to_i
|
76
|
+
@refresh_token = doc["refresh_token"]
|
77
|
+
@access_token = doc["access_token"]
|
78
|
+
else
|
79
|
+
puts "RESPONSE CODE #{res.code} received"
|
80
|
+
res
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def auth_request(url, payload)
|
85
|
+
uri = URI(url)
|
86
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
87
|
+
req = Net::HTTP::Post.new(uri)
|
88
|
+
req["Authorization"] = "Basic #{request_auth_token}"
|
89
|
+
|
90
|
+
req.set_form_data(payload)
|
91
|
+
http.request(req)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
def ensure_authentication
|
96
|
+
if @auth_expires_at.nil?
|
97
|
+
puts "NIL: getting auth"
|
98
|
+
api_request_auth
|
99
|
+
elsif Time.now.to_i > @auth_expires_at
|
100
|
+
puts "EXPIRED: getting auth"
|
101
|
+
api_request_auth
|
102
|
+
elsif Time.now.to_i > (@auth_expires_at + REFRESH_TOKEN_LEEWAY)
|
103
|
+
puts "REFRESH LEEWAY: getting auth"
|
104
|
+
refresh_api_request_auth
|
105
|
+
else
|
106
|
+
puts "VALID AUTH"
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def search(keyword: nil, **options)
|
111
|
+
Response.new(api_request(options.merge(keyword: keyword)))
|
112
|
+
end
|
113
|
+
|
114
|
+
def api_request(payload)
|
115
|
+
ensure_authentication
|
116
|
+
|
117
|
+
params = default_params.merge(payload).map { |k, v| "#{k}=#{v}" }.join("&")
|
118
|
+
uri = URI("https://api.rakutenmarketing.com/productsearch/1.0?#{params}")
|
119
|
+
|
120
|
+
res = Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
|
121
|
+
req = Net::HTTP::Get.new(uri)
|
122
|
+
req["Authorization"] = "Bearer #{@access_token}"
|
123
|
+
req["Accept"] = "application/xml"
|
124
|
+
|
125
|
+
http.request(req)
|
126
|
+
end
|
127
|
+
|
128
|
+
puts "RESPONSE CODE #{res.code} received" if res.code != "200"
|
129
|
+
|
130
|
+
res
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
require "forwardable"
|
2
|
+
|
3
|
+
module RakutenProductApi
|
4
|
+
class Item
|
5
|
+
extend Forwardable
|
6
|
+
attr_accessor :raw
|
7
|
+
|
8
|
+
def_delegators :@raw, :xpath, :at_xpath
|
9
|
+
|
10
|
+
def initialize(data)
|
11
|
+
@raw = data
|
12
|
+
end
|
13
|
+
|
14
|
+
def title
|
15
|
+
get "productname"
|
16
|
+
end
|
17
|
+
|
18
|
+
def merchant
|
19
|
+
get "merchantname"
|
20
|
+
end
|
21
|
+
|
22
|
+
def price
|
23
|
+
[at_xpath("saleprice")&.text, at_xpath("saleprice/@currency")&.text]
|
24
|
+
end
|
25
|
+
|
26
|
+
def rrp
|
27
|
+
[at_xpath("price")&.text, at_xpath("price/@currency")&.text]
|
28
|
+
end
|
29
|
+
|
30
|
+
def upc
|
31
|
+
get "upccode"
|
32
|
+
end
|
33
|
+
|
34
|
+
def isbn
|
35
|
+
return at_xpath("sku").text[/97[98]\d{10}/] if at_xpath("sku")&.text.match?(/97[98]\d{10}/)
|
36
|
+
return at_xpath("keywords").text[/97[98]\d{10}/] if at_xpath("keywords").text.match?(/97[98]\d{10}/)
|
37
|
+
end
|
38
|
+
|
39
|
+
def link
|
40
|
+
get "linkurl"
|
41
|
+
end
|
42
|
+
|
43
|
+
def image_url
|
44
|
+
get "imageurl"
|
45
|
+
end
|
46
|
+
|
47
|
+
def description_short
|
48
|
+
get "description/short"
|
49
|
+
end
|
50
|
+
|
51
|
+
def description_long
|
52
|
+
get "description/long"
|
53
|
+
end
|
54
|
+
|
55
|
+
def keywords
|
56
|
+
get("keywords")&.split("~~")
|
57
|
+
end
|
58
|
+
|
59
|
+
def used?
|
60
|
+
description.match?(/used/i)
|
61
|
+
end
|
62
|
+
|
63
|
+
def new?
|
64
|
+
!used?
|
65
|
+
end
|
66
|
+
|
67
|
+
def get(path)
|
68
|
+
return nil if path.nil? || path.empty?
|
69
|
+
|
70
|
+
@raw.at_xpath(path)&.text
|
71
|
+
end
|
72
|
+
|
73
|
+
def result_count
|
74
|
+
@raw.at_xpath("result/item").count
|
75
|
+
end
|
76
|
+
|
77
|
+
%w[mid merchantname linkid createdon sku productname imageurl linkurl upccode].each do |x|
|
78
|
+
define_method(x) do
|
79
|
+
return get(x)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require "nokogiri"
|
2
|
+
|
3
|
+
module RakutenProductApi
|
4
|
+
class Response
|
5
|
+
attr_reader :http_response, :raw, :datas, :doc, :items
|
6
|
+
|
7
|
+
def initialize(response)
|
8
|
+
@http_response = response
|
9
|
+
@raw = Nokogiri::XML(response.body)
|
10
|
+
|
11
|
+
@items = @raw.xpath("result/item").map { |d| Item.new(d) }
|
12
|
+
end
|
13
|
+
|
14
|
+
def body
|
15
|
+
@raw.to_s
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/rakuten_product_api/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "rakuten_product_api"
|
7
|
+
spec.version = RakutenProductApi::VERSION
|
8
|
+
spec.authors = ["Dan Milne"]
|
9
|
+
spec.email = ["d@nmilne.com"]
|
10
|
+
|
11
|
+
spec.summary = "Client for Rakutenmarketing.com."
|
12
|
+
spec.homepage = "https://github.com/dkam/rakuten_product_api"
|
13
|
+
spec.license = "MIT"
|
14
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
15
|
+
|
16
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
17
|
+
|
18
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
19
|
+
spec.metadata["source_code_uri"] = "https://github.com/dkam/rakuten_product_api"
|
20
|
+
spec.metadata["changelog_uri"] = "https://github.com/dkam/rakuten_product_api/blob/main/CHANGELOG.md"
|
21
|
+
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
24
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
26
|
+
end
|
27
|
+
spec.bindir = "exe"
|
28
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ["lib"]
|
30
|
+
|
31
|
+
# Uncomment to register a new dependency of your gem
|
32
|
+
spec.add_dependency "nokogiri", "~> 1"
|
33
|
+
|
34
|
+
spec.add_development_dependency 'byebug', '~> 11'
|
35
|
+
|
36
|
+
# For more information and examples about making a new gem, checkout our
|
37
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rakuten_product_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dan Milne
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-02-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: nokogiri
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: byebug
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '11'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '11'
|
41
|
+
description:
|
42
|
+
email:
|
43
|
+
- d@nmilne.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- ".gitignore"
|
49
|
+
- ".rubocop.yml"
|
50
|
+
- CHANGELOG.md
|
51
|
+
- Gemfile
|
52
|
+
- Gemfile.lock
|
53
|
+
- LICENSE.txt
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- bin/console
|
57
|
+
- bin/setup
|
58
|
+
- lib/rakuten_product_api.rb
|
59
|
+
- lib/rakuten_product_api/client.rb
|
60
|
+
- lib/rakuten_product_api/item.rb
|
61
|
+
- lib/rakuten_product_api/response.rb
|
62
|
+
- lib/rakuten_product_api/version.rb
|
63
|
+
- rakuten_product_api.gemspec
|
64
|
+
homepage: https://github.com/dkam/rakuten_product_api
|
65
|
+
licenses:
|
66
|
+
- MIT
|
67
|
+
metadata:
|
68
|
+
homepage_uri: https://github.com/dkam/rakuten_product_api
|
69
|
+
source_code_uri: https://github.com/dkam/rakuten_product_api
|
70
|
+
changelog_uri: https://github.com/dkam/rakuten_product_api/blob/main/CHANGELOG.md
|
71
|
+
post_install_message:
|
72
|
+
rdoc_options: []
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: 2.4.0
|
80
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ">="
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
85
|
+
requirements: []
|
86
|
+
rubygems_version: 3.1.4
|
87
|
+
signing_key:
|
88
|
+
specification_version: 4
|
89
|
+
summary: Client for Rakutenmarketing.com.
|
90
|
+
test_files: []
|