whiplash-app 0.10.0 → 0.10.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/.github/workflows/ci.yml +1 -1
- data/lib/whiplash/app/controller_helpers.rb +1 -1
- data/lib/whiplash/app/version.rb +1 -1
- data/lib/whiplash/app.rb +19 -1
- data/whiplash-app.gemspec +1 -0
- metadata +20 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: adc068051a8e2ecbb9ae56496bda52be1e358e668189b9cfe27ccda7d9712229
|
|
4
|
+
data.tar.gz: 9de47bfcf86b123b1b02fce2c629352cc19eacc77658b870da838f3babb9afe5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 593790e085faa0b104658e23204c3ced561c5a497cadab695e737b3eff7e194e8d5a636c3f4d0048b8ba15e2ff41a3d0d88b8671216a7ffabcc3bc522006af83
|
|
7
|
+
data.tar.gz: 9b9852b80909ce8d8a561f5167472792e0f25e9bb3c7a7b7d7e583a6a3f50b7670acd0087943a6dc03b9eb908d0fa2bfbfd4a27f323aa4349574911dc57a8599
|
data/.github/workflows/ci.yml
CHANGED
data/lib/whiplash/app/version.rb
CHANGED
data/lib/whiplash/app.rb
CHANGED
|
@@ -6,6 +6,7 @@ require "whiplash/app/version"
|
|
|
6
6
|
require "errors/whiplash_api_error"
|
|
7
7
|
require "oauth2"
|
|
8
8
|
require "faraday"
|
|
9
|
+
require "faraday/retry"
|
|
9
10
|
require 'faraday/net_http_persistent'
|
|
10
11
|
|
|
11
12
|
# Rails app stuff
|
|
@@ -22,13 +23,14 @@ module Whiplash
|
|
|
22
23
|
include Whiplash::App::Connections
|
|
23
24
|
include Whiplash::App::FinderMethods
|
|
24
25
|
|
|
25
|
-
attr_accessor :customer_id, :shop_id, :token
|
|
26
|
+
attr_accessor :customer_id, :shop_id, :token, :retry_errors
|
|
26
27
|
|
|
27
28
|
def initialize(token, options={})
|
|
28
29
|
@token = format_token(token)
|
|
29
30
|
@customer_id = options[:customer_id]
|
|
30
31
|
@shop_id = options[:shop_id]
|
|
31
32
|
@api_version = options[:api_version] || 2 # can be 2_1
|
|
33
|
+
@retry_errors = options.fetch(:retry_errors, false)
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def versioned_api_url
|
|
@@ -44,6 +46,22 @@ module Whiplash
|
|
|
44
46
|
# Authentication
|
|
45
47
|
conn.request :authorization, 'Bearer', token.token
|
|
46
48
|
conn.request :json
|
|
49
|
+
|
|
50
|
+
if @retry_errors
|
|
51
|
+
conn.request :retry, max: 5,
|
|
52
|
+
interval: 1,
|
|
53
|
+
interval_randomness: 0.5,
|
|
54
|
+
backoff_factor: 2,
|
|
55
|
+
methods: [:get, :post, :put, :delete],
|
|
56
|
+
exceptions: [
|
|
57
|
+
'Faraday::TimeoutError',
|
|
58
|
+
'Faraday::ConnectionFailed',
|
|
59
|
+
'Errno::ETIMEDOUT',
|
|
60
|
+
'Timeout::Error'
|
|
61
|
+
],
|
|
62
|
+
retry_statuses: [502, 504]
|
|
63
|
+
end
|
|
64
|
+
|
|
47
65
|
conn.response :json, :content_type => /\bjson$/
|
|
48
66
|
conn.options.timeout = 30 # Total request timeout
|
|
49
67
|
conn.options.open_timeout = 5 # Connection establishment timeout
|
data/whiplash-app.gemspec
CHANGED
|
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.add_dependency "oauth2", "~> 2.0.4"
|
|
22
22
|
spec.add_dependency "faraday", "~> 2.7"
|
|
23
23
|
spec.add_dependency 'faraday-net_http_persistent'
|
|
24
|
+
spec.add_dependency "faraday-retry"
|
|
24
25
|
|
|
25
26
|
spec.add_development_dependency "bundler", ">= 2.2"
|
|
26
27
|
spec.add_development_dependency "rake", ">= 12.3.3"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: whiplash-app
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Don Sullivan, Mark Dickson
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-07-06 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: oauth2
|
|
@@ -52,6 +52,20 @@ dependencies:
|
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
54
|
version: '0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: faraday-retry
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '0'
|
|
62
|
+
type: :runtime
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - ">="
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '0'
|
|
55
69
|
- !ruby/object:Gem::Dependency
|
|
56
70
|
name: bundler
|
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -140,7 +154,7 @@ files:
|
|
|
140
154
|
homepage: https://github.com/whiplashmerch/whiplash-app
|
|
141
155
|
licenses: []
|
|
142
156
|
metadata: {}
|
|
143
|
-
post_install_message:
|
|
157
|
+
post_install_message:
|
|
144
158
|
rdoc_options: []
|
|
145
159
|
require_paths:
|
|
146
160
|
- lib
|
|
@@ -155,8 +169,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
155
169
|
- !ruby/object:Gem::Version
|
|
156
170
|
version: '0'
|
|
157
171
|
requirements: []
|
|
158
|
-
rubygems_version: 3.
|
|
159
|
-
signing_key:
|
|
172
|
+
rubygems_version: 3.4.6
|
|
173
|
+
signing_key:
|
|
160
174
|
specification_version: 4
|
|
161
175
|
summary: this gem provides connectivity to the Whiplash API for authentication and
|
|
162
176
|
REST requests.
|