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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 75b9cbdd2339703bb57bc2d4eed267caacb9f8102153265ac00252d63a2fc7ea
4
- data.tar.gz: f07396647cca6325ed7e87a72c1303f20f448b72380a263625527842fc4fdc94
3
+ metadata.gz: cd2278a94ed1bb74b4be67047ab52c68a476da0e4255b1fe9bf36c75b636784f
4
+ data.tar.gz: 17d2022c5b6bee56c231c562ed82858859545b0ab816db37183a2f57cc297f2c
5
5
  SHA512:
6
- metadata.gz: cdb8b95db0a4e09db5e89fb403aee90ab5a4038aec7ffed5da60ba967d9009f1bfaec25096317d5968d83bb2f8ba1aceb9bd0643d130827bff2bb06948552a99
7
- data.tar.gz: 75c2e83b5990933636a2f22dde9d246f9cee997095a28723d94bbe60fc8b1e62d97f2e8d10fea563256f3e44bfa10de792dd1987b52c4220cf7ca0f442e2c4f2
6
+ metadata.gz: 21a9e1ba985fe68b41350d535c494020e7c0191e19af8fbab0ae38ede48a67f8381cfb1e2ea0e1b7efcb2d5a84ec7623bf38775d8ad53bd6c27e5157e333da18
7
+ data.tar.gz: 1e1d5b663beaca770ae67a3cf18cb5935d20366b6494361a265d39860ed0ade60f0d7da2d1e82b5702427f046aa9b708ca6b19d86bda1654deca9bba6428d1a3
data/.gitignore CHANGED
@@ -6,3 +6,6 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ /.byebug_history
10
+ /config.rb
11
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,16 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rakuten_product_api (0.5.0)
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
- minitest (5.15.0)
13
- nokogiri (1.13.6-arm64-darwin)
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-21
39
- x86_64-darwin-20
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
- 2.3.10
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', access_expires_at: 1613362973)
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
- if res.code == "200"
54
- doc = JSON.parse(res.body)
55
- @expires_in = doc["expires_in"]&.to_i
56
- @refresh_token = doc["refresh_token"]
57
- @access_token = doc["access_token"]
58
- else
59
- puts "RESPONSE CODE #{res.code} received"
60
- res
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, :access_expires_at
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RakutenProductApi
4
- VERSION = "0.5.0"
4
+ VERSION = "0.5.2"
5
5
  end
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.0
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: 2022-06-09 00:00:00.000000000 Z
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: 3.3.7
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: []