simple_http_service 0.1.6 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f921a86bf463f0007a05b8e0bf295ba99e2bb3c49a887975c8eb4c32309cc33e
4
- data.tar.gz: 1c828b59b5396cad7aa35e0a6e9e82736be1cec54c0452b59283fed0bde65909
3
+ metadata.gz: 8a75ddb35b5f12bc409dfba441396f9341ee708894097afe93f1477095cf27cf
4
+ data.tar.gz: 4feb1170c683ff594d20f27c8b970e9a17b70ecb4dc088ce4b5cb84dd72cbd46
5
5
  SHA512:
6
- metadata.gz: 9efa7e23447c5ae02c55fc3e2f6a328c161884849ca2d11a4a5255e14b3f796308e18625ec20b72533f7f7efb96fe6db011d2fa8b932e6fe3fd8529ee9571e3d
7
- data.tar.gz: 77afedbc28b2a36a01d4c99c7fbd980048d0fd643448926cf34d0246b881010c5973cfc31101c99be2e87392efdc132cb4cfb529fe731e1616b4bd8b04521cfe
6
+ metadata.gz: a80bacdcbaba0b520408918a547eb112c47cba2875a7bf4f64753d9f12287c3cb9bdb31de1890be53cc4d189c9db297dfcbdde93a929d7f6f1bf9f37ba184819
7
+ data.tar.gz: b8b1c7527e13face8f5f45e60ae16957585c5c3e87525618467d0c6912705b48b0406c42d2b4095a69a23d938e37682ce7fed5c446cc199c9336f97ee674a21d
@@ -0,0 +1,48 @@
1
+ name: Ruby Gem
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ jobs:
10
+ build:
11
+ name: Build + Publish
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: read
15
+ packages: write
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - name: Set up Ruby 3.0.0
20
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
21
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
22
+ # uses: ruby/setup-ruby@v1
23
+ uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
24
+ with:
25
+ ruby-version: 3.0.0
26
+
27
+ - name: Publish to GPR
28
+ run: |
29
+ mkdir -p $HOME/.gem
30
+ touch $HOME/.gem/credentials
31
+ chmod 0600 $HOME/.gem/credentials
32
+ printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33
+ gem build *.gemspec
34
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
35
+ env:
36
+ GEM_HOST_API_KEY: "Bearer ${{secrets.GITHUB_TOKEN}}"
37
+ OWNER: ${{ github.repository_owner }}
38
+
39
+ - name: Publish to RubyGems
40
+ run: |
41
+ mkdir -p $HOME/.gem
42
+ touch $HOME/.gem/credentials
43
+ chmod 0600 $HOME/.gem/credentials
44
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
45
+ gem build *.gemspec
46
+ gem push *.gem
47
+ env:
48
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_http_service (0.1.4)
4
+ simple_http_service (0.1.7)
5
5
  net-http (~> 0.4.1)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,4 +1,10 @@
