service_client 0.1.3 → 0.1.5
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/Gemfile.lock +1 -1
- data/doc/ServiceClient/Base.html +781 -0
- data/doc/ServiceClient/Errors/BadGatewayError.html +159 -0
- data/doc/ServiceClient/Errors/BadRequestError.html +159 -0
- data/doc/ServiceClient/Errors/BaseError.html +359 -0
- data/doc/ServiceClient/Errors/BlockedByWindowsParentalControlsError.html +159 -0
- data/doc/ServiceClient/Errors/ClientClosedRequestError.html +159 -0
- data/doc/ServiceClient/Errors/ConflictError.html +159 -0
- data/doc/ServiceClient/Errors/EnhanceYourCalmError.html +159 -0
- data/doc/ServiceClient/Errors/ExpectationFailedError.html +159 -0
- data/doc/ServiceClient/Errors/FailedDependencyError.html +159 -0
- data/doc/ServiceClient/Errors/ForbiddenError.html +159 -0
- data/doc/ServiceClient/Errors/GatewayTimeoutError.html +159 -0
- data/doc/ServiceClient/Errors/GoneError.html +159 -0
- data/doc/ServiceClient/Errors/HTTPVersionNotSupportedError.html +159 -0
- data/doc/ServiceClient/Errors/InsufficientStorageError.html +159 -0
- data/doc/ServiceClient/Errors/InternalServerError.html +159 -0
- data/doc/ServiceClient/Errors/LengthRequiredError.html +159 -0
- data/doc/ServiceClient/Errors/LockedError.html +159 -0
- data/doc/ServiceClient/Errors/LoopDetectedError.html +159 -0
- data/doc/ServiceClient/Errors/MethodNotAllowedError.html +159 -0
- data/doc/ServiceClient/Errors/NetworkAuthenticationRequiredError.html +159 -0
- data/doc/ServiceClient/Errors/NetworkConnectTimeoutError.html +159 -0
- data/doc/ServiceClient/Errors/NetworkReadTimeoutError.html +159 -0
- data/doc/ServiceClient/Errors/NoResponseError.html +159 -0
- data/doc/ServiceClient/Errors/NotAcceptableError.html +159 -0
- data/doc/ServiceClient/Errors/NotExtendedError.html +159 -0
- data/doc/ServiceClient/Errors/NotFoundError.html +159 -0
- data/doc/ServiceClient/Errors/NotImplementedError.html +159 -0
- data/doc/ServiceClient/Errors/PaymentRequiredError.html +159 -0
- data/doc/ServiceClient/Errors/PreconditionFailedError.html +159 -0
- data/doc/ServiceClient/Errors/PreconditionRequiredError.html +159 -0
- data/doc/ServiceClient/Errors/ProxyAuthenticationRequiredError.html +159 -0
- data/doc/ServiceClient/Errors/RequestEntityTooLargeError.html +159 -0
- data/doc/ServiceClient/Errors/RequestHeaderFieldsTooLargeError.html +159 -0
- data/doc/ServiceClient/Errors/RequestTimeoutError.html +159 -0
- data/doc/ServiceClient/Errors/RequestURITooLongError.html +159 -0
- data/doc/ServiceClient/Errors/RequestedRangeNotSatisfiableError.html +159 -0
- data/doc/ServiceClient/Errors/RetryWithError.html +159 -0
- data/doc/ServiceClient/Errors/ServiceUnavailableError.html +159 -0
- data/doc/ServiceClient/Errors/TooManyRequestsError.html +159 -0
- data/doc/ServiceClient/Errors/UnauthorizedError.html +159 -0
- data/doc/ServiceClient/Errors/UnavailableForLegalReasonsError.html +159 -0
- data/doc/ServiceClient/Errors/UnprocessableEntityError.html +159 -0
- data/doc/ServiceClient/Errors/UnsupportedMediaTypeError.html +159 -0
- data/doc/ServiceClient/Errors/UpgradeRequiredError.html +159 -0
- data/doc/ServiceClient/Errors/VariantAlsoNegotiatesError.html +159 -0
- data/doc/ServiceClient/Errors.html +325 -0
- data/doc/ServiceClient/ParamsRequired.html +135 -0
- data/doc/ServiceClient/Response.html +793 -0
- data/doc/ServiceClient.html +146 -0
- data/doc/_index.html +569 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +497 -0
- data/doc/file.README.html +243 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +249 -0
- data/doc/js/app.js +314 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +171 -0
- data/doc/top-level-namespace.html +110 -0
- data/lib/service_client/base.rb +79 -24
- data/lib/service_client/errors.rb +18 -6
- data/lib/service_client/response.rb +24 -7
- data/lib/service_client/version.rb +1 -1
- metadata +69 -4
@@ -0,0 +1,243 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.28
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="file_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="serviceclient">ServiceClient</h1>
|
61
|
+
|
62
|
+
<p>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 <code>lib/service_client</code>. To experiment with that code, run <code>bin/console</code> for an interactive prompt.</p>
|
63
|
+
|
64
|
+
<h2 id="installation">Installation</h2>
|
65
|
+
|
66
|
+
<p>Add this line to your application’s Gemfile:</p>
|
67
|
+
|
68
|
+
<p><code>ruby
|
69
|
+
gem 'service_client'
|
70
|
+
</code></p>
|
71
|
+
|
72
|
+
<p>And then execute:</p>
|
73
|
+
|
74
|
+
<p><code>bash
|
75
|
+
bundle install
|
76
|
+
</code></p>
|
77
|
+
|
78
|
+
<p>Or install it yourself as:</p>
|
79
|
+
|
80
|
+
<p><code>bash
|
81
|
+
gem install service_client
|
82
|
+
</code></p>
|
83
|
+
|
84
|
+
<h2 id="usage">Usage</h2>
|
85
|
+
|
86
|
+
<p>Basic usage example:</p>
|
87
|
+
|
88
|
+
<p>```ruby
|
89
|
+
class CustomerClient < ServiceClient::Base
|
90
|
+
def find(id)
|
91
|
+
response = get(“https://api.com/customers/#id”)</p>
|
92
|
+
|
93
|
+
<pre class="code ruby"><code class="ruby">response.data rescue ServiceClient::Errors::NoDataFoundError => e
|
94
|
+
puts e.response.code # 404
|
95
|
+
puts e.response.headers
|
96
|
+
puts e.response.data rescue ServiceClient::Errors::InternalServerError => e
|
97
|
+
puts e.response.code # 500
|
98
|
+
puts e.response.headers
|
99
|
+
puts e.response.data # All errors of HTTP status code end
|
100
|
+
</code></pre>
|
101
|
+
|
102
|
+
<p>def all
|
103
|
+
get(nil)
|
104
|
+
rescue ServiceClient::ParamsRequired => e
|
105
|
+
puts e.message
|
106
|
+
end
|
107
|
+
end</p>
|
108
|
+
|
109
|
+
<p>```</p>
|
110
|
+
|
111
|
+
<h2 id="methods-of-class">Methods of class</h2>
|
112
|
+
|
113
|
+
<p>```ruby
|
114
|
+
# GET
|
115
|
+
ServiceClient::Base.get(url, headers:)</p>
|
116
|
+
|
117
|
+
<h1 id="post">POST</h1>
|
118
|
+
<p>ServiceClient::Base.post(url, headers:, body:)</p>
|
119
|
+
|
120
|
+
<h1 id="put">PUT</h1>
|
121
|
+
<p>ServiceClient::Base.put(url, headers:, body:)</p>
|
122
|
+
|
123
|
+
<h1 id="delete">DELETE</h1>
|
124
|
+
<p>ServiceClient::Base.delete(url, headers:, body:)
|
125
|
+
```</p>
|
126
|
+
|
127
|
+
<h2 id="classes-of-errors">Classes of errors</h2>
|
128
|
+
|
129
|
+
<p><code>ruby
|
130
|
+
# 400 – Bad Request
|
131
|
+
ServiceClient::Errors::BadRequestError
|
132
|
+
# 401 – Unauthorized
|
133
|
+
ServiceClient::Errors::UnauthorizedError
|
134
|
+
# 402 – Payment Required
|
135
|
+
ServiceClient::Errors::PaymentRequiredError
|
136
|
+
# 403 – Forbidden
|
137
|
+
ServiceClient::Errors::ForbiddenError
|
138
|
+
# 404 – Not Found
|
139
|
+
ServiceClient::Errors::NotFoundError
|
140
|
+
# 405 – Method Not Allowed
|
141
|
+
ServiceClient::Errors::MethodNotAllowedError
|
142
|
+
# 406 – Not Acceptable
|
143
|
+
ServiceClient::Errors::NotAcceptableError
|
144
|
+
# 407 – Proxy Authentication Required
|
145
|
+
ServiceClient::Errors::ProxyAuthenticationRequiredError
|
146
|
+
# 408 – Request Timeout
|
147
|
+
ServiceClient::Errors::RequestTimeoutError
|
148
|
+
# 409 – Conflict
|
149
|
+
ServiceClient::Errors::ConflictError
|
150
|
+
# 410 – Gone
|
151
|
+
ServiceClient::Errors::GoneError
|
152
|
+
# 411 – Length Required
|
153
|
+
ServiceClient::Errors::LengthRequiredError
|
154
|
+
# 412 – Precondition Failed
|
155
|
+
ServiceClient::Errors::PreconditionFailedError
|
156
|
+
# 413 – Request Entity Too Large
|
157
|
+
ServiceClient::Errors::RequestEntityTooLargeError
|
158
|
+
# 414 – Request-URI Too Long
|
159
|
+
ServiceClient::Errors::RequestURITooLongError
|
160
|
+
# 415 – Unsupported Media Type
|
161
|
+
ServiceClient::Errors::UnsupportedMediaTypeError
|
162
|
+
# 416 – Requested Range Not Satisfiable
|
163
|
+
ServiceClient::Errors::RequestedRangeNotSatisfiableError
|
164
|
+
# 417 – Expectation Failed
|
165
|
+
ServiceClient::Errors::ExpectationFailedError
|
166
|
+
# 420 – Enhance Your Calm
|
167
|
+
ServiceClient::Errors::EnhanceYourCalmError
|
168
|
+
# 422 – Unprocessable Entity
|
169
|
+
ServiceClient::Errors::UnprocessableEntityError
|
170
|
+
# 423 – Locked
|
171
|
+
ServiceClient::Errors::LockedError
|
172
|
+
# 424 – Failed Dependency
|
173
|
+
ServiceClient::Errors::FailedDependencyError
|
174
|
+
# 426 – Upgrade Required
|
175
|
+
ServiceClient::Errors::UpgradeRequiredError
|
176
|
+
# 428 – Precondition Required
|
177
|
+
ServiceClient::Errors::PreconditionRequiredError
|
178
|
+
# 429 – Too Many Requests
|
179
|
+
ServiceClient::Errors::TooManyRequestsError
|
180
|
+
# 431 – Request Header Fields Too Large
|
181
|
+
ServiceClient::Errors::RequestHeaderFieldsTooLargeError
|
182
|
+
# 444 – No Response
|
183
|
+
ServiceClient::Errors::NoResponseError
|
184
|
+
# 449 – Retry With
|
185
|
+
ServiceClient::Errors::RetryWithError
|
186
|
+
# 450 – Bllocked by Windows Parental Controls
|
187
|
+
ServiceClient::Errors::BlockedByWindowsParentalControlsError
|
188
|
+
# 451 – Unavailable For Legal Reasons
|
189
|
+
ServiceClient::Errors::UnavailableForLegalReasonsError
|
190
|
+
# 499 – Client Closed Request
|
191
|
+
ServiceClient::Errors::ClientClosedRequestError
|
192
|
+
# 500 – Internal Server Error
|
193
|
+
ServiceClient::Errors::InternalServerError
|
194
|
+
# 501 – Not Implemented
|
195
|
+
ServiceClient::Errors::NotImplementedError
|
196
|
+
# 502 – Bad Gateway
|
197
|
+
ServiceClient::Errors::BadGatewayError
|
198
|
+
# 503 – Service Unavailable
|
199
|
+
ServiceClient::Errors::ServiceUnavailableError
|
200
|
+
# 504 – Gateway Timeout
|
201
|
+
ServiceClient::Errors::GatewayTimeoutError
|
202
|
+
# 505 – HTTP Version Not Supported
|
203
|
+
ServiceClient::Errors::HTTPVersionNotSupportedError
|
204
|
+
# 506 – Variant Also Negotiates
|
205
|
+
ServiceClient::Errors::VariantAlsoNegotiatesError
|
206
|
+
# 507 – Insufficient Storage
|
207
|
+
ServiceClient::Errors::InsufficientStorageError
|
208
|
+
# 508 – Loop Detected
|
209
|
+
ServiceClient::Errors::LoopDetectedError
|
210
|
+
# 510 – Not Extended
|
211
|
+
ServiceClient::Errors::NotExtendedError
|
212
|
+
# 511 – Network Authentication Required
|
213
|
+
ServiceClient::Errors::NetworkAuthenticationRequiredError
|
214
|
+
# 598 – Network Read Timeout Error
|
215
|
+
ServiceClient::Errors::NetworkReadTimeoutError
|
216
|
+
# 599 – Network Connect Timeout Error
|
217
|
+
ServiceClient::Errors::NetworkConnectTimeoutError
|
218
|
+
</code></p>
|
219
|
+
|
220
|
+
<h2 id="development">Development</h2>
|
221
|
+
|
222
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
223
|
+
|
224
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
|
225
|
+
|
226
|
+
<h2 id="contributing">Contributing</h2>
|
227
|
+
|
228
|
+
<p>Bug reports and pull requests are welcome on GitHub at https://github.com/nemuba/service_client.</p>
|
229
|
+
|
230
|
+
<h2 id="license">License</h2>
|
231
|
+
|
232
|
+
<p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
233
|
+
</div></div>
|
234
|
+
|
235
|
+
<div id="footer">
|
236
|
+
Generated on Thu Feb 23 08:25:38 2023 by
|
237
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
238
|
+
0.9.28 (ruby-2.7.1).
|
239
|
+
</div>
|
240
|
+
|
241
|
+
</div>
|
242
|
+
</body>
|
243
|
+
</html>
|
data/doc/file_list.html
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
5
|
+
<meta charset="utf-8" />
|
6
|
+
|
7
|
+
<link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" />
|
8
|
+
|
9
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
14
|
+
|
15
|
+
<script type="text/javascript" charset="utf-8" src="js/full_list.js"></script>
|
16
|
+
|
17
|
+
|
18
|
+
<title>File List</title>
|
19
|
+
<base id="base_target" target="_parent" />
|
20
|
+
</head>
|
21
|
+
<body>
|
22
|
+
<div id="content">
|
23
|
+
<div class="fixed_header">
|
24
|
+
<h1 id="full_list_header">File List</h1>
|
25
|
+
<div id="full_list_nav">
|
26
|
+
|
27
|
+
<span><a target="_self" href="class_list.html">
|
28
|
+
Classes
|
29
|
+
</a></span>
|
30
|
+
|
31
|
+
<span><a target="_self" href="method_list.html">
|
32
|
+
Methods
|
33
|
+
</a></span>
|
34
|
+
|
35
|
+
<span><a target="_self" href="file_list.html">
|
36
|
+
Files
|
37
|
+
</a></span>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
<div id="search">Search: <input type="text" /></div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<ul id="full_list" class="file">
|
45
|
+
|
46
|
+
|
47
|
+
<li id="object_README" class="odd">
|
48
|
+
<div class="item"><span class="object_link"><a href="index.html" title="README">README</a></span></div>
|
49
|
+
</li>
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
</ul>
|
54
|
+
</div>
|
55
|
+
</body>
|
56
|
+
</html>
|
data/doc/frames.html
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Documentation by YARD 0.9.28</title>
|
6
|
+
</head>
|
7
|
+
<script type="text/javascript">
|
8
|
+
var match = unescape(window.location.hash).match(/^#!(.+)/);
|
9
|
+
var name = match ? match[1] : 'index.html';
|
10
|
+
name = name.replace(/^(\w+):\/\//, '').replace(/^\/\//, '');
|
11
|
+
window.top.location = name;
|
12
|
+
</script>
|
13
|
+
<noscript>
|
14
|
+
<h1>Oops!</h1>
|
15
|
+
<h2>YARD requires JavaScript!</h2>
|
16
|
+
</noscript>
|
17
|
+
</html>
|
data/doc/index.html
ADDED
@@ -0,0 +1,249 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="UTF-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
File: README
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.28
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" />
|
16
|
+
|
17
|
+
<script type="text/javascript">
|
18
|
+
pathId = "README";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index</a> »
|
40
|
+
<span class="title">File: README</span>
|
41
|
+
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div id="search">
|
45
|
+
|
46
|
+
<a class="full_list_link" id="class_list_link"
|
47
|
+
href="class_list.html">
|
48
|
+
|
49
|
+
<svg width="24" height="24">
|
50
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
51
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
52
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
</svg>
|
54
|
+
</a>
|
55
|
+
|
56
|
+
</div>
|
57
|
+
<div class="clear"></div>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="serviceclient">ServiceClient</h1>
|
61
|
+
|
62
|
+
<p>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 <code>lib/service_client</code>. To experiment with that code, run <code>bin/console</code> for an interactive prompt.</p>
|
63
|
+
|
64
|
+
<h2 id="installation">Installation</h2>
|
65
|
+
|
66
|
+
<p>Add this line to your application’s Gemfile:</p>
|
67
|
+
|
68
|
+
<p><code>ruby
|
69
|
+
gem 'service_client'
|
70
|
+
</code></p>
|
71
|
+
|
72
|
+
<p>And then execute:</p>
|
73
|
+
|
74
|
+
<p><code>bash
|
75
|
+
bundle install
|
76
|
+
</code></p>
|
77
|
+
|
78
|
+
<p>Or install it yourself as:</p>
|
79
|
+
|
80
|
+
<p><code>bash
|
81
|
+
gem install service_client
|
82
|
+
</code></p>
|
83
|
+
|
84
|
+
<h2 id="usage">Usage</h2>
|
85
|
+
|
86
|
+
<p>Basic usage example:</p>
|
87
|
+
|
88
|
+
<pre>
|
89
|
+
class CustomerClient < ServiceClient::Base
|
90
|
+
def find(id)
|
91
|
+
response = get(“https://api.com/customers/#id”)
|
92
|
+
|
93
|
+
response.data
|
94
|
+
rescue ServiceClient::Errors::NoDataFoundError => e
|
95
|
+
puts e.response.code # 404
|
96
|
+
puts e.response.headers
|
97
|
+
puts e.response.data
|
98
|
+
rescue ServiceClient::Errors::InternalServerError => e
|
99
|
+
puts e.response.code # 500
|
100
|
+
puts e.response.headers
|
101
|
+
puts e.response.data
|
102
|
+
# All errors of HTTP status code
|
103
|
+
end
|
104
|
+
|
105
|
+
def all
|
106
|
+
get(nil)
|
107
|
+
rescue ServiceClient::ParamsRequired => e
|
108
|
+
puts e.message
|
109
|
+
end
|
110
|
+
</pre>
|
111
|
+
|
112
|
+
<h2 id="methods-of-class">Methods of class</h2>
|
113
|
+
|
114
|
+
<h1 id="get">GET</h1>
|
115
|
+
<code>
|
116
|
+
ServiceClient::Base.get(url, headers:)
|
117
|
+
</code>
|
118
|
+
|
119
|
+
<h1 id="post">POST</h1>
|
120
|
+
<code>
|
121
|
+
ServiceClient::Base.post(url, headers:, body:)
|
122
|
+
</code>
|
123
|
+
|
124
|
+
<h1 id="put">PUT</h1>
|
125
|
+
<code>
|
126
|
+
ServiceClient::Base.put(url, headers:, body:)
|
127
|
+
</code>
|
128
|
+
|
129
|
+
<h1 id="delete">DELETE</h1>
|
130
|
+
<code>
|
131
|
+
ServiceClient::Base.delete(url, headers:, body:)
|
132
|
+
</code>
|
133
|
+
|
134
|
+
<h2 id="classes-of-errors">Classes of errors</h2>
|
135
|
+
<pre>
|
136
|
+
# 400 – Bad Request
|
137
|
+
ServiceClient::Errors::BadRequestError
|
138
|
+
# 401 – Unauthorized
|
139
|
+
ServiceClient::Errors::UnauthorizedError
|
140
|
+
# 402 – Payment Required
|
141
|
+
ServiceClient::Errors::PaymentRequiredError
|
142
|
+
# 403 – Forbidden
|
143
|
+
ServiceClient::Errors::ForbiddenError
|
144
|
+
# 404 – Not Found
|
145
|
+
ServiceClient::Errors::NotFoundError
|
146
|
+
# 405 – Method Not Allowed
|
147
|
+
ServiceClient::Errors::MethodNotAllowedError
|
148
|
+
# 406 – Not Acceptable
|
149
|
+
ServiceClient::Errors::NotAcceptableError
|
150
|
+
# 407 – Proxy Authentication Required
|
151
|
+
ServiceClient::Errors::ProxyAuthenticationRequiredError
|
152
|
+
# 408 – Request Timeout
|
153
|
+
ServiceClient::Errors::RequestTimeoutError
|
154
|
+
# 409 – Conflict
|
155
|
+
ServiceClient::Errors::ConflictError
|
156
|
+
# 410 – Gone
|
157
|
+
ServiceClient::Errors::GoneError
|
158
|
+
# 411 – Length Required
|
159
|
+
ServiceClient::Errors::LengthRequiredError
|
160
|
+
# 412 – Precondition Failed
|
161
|
+
ServiceClient::Errors::PreconditionFailedError
|
162
|
+
# 413 – Request Entity Too Large
|
163
|
+
ServiceClient::Errors::RequestEntityTooLargeError
|
164
|
+
# 414 – Request-URI Too Long
|
165
|
+
ServiceClient::Errors::RequestURITooLongError
|
166
|
+
# 415 – Unsupported Media Type
|
167
|
+
ServiceClient::Errors::UnsupportedMediaTypeError
|
168
|
+
# 416 – Requested Range Not Satisfiable
|
169
|
+
ServiceClient::Errors::RequestedRangeNotSatisfiableError
|
170
|
+
# 417 – Expectation Failed
|
171
|
+
ServiceClient::Errors::ExpectationFailedError
|
172
|
+
# 420 – Enhance Your Calm
|
173
|
+
ServiceClient::Errors::EnhanceYourCalmError
|
174
|
+
# 422 – Unprocessable Entity
|
175
|
+
ServiceClient::Errors::UnprocessableEntityError
|
176
|
+
# 423 – Locked
|
177
|
+
ServiceClient::Errors::LockedError
|
178
|
+
# 424 – Failed Dependency
|
179
|
+
ServiceClient::Errors::FailedDependencyError
|
180
|
+
# 426 – Upgrade Required
|
181
|
+
ServiceClient::Errors::UpgradeRequiredError
|
182
|
+
# 428 – Precondition Required
|
183
|
+
ServiceClient::Errors::PreconditionRequiredError
|
184
|
+
# 429 – Too Many Requests
|
185
|
+
ServiceClient::Errors::TooManyRequestsError
|
186
|
+
# 431 – Request Header Fields Too Large
|
187
|
+
ServiceClient::Errors::RequestHeaderFieldsTooLargeError
|
188
|
+
# 444 – No Response
|
189
|
+
ServiceClient::Errors::NoResponseError
|
190
|
+
# 449 – Retry With
|
191
|
+
ServiceClient::Errors::RetryWithError
|
192
|
+
# 450 – Bllocked by Windows Parental Controls
|
193
|
+
ServiceClient::Errors::BlockedByWindowsParentalControlsError
|
194
|
+
# 451 – Unavailable For Legal Reasons
|
195
|
+
ServiceClient::Errors::UnavailableForLegalReasonsError
|
196
|
+
# 499 – Client Closed Request
|
197
|
+
ServiceClient::Errors::ClientClosedRequestError
|
198
|
+
# 500 – Internal Server Error
|
199
|
+
ServiceClient::Errors::InternalServerError
|
200
|
+
# 501 – Not Implemented
|
201
|
+
ServiceClient::Errors::NotImplementedError
|
202
|
+
# 502 – Bad Gateway
|
203
|
+
ServiceClient::Errors::BadGatewayError
|
204
|
+
# 503 – Service Unavailable
|
205
|
+
ServiceClient::Errors::ServiceUnavailableError
|
206
|
+
# 504 – Gateway Timeout
|
207
|
+
ServiceClient::Errors::GatewayTimeoutError
|
208
|
+
# 505 – HTTP Version Not Supported
|
209
|
+
ServiceClient::Errors::HTTPVersionNotSupportedError
|
210
|
+
# 506 – Variant Also Negotiates
|
211
|
+
ServiceClient::Errors::VariantAlsoNegotiatesError
|
212
|
+
# 507 – Insufficient Storage
|
213
|
+
ServiceClient::Errors::InsufficientStorageError
|
214
|
+
# 508 – Loop Detected
|
215
|
+
ServiceClient::Errors::LoopDetectedError
|
216
|
+
# 510 – Not Extended
|
217
|
+
ServiceClient::Errors::NotExtendedError
|
218
|
+
# 511 – Network Authentication Required
|
219
|
+
ServiceClient::Errors::NetworkAuthenticationRequiredError
|
220
|
+
# 598 – Network Read Timeout Error
|
221
|
+
ServiceClient::Errors::NetworkReadTimeoutError
|
222
|
+
# 599 – Network Connect Timeout Error
|
223
|
+
ServiceClient::Errors::NetworkConnectTimeoutError
|
224
|
+
</pre>
|
225
|
+
|
226
|
+
<h2 id="development">Development</h2>
|
227
|
+
|
228
|
+
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rake spec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
229
|
+
|
230
|
+
<p>To install this gem onto your local machine, run <code>bundle exec rake install</code>. To release a new version, update the version number in <code>version.rb</code>, and then run <code>bundle exec rake release</code>, which will create a git tag for the version, push git commits and tags, and push the <code>.gem</code> file to <a href="https://rubygems.org">rubygems.org</a>.</p>
|
231
|
+
|
232
|
+
<h2 id="contributing">Contributing</h2>
|
233
|
+
|
234
|
+
<p>Bug reports and pull requests are welcome on GitHub at https://github.com/nemuba/service_client.</p>
|
235
|
+
|
236
|
+
<h2 id="license">License</h2>
|
237
|
+
|
238
|
+
<p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
239
|
+
</div></div>
|
240
|
+
|
241
|
+
<div id="footer">
|
242
|
+
Generated on Thu Feb 23 08:25:38 2023 by
|
243
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
244
|
+
0.9.28 (ruby-2.7.1).
|
245
|
+
</div>
|
246
|
+
|
247
|
+
</div>
|
248
|
+
</body>
|
249
|
+
</html>
|