simple_http_service 0.1.7 → 0.2.0
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/doc/SimpleHttpService/Client.html +8 -6
- data/doc/SimpleHttpService/Error.html +2 -2
- data/doc/SimpleHttpService.html +3 -3
- data/doc/_index.html +2 -2
- data/doc/file.README.html +37 -39
- data/doc/index.html +37 -39
- data/doc/top-level-namespace.html +2 -2
- data/lib/simple_http_service/client.rb +10 -11
- data/lib/simple_http_service/version.rb +1 -1
- metadata +3 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8a75ddb35b5f12bc409dfba441396f9341ee708894097afe93f1477095cf27cf
|
|
4
|
+
data.tar.gz: 4feb1170c683ff594d20f27c8b970e9a17b70ecb4dc088ce4b5cb84dd72cbd46
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a80bacdcbaba0b520408918a547eb112c47cba2875a7bf4f64753d9f12287c3cb9bdb31de1890be53cc4d189c9db297dfcbdde93a929d7f6f1bf9f37ba184819
|
|
7
|
+
data.tar.gz: b8b1c7527e13face8f5f45e60ae16957585c5c3e87525618467d0c6912705b48b0406c42d2b4095a69a23d938e37682ce7fed5c446cc199c9336f97ee674a21d
|
|
@@ -468,9 +468,9 @@
|
|
|
468
468
|
<span class='ivar'>@http_method</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:http_method</span><span class='rbracket'>]</span>
|
|
469
469
|
<span class='ivar'>@headers</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:headers</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
470
470
|
<span class='ivar'>@request_body</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:request_body</span><span class='rbracket'>]</span>
|
|
471
|
-
<span class='ivar'>@open_timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:open_timeout</span><span class='rbracket'>]</span>
|
|
472
|
-
<span class='ivar'>@read_timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:read_timeout</span><span class='rbracket'>]</span>
|
|
473
|
-
<span class='ivar'>@write_timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:write_timeout</span><span class='rbracket'>]</span>
|
|
471
|
+
<span class='ivar'>@open_timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:open_timeout</span><span class='rbracket'>]</span>
|
|
472
|
+
<span class='ivar'>@read_timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:read_timeout</span><span class='rbracket'>]</span>
|
|
473
|
+
<span class='ivar'>@write_timeout</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:write_timeout</span><span class='rbracket'>]</span>
|
|
474
474
|
<span class='ivar'>@max_retries</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:max_retries</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='int'>1</span>
|
|
475
475
|
<span class='ivar'>@additional_headers</span> <span class='op'>=</span> <span class='id identifier rubyid_opts'>opts</span><span class='lbracket'>[</span><span class='symbol'>:additional_headers</span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
|
476
476
|
<span class='kw'>end</span></pre>
|
|
@@ -898,7 +898,8 @@
|
|
|
898
898
|
24
|
|
899
899
|
25
|
|
900
900
|
26
|
|
901
|
-
27
|
|
901
|
+
27
|
|
902
|
+
28</pre>
|
|
902
903
|
</td>
|
|
903
904
|
<td>
|
|
904
905
|
<pre class="code"><span class="info file"># File 'lib/simple_http_service/client.rb', line 22</span>
|
|
@@ -907,6 +908,7 @@
|
|
|
907
908
|
<span class='id identifier rubyid_enable_ssl'>enable_ssl</span>
|
|
908
909
|
<span class='id identifier rubyid_set_headers'>set_headers</span>
|
|
909
910
|
<span class='id identifier rubyid_set_timeout'>set_timeout</span>
|
|
911
|
+
<span class='id identifier rubyid_set_request_params'>set_request_params</span>
|
|
910
912
|
<span class='id identifier rubyid_http'>http</span><span class='period'>.</span><span class='id identifier rubyid_request'>request</span><span class='lparen'>(</span><span class='id identifier rubyid_request'>request</span><span class='rparen'>)</span>
|
|
911
913
|
<span class='kw'>end</span></pre>
|
|
912
914
|
</td>
|
|
@@ -919,9 +921,9 @@
|
|
|
919
921
|
</div>
|
|
920
922
|
|
|
921
923
|
<div id="footer">
|
|
922
|
-
Generated on
|
|
924
|
+
Generated on Wed Jun 24 13:55:17 2026 by
|
|
923
925
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
924
|
-
0.9.37 (ruby-3.
|
|
926
|
+
0.9.37 (ruby-3.4.2).
|
|
925
927
|
</div>
|
|
926
928
|
|
|
927
929
|
</div>
|
|
@@ -114,9 +114,9 @@
|
|
|
114
114
|
</div>
|
|
115
115
|
|
|
116
116
|
<div id="footer">
|
|
117
|
-
Generated on
|
|
117
|
+
Generated on Wed Jun 24 13:55:17 2026 by
|
|
118
118
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
119
|
-
0.9.37 (ruby-3.
|
|
119
|
+
0.9.37 (ruby-3.4.2).
|
|
120
120
|
</div>
|
|
121
121
|
|
|
122
122
|
</div>
|
data/doc/SimpleHttpService.html
CHANGED
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
<dt id="VERSION-constant" class="">VERSION =
|
|
108
108
|
|
|
109
109
|
</dt>
|
|
110
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.
|
|
110
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.2.0</span><span class='tstring_end'>"</span></span></pre></dd>
|
|
111
111
|
|
|
112
112
|
</dl>
|
|
113
113
|
|
|
@@ -192,9 +192,9 @@
|
|
|
192
192
|
</div>
|
|
193
193
|
|
|
194
194
|
<div id="footer">
|
|
195
|
-
Generated on
|
|
195
|
+
Generated on Wed Jun 24 13:55:17 2026 by
|
|
196
196
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
197
|
-
0.9.37 (ruby-3.
|
|
197
|
+
0.9.37 (ruby-3.4.2).
|
|
198
198
|
</div>
|
|
199
199
|
|
|
200
200
|
</div>
|
data/doc/_index.html
CHANGED
|
@@ -127,9 +127,9 @@
|
|
|
127
127
|
</div>
|
|
128
128
|
|
|
129
129
|
<div id="footer">
|
|
130
|
-
Generated on
|
|
130
|
+
Generated on Wed Jun 24 13:55:16 2026 by
|
|
131
131
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
132
|
-
0.9.37 (ruby-3.
|
|
132
|
+
0.9.37 (ruby-3.4.2).
|
|
133
133
|
</div>
|
|
134
134
|
|
|
135
135
|
</div>
|
data/doc/file.README.html
CHANGED
|
@@ -57,14 +57,19 @@
|
|
|
57
57
|
<div class="clear"></div>
|
|
58
58
|
</div>
|
|
59
59
|
|
|
60
|
-
<div id="content"><div id='filecontents'>
|
|
61
|
-
|
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="simplehttpservice">SimpleHttpService</h1>
|
|
61
|
+
|
|
62
|
+
<p><a href="https://badge.fury.io/rb/simple_http_service"><img src="https://badge.fury.io/rb/simple_http_service.svg?icon=si%3Arubygems" alt="Gem Version"></a>
|
|
63
|
+
<a href="https://badge.fury.io/rb/simple_http_service"><img src="https://img.shields.io/gem/dt/simple_http_service.svg" alt="Downloads"></a>
|
|
64
|
+
<a href="https://github.com/gklsan/simple_http_service/network"><img src="https://img.shields.io/github/forks/gklsan/simple_http_service.svg" alt="Github forks"></a>
|
|
65
|
+
<a href="https://github.com/gklsan/simple_http_service/stargazers"><img src="https://img.shields.io/github/stars/gklsan/simple_http_service.svg" alt="Github stars"></a>
|
|
66
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a></p>
|
|
62
67
|
|
|
63
68
|
<p>SimpleHttpService is a simple Ruby library to make HTTP requests with customizable options for headers, timeouts, and retries. It provides a convenient way to create and send HTTP requests using a clean and simple interface.</p>
|
|
64
69
|
|
|
65
|
-
<h2 id="
|
|
70
|
+
<h2 id="installation">Installation</h2>
|
|
66
71
|
|
|
67
|
-
<p>Add this line to your application
|
|
72
|
+
<p>Add this line to your application's Gemfile:</p>
|
|
68
73
|
|
|
69
74
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>simple_http_service</span><span class='tstring_end'>'</span></span>
|
|
70
75
|
</code></pre>
|
|
@@ -79,9 +84,9 @@
|
|
|
79
84
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_simple_http_service'>simple_http_service</span>
|
|
80
85
|
</code></pre>
|
|
81
86
|
|
|
82
|
-
<h2 id="
|
|
87
|
+
<h2 id="usage">Usage</h2>
|
|
83
88
|
|
|
84
|
-
<h3 id="
|
|
89
|
+
<h3 id="creating-a-client">Creating a Client</h3>
|
|
85
90
|
|
|
86
91
|
<p>You can create a new HTTP client using the SimpleHttpService.new method, which initializes an instance of SimpleHttpService::Client.</p>
|
|
87
92
|
|
|
@@ -106,7 +111,7 @@
|
|
|
106
111
|
<span class='rparen'>)</span>
|
|
107
112
|
</code></pre>
|
|
108
113
|
|
|
109
|
-
<h3 id="
|
|
114
|
+
<h3 id="making-a-request">Making a Request</h3>
|
|
110
115
|
|
|
111
116
|
<p>After creating the client, you can call the call method to make the HTTP request:</p>
|
|
112
117
|
|
|
@@ -114,30 +119,23 @@
|
|
|
114
119
|
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
|
|
115
120
|
</code></pre>
|
|
116
121
|
|
|
117
|
-
<h3 id="
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
<p
|
|
134
|
-
</li><li>
|
|
135
|
-
<p><code>additional_headers</code>: Additional headers to include in the request.</p>
|
|
136
|
-
</li></ul>
|
|
137
|
-
|
|
138
|
-
<h3 id="label-Example">Example</h3>
|
|
139
|
-
|
|
140
|
-
<p>Here’s a complete example of using <code>SimpleHttpService</code> to make a <code>GET</code> request:</p>
|
|
122
|
+
<h3 id="options">Options</h3>
|
|
123
|
+
|
|
124
|
+
<ul>
|
|
125
|
+
<li><code>url</code> (required): The URL for the HTTP request.</li>
|
|
126
|
+
<li><code>http_method</code> (required): The HTTP method to use (:get, :post, :put).</li>
|
|
127
|
+
<li><code>headers</code>: A hash of headers to include in the request.</li>
|
|
128
|
+
<li><code>open_timeout</code>: Timeout for opening the connection (default is false).</li>
|
|
129
|
+
<li><code>read_timeout</code>: Timeout for reading the response (default is false).</li>
|
|
130
|
+
<li><code>write_timeout</code>: Timeout for writing the request (default is false).</li>
|
|
131
|
+
<li><code>max_retries</code>: The number of times to retry the request in case of failure.</li>
|
|
132
|
+
<li><code>request_body</code>: The body of the request (used for POST and PUT requests).</li>
|
|
133
|
+
<li><code>additional_headers</code>: Additional headers to include in the request.</li>
|
|
134
|
+
</ul>
|
|
135
|
+
|
|
136
|
+
<h3 id="example">Example</h3>
|
|
137
|
+
|
|
138
|
+
<p>Here's a complete example of using <code>SimpleHttpService</code> to make a <code>GET</code> request:</p>
|
|
141
139
|
|
|
142
140
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>simple_http_service</span><span class='tstring_end'>'</span></span>
|
|
143
141
|
|
|
@@ -178,7 +176,7 @@
|
|
|
178
176
|
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
|
|
179
177
|
</code></pre>
|
|
180
178
|
|
|
181
|
-
<h3 id="
|
|
179
|
+
<h3 id="error-handling">Error Handling</h3>
|
|
182
180
|
|
|
183
181
|
<p>The library defines a custom error class SimpleHttpService::Error that you can use to handle exceptions:</p>
|
|
184
182
|
|
|
@@ -190,29 +188,29 @@
|
|
|
190
188
|
<span class='kw'>end</span>
|
|
191
189
|
</code></pre>
|
|
192
190
|
|
|
193
|
-
<h2 id="
|
|
191
|
+
<h2 id="development">Development</h2>
|
|
194
192
|
|
|
195
193
|
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rspec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
|
196
194
|
|
|
197
195
|
<p>To install this gem onto your local machine, run <code>bundle install</code>. To release a new version, update the version number in <code>version.rb</code>.</p>
|
|
198
196
|
|
|
199
|
-
<h2 id="
|
|
197
|
+
<h2 id="contributing">Contributing</h2>
|
|
200
198
|
|
|
201
|
-
<p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/gklsan/simple_http_service">github.com/gklsan/simple_http_service</a>.</p>
|
|
199
|
+
<p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/gklsan/simple_http_service">https://github.com/gklsan/simple_http_service</a>.</p>
|
|
202
200
|
|
|
203
|
-
<h2 id="
|
|
201
|
+
<h2 id="license">License</h2>
|
|
204
202
|
|
|
205
203
|
<p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
|
206
204
|
|
|
207
|
-
<h2 id="
|
|
205
|
+
<h2 id="code-of-conduct">Code of Conduct</h2>
|
|
208
206
|
|
|
209
207
|
<p>Everyone interacting in the SimpleHttpService project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.</p>
|
|
210
208
|
</div></div>
|
|
211
209
|
|
|
212
210
|
<div id="footer">
|
|
213
|
-
Generated on
|
|
211
|
+
Generated on Wed Jun 24 13:55:16 2026 by
|
|
214
212
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
215
|
-
0.9.37 (ruby-3.
|
|
213
|
+
0.9.37 (ruby-3.4.2).
|
|
216
214
|
</div>
|
|
217
215
|
|
|
218
216
|
</div>
|
data/doc/index.html
CHANGED
|
@@ -57,14 +57,19 @@
|
|
|
57
57
|
<div class="clear"></div>
|
|
58
58
|
</div>
|
|
59
59
|
|
|
60
|
-
<div id="content"><div id='filecontents'>
|
|
61
|
-
|
|
60
|
+
<div id="content"><div id='filecontents'><h1 id="simplehttpservice">SimpleHttpService</h1>
|
|
61
|
+
|
|
62
|
+
<p><a href="https://badge.fury.io/rb/simple_http_service"><img src="https://badge.fury.io/rb/simple_http_service.svg?icon=si%3Arubygems" alt="Gem Version"></a>
|
|
63
|
+
<a href="https://badge.fury.io/rb/simple_http_service"><img src="https://img.shields.io/gem/dt/simple_http_service.svg" alt="Downloads"></a>
|
|
64
|
+
<a href="https://github.com/gklsan/simple_http_service/network"><img src="https://img.shields.io/github/forks/gklsan/simple_http_service.svg" alt="Github forks"></a>
|
|
65
|
+
<a href="https://github.com/gklsan/simple_http_service/stargazers"><img src="https://img.shields.io/github/stars/gklsan/simple_http_service.svg" alt="Github stars"></a>
|
|
66
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a></p>
|
|
62
67
|
|
|
63
68
|
<p>SimpleHttpService is a simple Ruby library to make HTTP requests with customizable options for headers, timeouts, and retries. It provides a convenient way to create and send HTTP requests using a clean and simple interface.</p>
|
|
64
69
|
|
|
65
|
-
<h2 id="
|
|
70
|
+
<h2 id="installation">Installation</h2>
|
|
66
71
|
|
|
67
|
-
<p>Add this line to your application
|
|
72
|
+
<p>Add this line to your application's Gemfile:</p>
|
|
68
73
|
|
|
69
74
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>simple_http_service</span><span class='tstring_end'>'</span></span>
|
|
70
75
|
</code></pre>
|
|
@@ -79,9 +84,9 @@
|
|
|
79
84
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_gem'>gem</span> <span class='id identifier rubyid_install'>install</span> <span class='id identifier rubyid_simple_http_service'>simple_http_service</span>
|
|
80
85
|
</code></pre>
|
|
81
86
|
|
|
82
|
-
<h2 id="
|
|
87
|
+
<h2 id="usage">Usage</h2>
|
|
83
88
|
|
|
84
|
-
<h3 id="
|
|
89
|
+
<h3 id="creating-a-client">Creating a Client</h3>
|
|
85
90
|
|
|
86
91
|
<p>You can create a new HTTP client using the SimpleHttpService.new method, which initializes an instance of SimpleHttpService::Client.</p>
|
|
87
92
|
|
|
@@ -106,7 +111,7 @@
|
|
|
106
111
|
<span class='rparen'>)</span>
|
|
107
112
|
</code></pre>
|
|
108
113
|
|
|
109
|
-
<h3 id="
|
|
114
|
+
<h3 id="making-a-request">Making a Request</h3>
|
|
110
115
|
|
|
111
116
|
<p>After creating the client, you can call the call method to make the HTTP request:</p>
|
|
112
117
|
|
|
@@ -114,30 +119,23 @@
|
|
|
114
119
|
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
|
|
115
120
|
</code></pre>
|
|
116
121
|
|
|
117
|
-
<h3 id="
|
|
118
|
-
|
|
119
|
-
<
|
|
120
|
-
|
|
121
|
-
<
|
|
122
|
-
|
|
123
|
-
<
|
|
124
|
-
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
<
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
<p
|
|
134
|
-
</li><li>
|
|
135
|
-
<p><code>additional_headers</code>: Additional headers to include in the request.</p>
|
|
136
|
-
</li></ul>
|
|
137
|
-
|
|
138
|
-
<h3 id="label-Example">Example</h3>
|
|
139
|
-
|
|
140
|
-
<p>Here’s a complete example of using <code>SimpleHttpService</code> to make a <code>GET</code> request:</p>
|
|
122
|
+
<h3 id="options">Options</h3>
|
|
123
|
+
|
|
124
|
+
<ul>
|
|
125
|
+
<li><code>url</code> (required): The URL for the HTTP request.</li>
|
|
126
|
+
<li><code>http_method</code> (required): The HTTP method to use (:get, :post, :put).</li>
|
|
127
|
+
<li><code>headers</code>: A hash of headers to include in the request.</li>
|
|
128
|
+
<li><code>open_timeout</code>: Timeout for opening the connection (default is false).</li>
|
|
129
|
+
<li><code>read_timeout</code>: Timeout for reading the response (default is false).</li>
|
|
130
|
+
<li><code>write_timeout</code>: Timeout for writing the request (default is false).</li>
|
|
131
|
+
<li><code>max_retries</code>: The number of times to retry the request in case of failure.</li>
|
|
132
|
+
<li><code>request_body</code>: The body of the request (used for POST and PUT requests).</li>
|
|
133
|
+
<li><code>additional_headers</code>: Additional headers to include in the request.</li>
|
|
134
|
+
</ul>
|
|
135
|
+
|
|
136
|
+
<h3 id="example">Example</h3>
|
|
137
|
+
|
|
138
|
+
<p>Here's a complete example of using <code>SimpleHttpService</code> to make a <code>GET</code> request:</p>
|
|
141
139
|
|
|
142
140
|
<pre class="code ruby"><code class="ruby"><span class='id identifier rubyid_require'>require</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>simple_http_service</span><span class='tstring_end'>'</span></span>
|
|
143
141
|
|
|
@@ -178,7 +176,7 @@
|
|
|
178
176
|
<span class='id identifier rubyid_puts'>puts</span> <span class='id identifier rubyid_response'>response</span><span class='period'>.</span><span class='id identifier rubyid_body'>body</span>
|
|
179
177
|
</code></pre>
|
|
180
178
|
|
|
181
|
-
<h3 id="
|
|
179
|
+
<h3 id="error-handling">Error Handling</h3>
|
|
182
180
|
|
|
183
181
|
<p>The library defines a custom error class SimpleHttpService::Error that you can use to handle exceptions:</p>
|
|
184
182
|
|
|
@@ -190,29 +188,29 @@
|
|
|
190
188
|
<span class='kw'>end</span>
|
|
191
189
|
</code></pre>
|
|
192
190
|
|
|
193
|
-
<h2 id="
|
|
191
|
+
<h2 id="development">Development</h2>
|
|
194
192
|
|
|
195
193
|
<p>After checking out the repo, run <code>bin/setup</code> to install dependencies. Then, run <code>rspec</code> to run the tests. You can also run <code>bin/console</code> for an interactive prompt that will allow you to experiment.</p>
|
|
196
194
|
|
|
197
195
|
<p>To install this gem onto your local machine, run <code>bundle install</code>. To release a new version, update the version number in <code>version.rb</code>.</p>
|
|
198
196
|
|
|
199
|
-
<h2 id="
|
|
197
|
+
<h2 id="contributing">Contributing</h2>
|
|
200
198
|
|
|
201
|
-
<p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/gklsan/simple_http_service">github.com/gklsan/simple_http_service</a>.</p>
|
|
199
|
+
<p>Bug reports and pull requests are welcome on GitHub at <a href="https://github.com/gklsan/simple_http_service">https://github.com/gklsan/simple_http_service</a>.</p>
|
|
202
200
|
|
|
203
|
-
<h2 id="
|
|
201
|
+
<h2 id="license">License</h2>
|
|
204
202
|
|
|
205
203
|
<p>The gem is available as open source under the terms of the <a href="https://opensource.org/licenses/MIT">MIT License</a>.</p>
|
|
206
204
|
|
|
207
|
-
<h2 id="
|
|
205
|
+
<h2 id="code-of-conduct">Code of Conduct</h2>
|
|
208
206
|
|
|
209
207
|
<p>Everyone interacting in the SimpleHttpService project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.</p>
|
|
210
208
|
</div></div>
|
|
211
209
|
|
|
212
210
|
<div id="footer">
|
|
213
|
-
Generated on
|
|
211
|
+
Generated on Wed Jun 24 13:55:16 2026 by
|
|
214
212
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
215
|
-
0.9.37 (ruby-3.
|
|
213
|
+
0.9.37 (ruby-3.4.2).
|
|
216
214
|
</div>
|
|
217
215
|
|
|
218
216
|
</div>
|
|
@@ -100,9 +100,9 @@
|
|
|
100
100
|
</div>
|
|
101
101
|
|
|
102
102
|
<div id="footer">
|
|
103
|
-
Generated on
|
|
103
|
+
Generated on Wed Jun 24 13:55:16 2026 by
|
|
104
104
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
|
105
|
-
0.9.37 (ruby-3.
|
|
105
|
+
0.9.37 (ruby-3.4.2).
|
|
106
106
|
</div>
|
|
107
107
|
|
|
108
108
|
</div>
|
|
@@ -12,9 +12,9 @@ module SimpleHttpService
|
|
|
12
12
|
@http_method = opts[:http_method]
|
|
13
13
|
@headers = opts[:headers] || {}
|
|
14
14
|
@request_body = opts[:request_body]
|
|
15
|
-
@open_timeout = opts[:open_timeout]
|
|
16
|
-
@read_timeout = opts[:read_timeout]
|
|
17
|
-
@write_timeout = opts[:write_timeout]
|
|
15
|
+
@open_timeout = opts[:open_timeout]
|
|
16
|
+
@read_timeout = opts[:read_timeout]
|
|
17
|
+
@write_timeout = opts[:write_timeout]
|
|
18
18
|
@max_retries = opts[:max_retries] || 1
|
|
19
19
|
@additional_headers = opts[:additional_headers] || {}
|
|
20
20
|
end
|
|
@@ -23,6 +23,7 @@ module SimpleHttpService
|
|
|
23
23
|
enable_ssl
|
|
24
24
|
set_headers
|
|
25
25
|
set_timeout
|
|
26
|
+
set_request_params
|
|
26
27
|
http.request(request)
|
|
27
28
|
end
|
|
28
29
|
|
|
@@ -38,12 +39,11 @@ module SimpleHttpService
|
|
|
38
39
|
|
|
39
40
|
def request
|
|
40
41
|
@request ||= case http_method
|
|
41
|
-
when :post
|
|
42
|
-
|
|
43
|
-
when :
|
|
44
|
-
|
|
45
|
-
else
|
|
46
|
-
Net::HTTP::Get.new(uri)
|
|
42
|
+
when :post then Net::HTTP::Post.new(uri)
|
|
43
|
+
when :put then Net::HTTP::Put.new(uri)
|
|
44
|
+
when :patch then Net::HTTP::Patch.new(uri)
|
|
45
|
+
when :delete then Net::HTTP::Delete.new(uri)
|
|
46
|
+
else Net::HTTP::Get.new(uri)
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
@@ -51,7 +51,6 @@ module SimpleHttpService
|
|
|
51
51
|
return unless uri.scheme == 'https'
|
|
52
52
|
|
|
53
53
|
http.use_ssl = true
|
|
54
|
-
http.ssl_version = :TLSv1_2
|
|
55
54
|
end
|
|
56
55
|
|
|
57
56
|
def set_timeout
|
|
@@ -62,7 +61,7 @@ module SimpleHttpService
|
|
|
62
61
|
end
|
|
63
62
|
|
|
64
63
|
def set_request_params
|
|
65
|
-
request.body = request_body if request_body
|
|
64
|
+
request.body = request_body if request_body
|
|
66
65
|
end
|
|
67
66
|
|
|
68
67
|
def http
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: simple_http_service
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Gokul (gklsan)
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 2026-06-24 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: net-http
|
|
@@ -117,7 +116,6 @@ metadata:
|
|
|
117
116
|
changelog_uri: https://github.com/gklsan/simple_http_service/releases
|
|
118
117
|
bug_tracker_uri: https://github.com/gklsan/simple_http_service/issues
|
|
119
118
|
documentation_uri: https://rubydoc.info/github/gklsan/simple_http_service
|
|
120
|
-
post_install_message:
|
|
121
119
|
rdoc_options: []
|
|
122
120
|
require_paths:
|
|
123
121
|
- lib
|
|
@@ -132,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
132
130
|
- !ruby/object:Gem::Version
|
|
133
131
|
version: '0'
|
|
134
132
|
requirements: []
|
|
135
|
-
rubygems_version: 3.
|
|
136
|
-
signing_key:
|
|
133
|
+
rubygems_version: 3.6.6
|
|
137
134
|
specification_version: 4
|
|
138
135
|
summary: SimpleHttpService is a simple Ruby library to make HTTP requests with customizable
|
|
139
136
|
options for headers, timeouts, and retries. It provides a convenient way to create
|