minato-utils 0.2.0 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f88994984a0fbd362ae44d5f34443bd0a52b4b2589f3ff1b97ecb71862bdc50
4
- data.tar.gz: b643b6318b6e8f65d48ec95392dcacf15acbff7f52703f5e9602c6aa3124106c
3
+ metadata.gz: a67141ad56404c902119ea4a8d6e8922416e3ec5005978a5f129ee7819a5af16
4
+ data.tar.gz: ed7a6709884e152c1a387537f7ab0a7c11eff66a51555cc288c18c68ca7c1aeb
5
5
  SHA512:
6
- metadata.gz: cd59b12ca9e791f757fd087c586986164fab8d89f1e17295c82db38ebc3e72e219e9713d6eb6e2dca3b7cabd7e41dc12713f2942d2441f42f6a33889d981497f
7
- data.tar.gz: bfadf8821af63c1855aa07ceb66fdea891ac543d101e8d4b3ed5a3450d8e2ceef5c15ecc1a502b76e8ef7e2c66cbab0960a00f1b044cccd201faa1fa6ee4a93f
6
+ metadata.gz: a86da77396744631e10d1f41b5acdb1de02e4ad35585ca3095cda795176e2ed4571160b588cd6d2cae15dcb0b3c09dac62a5c1db5fd75e5467794bf1bd8bfcd8
7
+ data.tar.gz: 847de42b62d239fe443f5e65dc28884c7feed3dfd0b95822523483a0a83f98a34ca7d059b162f74f22684e155d1c721949b1a734f215b94713c3dbdea00347d6
data/.gitlab-ci.yml CHANGED
@@ -1,5 +1,2 @@
1
1
  include:
2
- - project: 'ferreri/minato-projects/minato-ci'
3
- ref: main
4
- file: '/gem/.gitlab-ci.yml'
5
-
2
+ - remote: 'https://gitlab.com/ferreri/minato/minato-ci/raw/main/gem/.gitlab-ci.yml'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minato-utils (0.2.0)
4
+ minato-utils (0.2.2)
5
5
  activesupport (~> 6.0)
6
6
  httparty (~> 0.18)
7
7
 
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
- Além disso, é possível adicionar mais opções ou sobrescrever o padrão usando o
51
- método `params`:
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 irão gerar uma exceção do tipo `Minato::Utils::<Exception>`.
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
@@ -37,7 +37,6 @@ module Minato
37
37
  private
38
38
 
39
39
  def request(method, path, options)
40
- return_headers = options.delete(:return_headers)
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, return_headers)
47
+ Minato::Utils::ResponseHandler.handle(response)
49
48
  end
50
49
  end
51
50
  end
@@ -7,19 +7,17 @@ module Minato
7
7
  module Utils
8
8
  class ResponseHandler
9
9
  class << self
10
- def handle(response, return_headers)
10
+ def handle(response)
11
11
  raise_exception(response) if response_error?(response)
12
12
 
13
- if return_headers
14
- { body: Minato::Utils::Helpers.parse_json(response.body), header: response.header }
15
- else
16
- Minato::Utils::Helpers.parse_json(response.body)
17
- end
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
21
19
 
22
- SUCCESSFUL_RESPONSE_CODE = [200, 201, 204, 302].freeze
20
+ SUCCESSFUL_RESPONSE_CODE = [200, 201, 204, 302, 303].freeze
23
21
 
24
22
  EXCEPTION_HANDLERS_MAP = {
25
23
  400 => 'bad_request',
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minato
4
4
  module Utils
5
- VERSION = '0.2.0'
5
+ VERSION = '0.2.3'
6
6
  end
7
7
  end
data/release-notes.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Release Notes
2
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
+
3
12
  ## v0.2.0 - December 20th, 2021
4
13
 
5
14
  ### Compatibility Notes
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.2.0
4
+ version: 0.2.3
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-23 00:00:00.000000000 Z
11
+ date: 2022-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -226,7 +226,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
226
  - !ruby/object:Gem::Version
227
227
  version: '0'
228
228
  requirements: []
229
- rubygems_version: 3.2.32
229
+ rubygems_version: 3.1.6
230
230
  signing_key:
231
231
  specification_version: 4
232
232
  summary: Minato Ruby Utils