json_api_toolbox 2.0.1 → 2.1.0
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/.version +1 -1
- data/CHANGELOG.md +4 -0
- data/Dockerfile +1 -1
- data/Gemfile.lock +25 -25
- data/lib/json_api_toolbox/version.rb +1 -1
- data/lib/service.rb +15 -11
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 57d15d5fd3e2fd4747a2606e83d3f38f8a1991dac1ce62bfa9dd9ccc45e27f94
|
|
4
|
+
data.tar.gz: ecbb101680a6767f7d83238a6e0500ef67ac4addbebc6500c9881172678b7d1e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 76bee9fcd248fd05746574fbcc763bfe83150c4822574ea3238c068613c712a09eb11c8d46426e2b8f4f43a5475642aedc6a2f2ea893108a954a4bddf1b63f14
|
|
7
|
+
data.tar.gz: 365556a551fb49c8050a78c106df2d7c5e1d02eee6e9c289f8ea0abe3f16c150902505a67be7ebfe86a3d7d942b7dc7922e7e8418d3c63fcc3757ac5055fdf18
|
data/.version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0
|
|
1
|
+
2.1.0
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [2.1.0] - 2022-11-09
|
|
10
|
+
### Changed
|
|
11
|
+
- Permite seja via parametro, seja via ENV alterar o timeout do RestClient
|
|
12
|
+
|
|
9
13
|
## [2.0.1] - 2021-08-13
|
|
10
14
|
### Fixed
|
|
11
15
|
- Fixed a constant loading problem on rails
|
data/Dockerfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
json_api_toolbox (2.0
|
|
4
|
+
json_api_toolbox (2.1.0)
|
|
5
5
|
activerecord (>= 5.1.0)
|
|
6
6
|
activesupport (>= 5.1.0)
|
|
7
7
|
json-api-vanilla
|
|
@@ -82,15 +82,15 @@ GEM
|
|
|
82
82
|
diff-lcs (1.4.4)
|
|
83
83
|
domain_name (0.5.20190701)
|
|
84
84
|
unf (>= 0.0.5, < 1.0.0)
|
|
85
|
-
erubi (1.
|
|
86
|
-
globalid (0.
|
|
85
|
+
erubi (1.11.0)
|
|
86
|
+
globalid (1.0.0)
|
|
87
87
|
activesupport (>= 5.0)
|
|
88
88
|
http-accept (1.7.0)
|
|
89
|
-
http-cookie (1.0.
|
|
89
|
+
http-cookie (1.0.5)
|
|
90
90
|
domain_name (~> 0.5)
|
|
91
91
|
i18n (1.8.10)
|
|
92
92
|
concurrent-ruby (~> 1.0)
|
|
93
|
-
json-api-vanilla (1.0.
|
|
93
|
+
json-api-vanilla (1.0.4)
|
|
94
94
|
jsonapi-renderer (0.2.2)
|
|
95
95
|
jsonapi-serializable (0.3.1)
|
|
96
96
|
jsonapi-renderer (~> 0.2.0)
|
|
@@ -99,7 +99,7 @@ GEM
|
|
|
99
99
|
logstash-event (>= 1.2.02)
|
|
100
100
|
logstash-logger (>= 0.26.1)
|
|
101
101
|
rails (>= 5.0)
|
|
102
|
-
lograge (0.
|
|
102
|
+
lograge (0.12.0)
|
|
103
103
|
actionpack (>= 4)
|
|
104
104
|
activesupport (>= 4)
|
|
105
105
|
railties (>= 4)
|
|
@@ -107,23 +107,23 @@ GEM
|
|
|
107
107
|
logstash-event (1.2.02)
|
|
108
108
|
logstash-logger (0.26.1)
|
|
109
109
|
logstash-event (~> 1.2)
|
|
110
|
-
loofah (2.
|
|
110
|
+
loofah (2.19.0)
|
|
111
111
|
crass (~> 1.0.2)
|
|
112
112
|
nokogiri (>= 1.5.9)
|
|
113
113
|
mail (2.7.1)
|
|
114
114
|
mini_mime (>= 0.1.1)
|
|
115
|
-
marcel (1.0.
|
|
115
|
+
marcel (1.0.2)
|
|
116
116
|
method_source (1.0.0)
|
|
117
|
-
mime-types (3.
|
|
117
|
+
mime-types (3.4.1)
|
|
118
118
|
mime-types-data (~> 3.2015)
|
|
119
|
-
mime-types-data (3.
|
|
120
|
-
mini_mime (1.1.
|
|
119
|
+
mime-types-data (3.2022.0105)
|
|
120
|
+
mini_mime (1.1.2)
|
|
121
121
|
minitest (5.14.4)
|
|
122
122
|
netrc (0.11.0)
|
|
123
123
|
nio4r (2.5.8)
|
|
124
|
-
nokogiri (1.
|
|
124
|
+
nokogiri (1.13.9-x86_64-darwin)
|
|
125
125
|
racc (~> 1.4)
|
|
126
|
-
nokogiri (1.
|
|
126
|
+
nokogiri (1.13.9-x86_64-linux)
|
|
127
127
|
racc (~> 1.4)
|
|
128
128
|
parallel (1.20.1)
|
|
129
129
|
parser (3.0.2.0)
|
|
@@ -134,10 +134,10 @@ GEM
|
|
|
134
134
|
pry-byebug (3.9.0)
|
|
135
135
|
byebug (~> 11.0)
|
|
136
136
|
pry (~> 0.13.0)
|
|
137
|
-
racc (1.
|
|
138
|
-
rack (2.2.
|
|
139
|
-
rack-test (
|
|
140
|
-
rack (>= 1.
|
|
137
|
+
racc (1.6.0)
|
|
138
|
+
rack (2.2.4)
|
|
139
|
+
rack-test (2.0.2)
|
|
140
|
+
rack (>= 1.3)
|
|
141
141
|
rails (6.1.4)
|
|
142
142
|
actioncable (= 6.1.4)
|
|
143
143
|
actionmailbox (= 6.1.4)
|
|
@@ -156,7 +156,7 @@ GEM
|
|
|
156
156
|
rails-dom-testing (2.0.3)
|
|
157
157
|
activesupport (>= 4.2.0)
|
|
158
158
|
nokogiri (>= 1.6)
|
|
159
|
-
rails-html-sanitizer (1.3
|
|
159
|
+
rails-html-sanitizer (1.4.3)
|
|
160
160
|
loofah (~> 2.3)
|
|
161
161
|
railties (6.1.4)
|
|
162
162
|
actionpack (= 6.1.4)
|
|
@@ -167,7 +167,7 @@ GEM
|
|
|
167
167
|
rainbow (3.0.0)
|
|
168
168
|
rake (13.0.6)
|
|
169
169
|
regexp_parser (2.1.1)
|
|
170
|
-
request_store (1.5.
|
|
170
|
+
request_store (1.5.1)
|
|
171
171
|
rack (>= 1.4)
|
|
172
172
|
rest-client (2.1.0)
|
|
173
173
|
http-accept (>= 1.7.0, < 2.0)
|
|
@@ -202,19 +202,19 @@ GEM
|
|
|
202
202
|
ruby-progressbar (1.11.0)
|
|
203
203
|
shoulda-matchers (5.0.0)
|
|
204
204
|
activesupport (>= 5.2.0)
|
|
205
|
-
sprockets (4.
|
|
205
|
+
sprockets (4.1.1)
|
|
206
206
|
concurrent-ruby (~> 1.0)
|
|
207
207
|
rack (> 1, < 3)
|
|
208
|
-
sprockets-rails (3.
|
|
209
|
-
actionpack (>=
|
|
210
|
-
activesupport (>=
|
|
208
|
+
sprockets-rails (3.4.2)
|
|
209
|
+
actionpack (>= 5.2)
|
|
210
|
+
activesupport (>= 5.2)
|
|
211
211
|
sprockets (>= 3.0.0)
|
|
212
|
-
thor (1.1
|
|
212
|
+
thor (1.2.1)
|
|
213
213
|
tzinfo (2.0.4)
|
|
214
214
|
concurrent-ruby (~> 1.0)
|
|
215
215
|
unf (0.1.4)
|
|
216
216
|
unf_ext
|
|
217
|
-
unf_ext (0.0.
|
|
217
|
+
unf_ext (0.0.8.2)
|
|
218
218
|
unicode-display_width (2.0.0)
|
|
219
219
|
websocket-driver (0.7.5)
|
|
220
220
|
websocket-extensions (>= 0.1.0)
|
data/lib/service.rb
CHANGED
|
@@ -6,12 +6,15 @@ require 'json-api-vanilla'
|
|
|
6
6
|
|
|
7
7
|
module JsonApiToolbox
|
|
8
8
|
class Service
|
|
9
|
-
attr_reader :http_method, :url, :body, :extra_headers
|
|
9
|
+
attr_reader :http_method, :url, :body, :extra_headers, :timeout
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
DEFAULT_TIMEOUT = ENV.fetch('JSON_API_TOOLBOX_TIMEOUT', 60).to_i
|
|
12
|
+
|
|
13
|
+
def initialize(http_method, url, body, timeout, extra_headers = {})
|
|
12
14
|
@http_method = http_method
|
|
13
15
|
@url = url
|
|
14
16
|
@body = body
|
|
17
|
+
@timeout = timeout
|
|
15
18
|
@extra_headers = extra_headers
|
|
16
19
|
end
|
|
17
20
|
|
|
@@ -24,7 +27,8 @@ module JsonApiToolbox
|
|
|
24
27
|
method: http_method,
|
|
25
28
|
url: url,
|
|
26
29
|
payload: build_body,
|
|
27
|
-
headers: build_header
|
|
30
|
+
headers: build_header,
|
|
31
|
+
timeout: timeout
|
|
28
32
|
)
|
|
29
33
|
end
|
|
30
34
|
|
|
@@ -44,21 +48,21 @@ module JsonApiToolbox
|
|
|
44
48
|
end
|
|
45
49
|
|
|
46
50
|
class << self
|
|
47
|
-
def get(url: nil, includes: nil, query_string: nil, headers: {})
|
|
51
|
+
def get(url: nil, includes: nil, query_string: nil, timeout: DEFAULT_TIMEOUT, headers: {})
|
|
48
52
|
body = build_query_string(includes, query_string)
|
|
49
|
-
new(:get, url, body, headers).execute
|
|
53
|
+
new(:get, url, body, timeout, headers).execute
|
|
50
54
|
end
|
|
51
55
|
|
|
52
|
-
def post(url: nil, body: nil, headers: {})
|
|
53
|
-
new(:post, url, body, headers).execute
|
|
56
|
+
def post(url: nil, body: nil, timeout: DEFAULT_TIMEOUT, headers: {})
|
|
57
|
+
new(:post, url, body, timeout, headers).execute
|
|
54
58
|
end
|
|
55
59
|
|
|
56
|
-
def patch(url: nil, body: nil, headers: {})
|
|
57
|
-
new(:patch, url, body, headers).execute
|
|
60
|
+
def patch(url: nil, body: nil, timeout: DEFAULT_TIMEOUT, headers: {})
|
|
61
|
+
new(:patch, url, body, timeout, headers).execute
|
|
58
62
|
end
|
|
59
63
|
|
|
60
|
-
def put(url: nil, body: nil, headers: {})
|
|
61
|
-
new(:put, url, body, headers).execute
|
|
64
|
+
def put(url: nil, body: nil, timeout: DEFAULT_TIMEOUT, headers: {})
|
|
65
|
+
new(:put, url, body, timeout, headers).execute
|
|
62
66
|
end
|
|
63
67
|
|
|
64
68
|
def parse_response(response)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: json_api_toolbox
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adriano Bacha
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-11-09 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
259
259
|
- !ruby/object:Gem::Version
|
|
260
260
|
version: '0'
|
|
261
261
|
requirements: []
|
|
262
|
-
rubygems_version: 3.
|
|
262
|
+
rubygems_version: 3.3.25
|
|
263
263
|
signing_key:
|
|
264
264
|
specification_version: 4
|
|
265
265
|
summary: Json API usefull tools
|