minato-utils 0.1.2 → 0.2.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/.gitignore +2 -1
- data/.gitlab-ci.yml +4 -39
- data/Gemfile.lock +7 -7
- data/README.md +5 -5
- data/lib/minato/utils/client.rb +4 -5
- data/lib/minato/utils/response_handler.rb +5 -7
- data/lib/minato/utils/version.rb +1 -1
- data/{minato-utils.gemspec → minato-ruby-utils.gemspec} +10 -10
- data/release-notes.md +17 -0
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 792df7e33288c44df36a7c1d2bb4e691722fe28a9c64ed47d0b15f9a71e0645a
|
4
|
+
data.tar.gz: 2a8cc6e71f33794d05505d84d6d41119d7864c0da3d9b86453932b0bffd41371
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 196afd23819111e3da67bd1d584e5ff0c53efc21314417b0e61962355b19b662af4e9c698ebfaf130db6b42dccdb7c177268bafe7dfa56501f729e6c6e0356b6
|
7
|
+
data.tar.gz: 55ae22fdcda8590156fb64c86c29b62d721f9e696a96e82891ff5c905c0cedd8860d5c0fa4802e8294754c909f6cdd4702ef50078b00995b3f7af68288f1b9f8
|
data/.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
|
1
|
+
*.gem
|
2
|
+
*.code-workspace
|
data/.gitlab-ci.yml
CHANGED
@@ -1,40 +1,5 @@
|
|
1
|
-
|
1
|
+
include:
|
2
|
+
- project: 'ferreri/minato-projects/minato-ci'
|
3
|
+
ref: main
|
4
|
+
file: '/gem/.gitlab-ci.yml'
|
2
5
|
|
3
|
-
stages:
|
4
|
-
- test
|
5
|
-
|
6
|
-
variables:
|
7
|
-
IMAGE_REF: "$IMAGE:$CI_COMMIT_SHORT_SHA"
|
8
|
-
KEY_FILE: "gcloud-service-key.json"
|
9
|
-
|
10
|
-
.cmd_google_key: &cmd_google_key |-
|
11
|
-
echo $GCLOUD_SERVICE_KEY | base64 -d > $KEY_FILE
|
12
|
-
|
13
|
-
.cmd_auth_docker: &cmd_auth_docker |-
|
14
|
-
cat $KEY_FILE | docker login -u _json_key --password-stdin https://gcr.io
|
15
|
-
|
16
|
-
.auth_docker: &auth_docker
|
17
|
-
before_script:
|
18
|
-
- *cmd_google_key
|
19
|
-
- *cmd_auth_docker
|
20
|
-
|
21
|
-
rspec:
|
22
|
-
<<: *auth_docker
|
23
|
-
stage: test
|
24
|
-
image: ruby:2.7.3
|
25
|
-
only:
|
26
|
-
- merge_requests
|
27
|
-
- dev
|
28
|
-
- main
|
29
|
-
cache:
|
30
|
-
paths:
|
31
|
-
- vendor/ruby
|
32
|
-
variables:
|
33
|
-
RAILS_ENV: test
|
34
|
-
BASE_PATH: /minato-ruby-utils
|
35
|
-
before_script:
|
36
|
-
- gem install bundler --no-document
|
37
|
-
- bundle config set --local path 'vendor/ruby'
|
38
|
-
- bundle install -j $(nproc)
|
39
|
-
script:
|
40
|
-
- bundle exec rspec
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
minato-utils (0.
|
4
|
+
minato-utils (0.2.2)
|
5
5
|
activesupport (~> 6.0)
|
6
6
|
httparty (~> 0.18)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (6.1.4.
|
11
|
+
activesupport (6.1.4.4)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 1.6, < 2)
|
14
14
|
minitest (>= 5.1)
|
@@ -33,10 +33,10 @@ GEM
|
|
33
33
|
mime-types (3.4.1)
|
34
34
|
mime-types-data (~> 3.2015)
|
35
35
|
mime-types-data (3.2021.1115)
|
36
|
-
minitest (5.
|
36
|
+
minitest (5.15.0)
|
37
37
|
multi_xml (0.6.0)
|
38
38
|
parallel (1.21.0)
|
39
|
-
parser (3.0.2
|
39
|
+
parser (3.0.3.2)
|
40
40
|
ast (~> 2.4.1)
|
41
41
|
pry (0.14.1)
|
42
42
|
coderay (~> 1.1)
|
@@ -45,7 +45,7 @@ GEM
|
|
45
45
|
rack (2.2.3)
|
46
46
|
rainbow (3.0.0)
|
47
47
|
rake (10.5.0)
|
48
|
-
regexp_parser (2.
|
48
|
+
regexp_parser (2.2.0)
|
49
49
|
rexml (3.2.5)
|
50
50
|
rspec (3.10.0)
|
51
51
|
rspec-core (~> 3.10.0)
|
@@ -69,7 +69,7 @@ GEM
|
|
69
69
|
rubocop-ast (>= 1.12.0, < 2.0)
|
70
70
|
ruby-progressbar (~> 1.7)
|
71
71
|
unicode-display_width (>= 1.4.0, < 3.0)
|
72
|
-
rubocop-ast (1.
|
72
|
+
rubocop-ast (1.15.0)
|
73
73
|
parser (>= 3.0.1.1)
|
74
74
|
rubocop-rails (2.12.4)
|
75
75
|
activesupport (>= 4.2.0)
|
@@ -106,4 +106,4 @@ DEPENDENCIES
|
|
106
106
|
webmock (~> 3.14)
|
107
107
|
|
108
108
|
BUNDLED WITH
|
109
|
-
2.2.
|
109
|
+
2.2.33
|
data/README.md
CHANGED
@@ -46,16 +46,16 @@ Para usar o cliente você vai precisar iniciar ele com `base_uri` e
|
|
46
46
|
client = Minato::Utils::Client.new(base_uri: 'http://www.test.com', default_options: headers: { 'Content-type' => 'application/json' })
|
47
47
|
```
|
48
48
|
|
49
|
-
Você pode usar todos os métodos HTTP para fazer requisições.
|
50
|
-
|
51
|
-
|
49
|
+
Você pode usar todos os métodos HTTP para fazer requisições. Além disso, é
|
50
|
+
possível adicionar mais opções ou sobrescrever o padrão usando o método
|
51
|
+
`params`:
|
52
52
|
|
53
53
|
```ruby
|
54
54
|
client.get('/path', headers: { 'X-Session-Token' => '123' })
|
55
55
|
```
|
56
56
|
|
57
|
-
As falhas de solicitação
|
58
|
-
As possíveis exceções são:
|
57
|
+
As falhas de solicitação produzirão uma exceção do tipo
|
58
|
+
`Minato::Utils::<Exception>`. As possíveis exceções são:
|
59
59
|
|
60
60
|
```ruby
|
61
61
|
Minato::Utils::BadRequest
|
data/lib/minato/utils/client.rb
CHANGED
@@ -18,9 +18,8 @@ module Minato
|
|
18
18
|
request(:get, path, options)
|
19
19
|
end
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
request(:post, path, options, return_headers)
|
21
|
+
def post(path, options = {})
|
22
|
+
request(:post, path, options)
|
24
23
|
end
|
25
24
|
|
26
25
|
def put(path, options = {})
|
@@ -37,7 +36,7 @@ module Minato
|
|
37
36
|
|
38
37
|
private
|
39
38
|
|
40
|
-
def request(method, path, options
|
39
|
+
def request(method, path, options)
|
41
40
|
request_options = @default_options.deep_merge(options)
|
42
41
|
url = Minato::Utils::Helpers.join_url(@base_uri, path)
|
43
42
|
|
@@ -45,7 +44,7 @@ module Minato
|
|
45
44
|
response = self.class.send(method, url, request_options)
|
46
45
|
|
47
46
|
Minato::Utils.logger.log_response(method, @base_uri, path, request_options, response)
|
48
|
-
Minato::Utils::ResponseHandler.handle(response
|
47
|
+
Minato::Utils::ResponseHandler.handle(response)
|
49
48
|
end
|
50
49
|
end
|
51
50
|
end
|
@@ -7,14 +7,12 @@ module Minato
|
|
7
7
|
module Utils
|
8
8
|
class ResponseHandler
|
9
9
|
class << self
|
10
|
-
def handle(response
|
10
|
+
def handle(response)
|
11
11
|
raise_exception(response) if response_error?(response)
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
Minato::Utils::Helpers.parse_json(response.body)
|
17
|
-
end
|
12
|
+
|
13
|
+
body = Minato::Utils::Helpers.parse_json(response.body)
|
14
|
+
header = response.header.to_hash || {}
|
15
|
+
{ body: body, header: header }
|
18
16
|
end
|
19
17
|
|
20
18
|
private
|
data/lib/minato/utils/version.rb
CHANGED
@@ -4,14 +4,14 @@ $LOAD_PATH.unshift File.expand_path('lib', __dir__)
|
|
4
4
|
require 'minato/utils/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.
|
8
|
-
spec.
|
9
|
-
spec.
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
spec.summary
|
14
|
-
spec.
|
7
|
+
spec.authors = ['Ferreri']
|
8
|
+
spec.description = 'Library to share common functionality across services'
|
9
|
+
spec.email = ['contato@ferreri.co']
|
10
|
+
spec.homepage = 'https://gitlab.com/ferreri/minato-projects/minato-ruby-utils'
|
11
|
+
spec.license = 'MIT'
|
12
|
+
spec.name = 'minato-utils'
|
13
|
+
spec.summary = 'Minato Ruby Utils'
|
14
|
+
spec.version = Minato::Utils::VERSION
|
15
15
|
|
16
16
|
spec.required_ruby_version = '>= 2.7'
|
17
17
|
|
@@ -20,8 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
21
21
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
22
22
|
end
|
23
|
-
spec.bindir
|
24
|
-
spec.executables
|
23
|
+
spec.bindir = 'exe'
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
25
25
|
spec.require_paths = ['lib']
|
26
26
|
|
27
27
|
spec.add_dependency 'activesupport', '~> 6.0'
|
data/release-notes.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Release Notes
|
2
|
+
|
3
|
+
## v0.2.2 - January 4th, 2022
|
4
|
+
|
5
|
+
### Compatibility Notes
|
6
|
+
|
7
|
+
- `return_headers` was removed from method `Minato::Utils::Client#request`<br/>
|
8
|
+
This renders `return_headers` as a hash key to `options` variable worthless, so
|
9
|
+
from now on you can assume that all requests will return a header regardless if
|
10
|
+
it's useful for the current invocation or not.
|
11
|
+
|
12
|
+
## v0.2.0 - December 20th, 2021
|
13
|
+
|
14
|
+
### Compatibility Notes
|
15
|
+
|
16
|
+
- `return_headers` was removed from method `Minato::Utils::Client#post`<br/>
|
17
|
+
Now you need to pass `return_headers` as a key to the hash parameter `options`.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: minato-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ferreri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -178,7 +178,7 @@ dependencies:
|
|
178
178
|
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '3.14'
|
181
|
-
description: common
|
181
|
+
description: Library to share common functionality across services
|
182
182
|
email:
|
183
183
|
- contato@ferreri.co
|
184
184
|
executables: []
|
@@ -204,7 +204,8 @@ files:
|
|
204
204
|
- lib/minato/utils/logger.rb
|
205
205
|
- lib/minato/utils/response_handler.rb
|
206
206
|
- lib/minato/utils/version.rb
|
207
|
-
- minato-utils.gemspec
|
207
|
+
- minato-ruby-utils.gemspec
|
208
|
+
- release-notes.md
|
208
209
|
homepage: https://gitlab.com/ferreri/minato-projects/minato-ruby-utils
|
209
210
|
licenses:
|
210
211
|
- MIT
|
@@ -225,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
225
226
|
- !ruby/object:Gem::Version
|
226
227
|
version: '0'
|
227
228
|
requirements: []
|
228
|
-
rubygems_version: 3.
|
229
|
+
rubygems_version: 3.1.6
|
229
230
|
signing_key:
|
230
231
|
specification_version: 4
|
231
232
|
summary: Minato Ruby Utils
|