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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8707dbd623e5b790dfe141c96ddc0a8852bd4ad044301d2fa8df6ea65d5edecc
4
- data.tar.gz: 380acf78eb52468fb00a16cc0eb05b1b5b7f4ad3698c19aae412e5f2eb8e164e
3
+ metadata.gz: cac8eac181af5b251e56003ba42aacd6e7f8ca376f48178325c0f4349f28a788
4
+ data.tar.gz: c51990906c2d06401afe3a2733433a4e84b7715f3b19c330916f42ef64cb2218
5
5
  SHA512:
6
- metadata.gz: 3efda7a35bfb3156ee3ca2649333480003087819260ec1b13d323a5a6f787d93361e1720ce4347dc9543fc506694f5d1ecb5824d04011322ebbebe8ecc578eb7
7
- data.tar.gz: e9769020016433d8433fd8a3a8989abef9feb05760c9f0696c06ec5057ae5beeb073f48b632edb510ba7691e86cc3f4f5e363193c48ce157d3318e4943894503
6
+ metadata.gz: f72eb6b6da6b24702f0916776944d4a51977ae11e95ceafade99f9f4a05cb446d3ec4277fad045b0e60374874f06470a26c750edef707d560f7e49d9a14f41fb
7
+ data.tar.gz: 8d30545f71f13374dcde47fe733815baf9324371418f245550b02be3ec9c883a0c1379de899ab679627b2b0525f42f8aa802e447f7481ffe6724f1ec6736e331
@@ -10,6 +10,12 @@ module WOTC
10
10
  rescue => e
11
11
  return false
12
12
  end
13
+
14
+ # Pre-qualify an application of WOTC status
15
+ def wotc_calculator(options={})
16
+ result = post('wotc/calculator', options)
17
+ result.body == true
18
+ end
13
19
  end
14
20
  end
15
21
  end
@@ -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 any connection options
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
@@ -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"] + "&per_page=#{per_page}")
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.encode(path), options)
54
+ request.url(Addressable::URI.escape(path), options)
55
55
  when :post, :put
56
- request.path = URI.encode(path)
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
@@ -1,3 +1,3 @@
1
1
  module WOTC
2
- VERSION = "0.1.5"
2
+ VERSION = '0.1.10'
3
3
  end
data/wotc.gemspec CHANGED
@@ -42,4 +42,5 @@ Gem::Specification.new do |spec|
42
42
  spec.add_development_dependency "webmock"
43
43
  spec.add_runtime_dependency 'faraday'
44
44
  spec.add_runtime_dependency 'faraday_middleware'
45
+ spec.add_runtime_dependency 'addressable'
45
46
  end
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.5
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: 2020-05-14 00:00:00.000000000 Z
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.0.6
186
+ rubygems_version: 3.1.6
173
187
  signing_key:
174
188
  specification_version: 4
175
189
  summary: Ruby wrapper for wotc.com APIs