service_client 0.1.10 → 0.1.11

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: 69224ff4b8d652bf43e798c54fb447a08d6f31a8257ca76349aff31a6ae5f285
4
- data.tar.gz: 4eef55e77a8b0e60c26c9146fbba0037bcff44998107286a08dffa998bdec22d
3
+ metadata.gz: 7d785d79f17da59bcbc444fc44744620c695b33d9a8c659ab6dd60bf804775ae
4
+ data.tar.gz: 941d815ff71420eeab33d24a99feaf822830d99f73152850f82892b5516e365d
5
5
  SHA512:
6
- metadata.gz: f02c7ff167a37e7c7e69ea7ddf793492a7fd96391d72861330a0f92ee7615015ba8b84fb359d4e7422ce3f7dcc5aaecbce5dac6dbd2f9e48d4659f09076ab2c4
7
- data.tar.gz: 00cf3d41c7c5952ccea81b81ca952a166ff2b0df40154c384becd57e642cedf48e865e1d0303000276150e2191c4be6e3b66c50e50420c8d5cb53cf410e3b85d
6
+ metadata.gz: f9388925c566cef3738b13209a1f72f81578b460c56d238d2f62434d0e6abf7987cfecfc8f0e9b9ffdf2bc8f4ed37d446a475fdc7d7d7862ebdd8362a4114f98
7
+ data.tar.gz: 4bc5b7a97d1d7406764a5ee1bbd2cb30625787c63f4f6d752feffc3ca850e2a1bac021c52c85af9d41d0dea7be06dc45b0098a320527ff163f013aa866c3cf49
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # ServiceClient
1
+ *# ServiceClient
2
2
 
3
3
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/service_client`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
@@ -26,8 +26,7 @@ gem install service_client
26
26
 
27
27
  Basic usage example:
28
28
 
29
- <pre>
30
- <code class="code ruby">
29
+ ```ruby
31
30
  class CustomerClient < ServiceClient::Base
32
31
  base_url 'https://api.com'
33
32
  default_headers content_type: 'application/json'
@@ -53,13 +52,11 @@ class CustomerClient < ServiceClient::Base
53
52
  puts e.message
54
53
  end
55
54
  end
56
- </code>
57
- </pre>
55
+ ```
58
56
 
59
57
  ## Methods of class
60
58
 
61
- <pre>
62
- <code>
59
+ ```ruby
63
60
  # GET
64
61
  ServiceClient::Base.get(url, headers:)
65
62
 
@@ -71,13 +68,11 @@ ServiceClient::Base.put(url, headers:, body:)
71
68
 
72
69
  # DELETE
73
70
  ServiceClient::Base.delete(url, headers:, body:)
74
- </code>
75
- </pre>
71
+ ```
76
72
 
77
73
  ## Classes of errors
78
74
 
79
- <pre>
80
- <code>
75
+ ```ruby
81
76
  # 400 – Bad Request
82
77
  ServiceClient::Errors::BadRequestError
83
78
  # 401 – Unauthorized
@@ -166,8 +161,7 @@ ServiceClient::Base.delete(url, headers:, body:)
166
161
  ServiceClient::Errors::NetworkReadTimeoutError
167
162
  # 599 – Network Connect Timeout Error
168
163
  ServiceClient::Errors::NetworkConnectTimeoutError
169
- </code>
170
- </pre>
164
+ ```
171
165
 
172
166
  ## Development
173
167
 
@@ -177,7 +171,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
177
171
 
178
172
  ## Contributing
179
173
 
180
- Bug reports and pull requests are welcome on GitHub at https://github.com/nemuba/service_client.
174
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/nemuba/service_client>.
181
175
 
182
176
  ## License
183
177
 
@@ -165,6 +165,8 @@ module ServiceClient
165
165
  # raise [BaseError] The error that corresponds to the given HTTP response code.
166
166
  # @return [void]
167
167
  def raise_error(code, response)
168
+ raise BaseError.new('Unknown error', response) if [code, response].any?(&:nil?)
169
+
168
170
  raise ERRORS[code.to_sym].new(ERRORS[code.to_sym].class.name, response)
169
171
  end
170
172
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ServiceClient
4
- VERSION = '0.1.10'
4
+ VERSION = '0.1.11'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alef Ojeda de Oliveira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-01 00:00:00.000000000 Z
11
+ date: 2024-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler