minato-utils 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/.gitlab-ci.yml +4 -39
- data/Gemfile.lock +7 -7
- data/README.md +2 -2
- data/lib/minato/utils/client.rb +5 -5
- data/lib/minato/utils/response_handler.rb +3 -3
- data/lib/minato/utils/version.rb +1 -1
- data/{minato-utils.gemspec → minato-ruby-utils.gemspec} +10 -10
- data/release-notes.md +8 -0
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f88994984a0fbd362ae44d5f34443bd0a52b4b2589f3ff1b97ecb71862bdc50
|
4
|
+
data.tar.gz: b643b6318b6e8f65d48ec95392dcacf15acbff7f52703f5e9602c6aa3124106c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd59b12ca9e791f757fd087c586986164fab8d89f1e17295c82db38ebc3e72e219e9713d6eb6e2dca3b7cabd7e41dc12713f2942d2441f42f6a33889d981497f
|
7
|
+
data.tar.gz: bfadf8821af63c1855aa07ceb66fdea891ac543d101e8d4b3ed5a3450d8e2ceef5c15ecc1a502b76e8ef7e2c66cbab0960a00f1b044cccd201faa1fa6ee4a93f
|
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.0)
|
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
@@ -47,8 +47,8 @@ client = Minato::Utils::Client.new(base_uri: 'http://www.test.com', default_opti
|
|
47
47
|
```
|
48
48
|
|
49
49
|
Você pode usar todos os métodos HTTP para fazer requisições.
|
50
|
-
|
51
|
-
|
50
|
+
Além disso, é possível adicionar mais opções ou sobrescrever o padrão usando o
|
51
|
+
método `params`:
|
52
52
|
|
53
53
|
```ruby
|
54
54
|
client.get('/path', headers: { 'X-Session-Token' => '123' })
|
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,8 @@ module Minato
|
|
37
36
|
|
38
37
|
private
|
39
38
|
|
40
|
-
def request(method, path, options
|
39
|
+
def request(method, path, options)
|
40
|
+
return_headers = options.delete(:return_headers)
|
41
41
|
request_options = @default_options.deep_merge(options)
|
42
42
|
url = Minato::Utils::Helpers.join_url(@base_uri, path)
|
43
43
|
|
@@ -45,7 +45,7 @@ module Minato
|
|
45
45
|
response = self.class.send(method, url, request_options)
|
46
46
|
|
47
47
|
Minato::Utils.logger.log_response(method, @base_uri, path, request_options, response)
|
48
|
-
Minato::Utils::ResponseHandler.handle(response,
|
48
|
+
Minato::Utils::ResponseHandler.handle(response, return_headers)
|
49
49
|
end
|
50
50
|
end
|
51
51
|
end
|
@@ -7,10 +7,10 @@ module Minato
|
|
7
7
|
module Utils
|
8
8
|
class ResponseHandler
|
9
9
|
class << self
|
10
|
-
def handle(response,
|
10
|
+
def handle(response, return_headers)
|
11
11
|
raise_exception(response) if response_error?(response)
|
12
|
-
|
13
|
-
if
|
12
|
+
|
13
|
+
if return_headers
|
14
14
|
{ body: Minato::Utils::Helpers.parse_json(response.body), header: response.header }
|
15
15
|
else
|
16
16
|
Minato::Utils::Helpers.parse_json(response.body)
|
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
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ferreri
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-23 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
|