minato-utils 0.1.1 → 0.1.2

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: 01670db07941c0dc68be0ce9c9224f94d88c53cd5c5ec68683da61c583849fcb
4
- data.tar.gz: 3583a272ed589e7016bb37028e5b9caeacbbcc333377d9eeb99d07f210f1596c
3
+ metadata.gz: 959e77004e8dcf1b83136526b298e078ad52ce0556822dd5b8c5ac89b8387b88
4
+ data.tar.gz: 0c4c96c0da914527cf0d1944d74b49d462350263014b5c50bd53366eb0587a8e
5
5
  SHA512:
6
- metadata.gz: bf8d6b71df86cd3fad67ce1e5023c8bdc3236b2483a9ac4eda01b6ee15cc0cdbaf287cf70083c001be9f30ece77334e7f40a2d48033cdef15ad21aa8978072e0
7
- data.tar.gz: 4b534d3b50d1a4ac7d7520642036798bcb75cc90c0676d00968a152152061a8caf7bb8ce4f1c5d5c636b7e3c43de4f67259b775b9d1b8b9e15df19e6cf9f94cc
6
+ metadata.gz: d9a4a715c8769add21b8bd40b897514bd42bcc3a70b9536d75badcca366502ef66cf8d202cb4baf00aff1a9e937dd5b024a512e5fa162cfcc94e98d74f417b7c
7
+ data.tar.gz: c832425e2775bd5c80e687a1f3b7cdc70ef45d28c7e65cb42a5e02a6399c6c58572858895ea651bad15ecc08dbe0a5826a912d57bf57ab3838fa3857446052ab
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- minato-utils (0.1.1)
4
+ minato-utils (0.1.2)
5
5
  activesupport (~> 6.0)
6
6
  httparty (~> 0.18)
7
7
 
@@ -106,4 +106,4 @@ DEPENDENCIES
106
106
  webmock (~> 3.14)
107
107
 
108
108
  BUNDLED WITH
109
- 2.2.31
109
+ 2.2.32
@@ -18,8 +18,9 @@ module Minato
18
18
  request(:get, path, options)
19
19
  end
20
20
 
21
- def post(path, options = {})
22
- request(:post, path, options)
21
+
22
+ def post(path, options = {}, return_headers=false)
23
+ request(:post, path, options, return_headers)
23
24
  end
24
25
 
25
26
  def put(path, options = {})
@@ -36,7 +37,7 @@ module Minato
36
37
 
37
38
  private
38
39
 
39
- def request(method, path, options)
40
+ def request(method, path, options, return_header=false)
40
41
  request_options = @default_options.deep_merge(options)
41
42
  url = Minato::Utils::Helpers.join_url(@base_uri, path)
42
43
 
@@ -44,7 +45,7 @@ module Minato
44
45
  response = self.class.send(method, url, request_options)
45
46
 
46
47
  Minato::Utils.logger.log_response(method, @base_uri, path, request_options, response)
47
- Minato::Utils::ResponseHandler.handle(response)
48
+ Minato::Utils::ResponseHandler.handle(response, return_header)
48
49
  end
49
50
  end
50
51
  end
@@ -7,15 +7,19 @@ module Minato
7
7
  module Utils
8
8
  class ResponseHandler
9
9
  class << self
10
- def handle(response)
10
+ def handle(response, return_header=false)
11
11
  raise_exception(response) if response_error?(response)
12
-
13
- Minato::Utils::Helpers.parse_json(response.body)
12
+
13
+ if(return_header)
14
+ { body: Common::Utils.parse_json(response.body), header: response.header }
15
+ else
16
+ Minato::Utils::Helpers.parse_json(response.body)
17
+ end
14
18
  end
15
19
 
16
20
  private
17
21
 
18
- SUCCESSFUL_RESPONSE_CODE = [200, 201, 204].freeze
22
+ SUCCESSFUL_RESPONSE_CODE = [200, 201, 204, 302].freeze
19
23
 
20
24
  EXCEPTION_HANDLERS_MAP = {
21
25
  400 => 'bad_request',
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Minato
4
4
  module Utils
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferreri
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-11-23 00:00:00.000000000 Z
11
+ date: 2021-12-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -210,7 +210,7 @@ licenses:
210
210
  - MIT
211
211
  metadata:
212
212
  rubygems_mfa_required: 'true'
213
- post_install_message:
213
+ post_install_message:
214
214
  rdoc_options: []
215
215
  require_paths:
216
216
  - lib
@@ -225,8 +225,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
225
  - !ruby/object:Gem::Version
226
226
  version: '0'
227
227
  requirements: []
228
- rubygems_version: 3.1.6
229
- signing_key:
228
+ rubygems_version: 3.2.32
229
+ signing_key:
230
230
  specification_version: 4
231
231
  summary: Minato Ruby Utils
232
232
  test_files: []