1
- # SimpleHttpService [![Gem Version](https://badge.fury.io/rb/simple_http_service.svg)](https://badge.fury.io/rb/simple_http_service)
1
+ # SimpleHttpService
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/simple_http_service.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/simple_http_service)
4
+ [![Downloads](https://img.shields.io/gem/dt/simple_http_service.svg)](https://badge.fury.io/rb/simple_http_service)
5
+ [![Github forks](https://img.shields.io/github/forks/gklsan/simple_http_service.svg)](https://github.com/gklsan/simple_http_service/network)
6
+ [![Github stars](https://img.shields.io/github/stars/gklsan/simple_http_service.svg)](https://github.com/gklsan/simple_http_service/stargazers)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
8
 
3
9
  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.
4
10
 
@@ -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> <span class='op'>||</span> <span class='kw'>false</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> <span class='op'>||</span> <span class='kw'>false</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> <span class='op'>||</span> <span class='kw'>false</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</pre>
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 Sun Jan 19 17:15:39 2025 by
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.2.2).
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 Sun Jan 19 17:15:39 2025 by
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.2.2).
119
+ 0.9.37 (ruby-3.4.2).
120
120
  </div>
121
121
 
122
122
  </div>
@@ -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'>&quot;</span><span class='tstring_content'>0.1.4</span><span class='tstring_end'>&quot;</span></span></pre></dd>
110
+ <dd><pre class="code"><span class='tstring'><span class='tstring_beg'>&quot;</span><span class='tstring_content'>0.2.0</span><span class='tstring_end'>&quot;</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 Sun Jan 19 17:15:39 2025 by
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.2.2).
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 Sun Jan 19 17:15:38 2025 by
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.2.2).
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
- <h1 id="label-SimpleHttpService+rdoc-image-3Ahttps-3A-2F-2Fbadge.fury.io-2Frb-2Fsimple_http_service.svg">SimpleHttpService <a href="https://badge.fury.io/rb/simple_http_service"><img src="https://badge.fury.io/rb/simple_http_service.svg"></a></h1>
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="label-Installation">Installation</h2>
70
+ <h2 id="installation">Installation</h2>
66
71
 
67
- <p>Add this line to your applications Gemfile:</p>
72
+ <p>Add this line to your application&#39;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'>&#39;</span><span class='tstring_content'>simple_http_service</span><span class='tstring_end'>&#39;</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="label-Usage">Usage</h2>
87
+ <h2 id="usage">Usage</h2>
83
88
 
84
- <h3 id="label-Creating+a+Client">Creating a Client</h3>
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="label-Making+a+Request">Making a Request</h3>
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="label-Options">Options</h3>
118
- <ul><li>
119
- <p><code>url</code> (required): The URL for the HTTP request.</p>
120
- </li><li>
121
- <p><code>http_method</code> (required): The HTTP method to use (:get, :post, :put).</p>
122
- </li><li>
123
- <p><code>headers</code>: A hash of headers to include in the request.</p>
124
- </li><li>
125
- <p><code>open_timeout</code>: Timeout for opening the connection (default is false).</p>
126
- </li><li>
127
- <p><code>read_timeout</code>: Timeout for reading the response (default is false).</p>
128
- </li><li>
129
- <p><code>write_timeout</code>: Timeout for writing the request (default is false).</p>
130
- </li><li>
131
- <p><code>max_retries</code>: The number of times to retry the request in case of failure.</p>
132
- </li><li>
133
- <p><code>request_body</code>: The body of the request (used for POST and PUT requests).</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&#39;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'>&#39;</span><span class='tstring_content'>simple_http_service</span><span class='tstring_end'>&#39;</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="label-Error+Handling">Error Handling</h3>
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="label-Development">Development</h2>
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="label-Contributing">Contributing</h2>
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="label-License">License</h2>
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="label-Code+of+Conduct">Code of Conduct</h2>
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 Sun Jan 19 17:15:39 2025 by
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.2.2).
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
- <h1 id="label-SimpleHttpService+rdoc-image-3Ahttps-3A-2F-2Fbadge.fury.io-2Frb-2Fsimple_http_service.svg">SimpleHttpService <a href="https://badge.fury.io/rb/simple_http_service"><img src="https://badge.fury.io/rb/simple_http_service.svg"></a></h1>
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="label-Installation">Installation</h2>
70
+ <h2 id="installation">Installation</h2>
66
71
 
67
- <p>Add this line to your applications Gemfile:</p>
72
+ <p>Add this line to your application&#39;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'>&#39;</span><span class='tstring_content'>simple_http_service</span><span class='tstring_end'>&#39;</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="label-Usage">Usage</h2>
87
+ <h2 id="usage">Usage</h2>
83
88
 
84
- <h3 id="label-Creating+a+Client">Creating a Client</h3>
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="label-Making+a+Request">Making a Request</h3>
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="label-Options">Options</h3>
118
- <ul><li>
119
- <p><code>url</code> (required): The URL for the HTTP request.</p>
120
- </li><li>
121
- <p><code>http_method</code> (required): The HTTP method to use (:get, :post, :put).</p>
122
- </li><li>
123
- <p><code>headers</code>: A hash of headers to include in the request.</p>
124
- </li><li>
125
- <p><code>open_timeout</code>: Timeout for opening the connection (default is false).</p>
126
- </li><li>
127
- <p><code>read_timeout</code>: Timeout for reading the response (default is false).</p>
128
- </li><li>
129
- <p><code>write_timeout</code>: Timeout for writing the request (default is false).</p>
130
- </li><li>
131
- <p><code>max_retries</code>: The number of times to retry the request in case of failure.</p>
132
- </li><li>
133
- <p><code>request_body</code>: The body of the request (used for POST and PUT requests).</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&#39;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'>&#39;</span><span class='tstring_content'>simple_http_service</span><span class='tstring_end'>&#39;</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="label-Error+Handling">Error Handling</h3>
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="label-Development">Development</h2>
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="label-Contributing">Contributing</h2>
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="label-License">License</h2>
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="label-Code+of+Conduct">Code of Conduct</h2>
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 Sun Jan 19 17:15:39 2025 by
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.2.2).
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 Sun Jan 19 17:15:39 2025 by
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.2.2).
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] || false
16
- @read_timeout = opts[:read_timeout] || false
17
- @write_timeout = opts[:write_timeout] || false
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
- Net::HTTP::Post.new(uri)
43
- when :put
44
- Net::HTTP::Put.new(uri)
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.present?
64
+ request.body = request_body if request_body
66
65
  end
67
66
 
68
67
  def http
@@ -1,3 +1,3 @@
1
1
  module SimpleHttpService
2
- VERSION = "0.1.6"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -30,6 +30,7 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  # Specify which files should be added to the gem when it is released.
32
32
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
33
+ gemspec = File.basename(__FILE__)
33
34
  spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
34
35
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
35
36
  end
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.1.6
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: 2025-01-31 00:00:00.000000000 Z
10
+ date: 2026-06-24 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: net-http
@@ -75,6 +74,7 @@ executables: []
75
74
  extensions: []
76
75
  extra_rdoc_files: []
77
76
  files:
77
+ - ".github/workflows/gem-push.yml"
78
78
  - ".gitignore"
79
79
  - ".rspec"
80
80
  - ".travis.yml"
@@ -116,7 +116,6 @@ metadata:
116
116
  changelog_uri: https://github.com/gklsan/simple_http_service/releases
117
117
  bug_tracker_uri: https://github.com/gklsan/simple_http_service/issues
118
118
  documentation_uri: https://rubydoc.info/github/gklsan/simple_http_service
119
- post_install_message:
120
119
  rdoc_options: []
121
120
  require_paths:
122
121
  - lib
@@ -131,8 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
130
  - !ruby/object:Gem::Version
132
131
  version: '0'
133
132
  requirements: []
134
- rubygems_version: 3.0.3.1
135
- signing_key:
133
+ rubygems_version: 3.6.6
136
134
  specification_version: 4
137
135
  summary: SimpleHttpService is a simple Ruby library to make HTTP requests with customizable
138
136
  options for headers, timeouts, and retries. It provides a convenient way to create