rakuten_product_api 0.5.0 → 0.5.2
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 +4 -4
- data/.gitignore +3 -0
- data/Gemfile.lock +9 -7
- data/README.md +1 -1
- data/lib/rakuten_product_api/authenticate.rb +8 -9
- data/lib/rakuten_product_api/client.rb +1 -1
- data/lib/rakuten_product_api/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd2278a94ed1bb74b4be67047ab52c68a476da0e4255b1fe9bf36c75b636784f
|
|
4
|
+
data.tar.gz: 17d2022c5b6bee56c231c562ed82858859545b0ab816db37183a2f57cc297f2c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 21a9e1ba985fe68b41350d535c494020e7c0191e19af8fbab0ae38ede48a67f8381cfb1e2ea0e1b7efcb2d5a84ec7623bf38775d8ad53bd6c27e5157e333da18
|
|
7
|
+
data.tar.gz: 1e1d5b663beaca770ae67a3cf18cb5935d20366b6494361a265d39860ed0ade60f0d7da2d1e82b5702427f046aa9b708ca6b19d86bda1654deca9bba6428d1a3
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
rakuten_product_api (0.5.
|
|
5
|
-
nokogiri (>= 1.13.6)
|
|
4
|
+
rakuten_product_api (0.5.2)
|
|
5
|
+
nokogiri (~> 1.13, >= 1.13.6)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
10
|
ast (2.4.2)
|
|
11
11
|
byebug (11.1.3)
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
mini_portile2 (2.8.1)
|
|
13
|
+
minitest (5.27.0)
|
|
14
|
+
nokogiri (1.13.8)
|
|
15
|
+
mini_portile2 (~> 2.8.0)
|
|
14
16
|
racc (~> 1.4)
|
|
15
17
|
parallel (1.22.1)
|
|
16
18
|
parser (3.1.2.0)
|
|
@@ -35,8 +37,8 @@ GEM
|
|
|
35
37
|
unicode-display_width (2.1.0)
|
|
36
38
|
|
|
37
39
|
PLATFORMS
|
|
38
|
-
arm64-darwin
|
|
39
|
-
x86_64-darwin
|
|
40
|
+
arm64-darwin
|
|
41
|
+
x86_64-darwin
|
|
40
42
|
x86_64-linux
|
|
41
43
|
|
|
42
44
|
DEPENDENCIES
|
|
@@ -47,4 +49,4 @@ DEPENDENCIES
|
|
|
47
49
|
rubocop (~> 1.7)
|
|
48
50
|
|
|
49
51
|
BUNDLED WITH
|
|
50
|
-
|
|
52
|
+
4.0.8
|
data/README.md
CHANGED
|
@@ -56,7 +56,7 @@ This library needs to query the API to retreive an `access_token` which has an `
|
|
|
56
56
|
You can initialise the library with the `access_token` and `access_token_expires_at` values to avoid this lookup. If the `access_token_expires_at` is nil or in the past, the library will fetch the value so you can safely cache this value and use it without checking it's expiry.
|
|
57
57
|
|
|
58
58
|
```ruby
|
|
59
|
-
client = RakutenProductApi::Client.new(access_token: 'abcd1234',
|
|
59
|
+
client = RakutenProductApi::Client.new(access_token: 'abcd1234', access_token_expires_at: 1613362973)
|
|
60
60
|
|
|
61
61
|
client.endpoint
|
|
62
62
|
=> "https://api.linksynergy.com"
|
|
@@ -50,15 +50,14 @@ module RakutenProductApi
|
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
def process_auth_response(res)
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
end
|
|
53
|
+
raise RakutenProductApi::Error, "Rakuten auth returned HTTP #{res.code} #{res.message}" unless res.code == "200"
|
|
54
|
+
|
|
55
|
+
doc = JSON.parse(res.body)
|
|
56
|
+
@expires_in = doc["expires_in"]&.to_i
|
|
57
|
+
@refresh_token = doc["refresh_token"]
|
|
58
|
+
@access_token = doc["access_token"]
|
|
59
|
+
|
|
60
|
+
raise RakutenProductApi::Error, "Rakuten auth response missing expires_in" if @expires_in.nil?
|
|
62
61
|
end
|
|
63
62
|
|
|
64
63
|
def auth_request(payload)
|
|
@@ -7,7 +7,7 @@ require "nokogiri"
|
|
|
7
7
|
module RakutenProductApi
|
|
8
8
|
class Client
|
|
9
9
|
extend Forwardable
|
|
10
|
-
def_delegators :@authenticate, :access_token, :
|
|
10
|
+
def_delegators :@authenticate, :access_token, :access_token_expires_at
|
|
11
11
|
REFRESH_TOKEN_LEEWAY = 60 * 10 # Ten minutes prior to expiry we should refresh token
|
|
12
12
|
|
|
13
13
|
attr_accessor :sid, :username, :password, :authenticate
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rakuten_product_api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dan Milne
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: nokogiri
|
|
@@ -44,7 +43,6 @@ dependencies:
|
|
|
44
43
|
- - "~>"
|
|
45
44
|
- !ruby/object:Gem::Version
|
|
46
45
|
version: '11'
|
|
47
|
-
description:
|
|
48
46
|
email:
|
|
49
47
|
- d@nmilne.com
|
|
50
48
|
executables: []
|
|
@@ -75,7 +73,6 @@ metadata:
|
|
|
75
73
|
homepage_uri: https://github.com/dkam/rakuten_product_api
|
|
76
74
|
source_code_uri: https://github.com/dkam/rakuten_product_api
|
|
77
75
|
changelog_uri: https://github.com/dkam/rakuten_product_api/blob/main/CHANGELOG.md
|
|
78
|
-
post_install_message:
|
|
79
76
|
rdoc_options: []
|
|
80
77
|
require_paths:
|
|
81
78
|
- lib
|
|
@@ -90,8 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
90
87
|
- !ruby/object:Gem::Version
|
|
91
88
|
version: '0'
|
|
92
89
|
requirements: []
|
|
93
|
-
rubygems_version:
|
|
94
|
-
signing_key:
|
|
90
|
+
rubygems_version: 4.0.3
|
|
95
91
|
specification_version: 4
|
|
96
92
|
summary: Client for Rakutenmarketing.com.
|
|
97
93
|
test_files: []
|