wotc 0.1.5 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wotc/client/utils.rb +6 -0
- data/lib/wotc/configuration.rb +11 -1
- data/lib/wotc/connection.rb +3 -0
- data/lib/wotc/request.rb +7 -7
- data/lib/wotc/version.rb +1 -1
- data/wotc.gemspec +1 -0
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cac8eac181af5b251e56003ba42aacd6e7f8ca376f48178325c0f4349f28a788
|
4
|
+
data.tar.gz: c51990906c2d06401afe3a2733433a4e84b7715f3b19c330916f42ef64cb2218
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f72eb6b6da6b24702f0916776944d4a51977ae11e95ceafade99f9f4a05cb446d3ec4277fad045b0e60374874f06470a26c750edef707d560f7e49d9a14f41fb
|
7
|
+
data.tar.gz: 8d30545f71f13374dcde47fe733815baf9324371418f245550b02be3ec9c883a0c1379de899ab679627b2b0525f42f8aa802e447f7481ffe6724f1ec6736e331
|
data/lib/wotc/client/utils.rb
CHANGED
data/lib/wotc/configuration.rb
CHANGED
@@ -16,6 +16,8 @@ module WOTC
|
|
16
16
|
:user_agent,
|
17
17
|
:auto_paginate,
|
18
18
|
:per_page,
|
19
|
+
:timeout,
|
20
|
+
:open_timeout,
|
19
21
|
].freeze
|
20
22
|
|
21
23
|
# By default, don't set an access token
|
@@ -32,9 +34,15 @@ module WOTC
|
|
32
34
|
# @note The default faraday adapter is Net::HTTP.
|
33
35
|
DEFAULT_ADAPTER = Faraday.default_adapter
|
34
36
|
|
35
|
-
# By default, don't set
|
37
|
+
# By default, don't set connection options.
|
36
38
|
DEFAULT_CONNECTION_OPTIONS = {}
|
37
39
|
|
40
|
+
# Default timeout time is 20 seconds
|
41
|
+
DEFAULT_TIMEOUT = 20
|
42
|
+
|
43
|
+
# By default, the open timeout is 20 seconds.
|
44
|
+
DEFAULT_OPEN_TIMEOUT = 20
|
45
|
+
|
38
46
|
# By default, use sandbox environment
|
39
47
|
DEFAULT_HOST = 'https://sandbox.wotc.com'.freeze
|
40
48
|
|
@@ -87,6 +95,8 @@ module WOTC
|
|
87
95
|
self.user_agent = DEFAULT_USER_AGENT
|
88
96
|
self.auto_paginate = DEFAULT_AUTO_PAGINATE
|
89
97
|
self.per_page = DEFAULT_PER_PAGE
|
98
|
+
self.timeout = DEFAULT_TIMEOUT
|
99
|
+
self.open_timeout = DEFAULT_OPEN_TIMEOUT
|
90
100
|
end
|
91
101
|
end
|
92
102
|
end
|
data/lib/wotc/connection.rb
CHANGED
@@ -18,6 +18,9 @@ module WOTC
|
|
18
18
|
|
19
19
|
Faraday::Connection.new(options) do |conn|
|
20
20
|
conn.authorization :Bearer, access_token
|
21
|
+
# https://github.com/lostisland/faraday/issues/417#issuecomment-223413386
|
22
|
+
conn.options[:timeout] = timeout
|
23
|
+
conn.options[:open_timeout] = open_timeout
|
21
24
|
conn.request :json
|
22
25
|
|
23
26
|
conn.use FaradayMiddleWare::RaiseHttpException
|
data/lib/wotc/request.rb
CHANGED
@@ -38,10 +38,10 @@ module WOTC
|
|
38
38
|
|
39
39
|
# return all results when enabled auto paginate
|
40
40
|
last_response = response.dup
|
41
|
-
data = response["data"]
|
42
|
-
while last_response["next_page_url"]
|
43
|
-
last_response = get(last_response["next_page_url"]
|
44
|
-
data.concat(last_response["data"]) if last_response["data"].is_a?(Array)
|
41
|
+
data = response.body["data"]
|
42
|
+
while last_response.body["next_page_url"]
|
43
|
+
last_response = get(last_response.body["next_page_url"])
|
44
|
+
data.concat(last_response.body["data"]) if last_response.body["data"].is_a?(Array)
|
45
45
|
end
|
46
46
|
|
47
47
|
return data
|
@@ -51,9 +51,9 @@ module WOTC
|
|
51
51
|
response = connection.send(method) do |request|
|
52
52
|
case method
|
53
53
|
when :get, :delete
|
54
|
-
request.url(URI.
|
54
|
+
request.url(Addressable::URI.escape(path), options)
|
55
55
|
when :post, :put
|
56
|
-
request.path = URI.
|
56
|
+
request.path = Addressable::URI.escape(path)
|
57
57
|
request.body = options
|
58
58
|
end
|
59
59
|
end
|
@@ -61,4 +61,4 @@ module WOTC
|
|
61
61
|
response
|
62
62
|
end
|
63
63
|
end
|
64
|
-
end
|
64
|
+
end
|
data/lib/wotc/version.rb
CHANGED
data/wotc.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wotc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- workstream.us
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -108,6 +108,20 @@ dependencies:
|
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: addressable
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
111
125
|
description: An Ruby wrapper for wotc.com REST APIs
|
112
126
|
email:
|
113
127
|
- ryan@workstream.is
|
@@ -169,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
183
|
- !ruby/object:Gem::Version
|
170
184
|
version: '0'
|
171
185
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
186
|
+
rubygems_version: 3.1.6
|
173
187
|
signing_key:
|
174
188
|
specification_version: 4
|
175
189
|
summary: Ruby wrapper for wotc.com APIs
|