simple_http_service 0.1.2 → 0.1.3
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/README.md +3 -3
- data/lib/simple_http_service/client.rb +3 -2
- data/lib/simple_http_service/version.rb +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfcba7034450ba90242f97e6ab4feb699023261ed51e13faf91d63e666d7eb28
|
4
|
+
data.tar.gz: 6711378a9469e4445aa34973f6ff837732380ac0b1a952fd52974ed3e54783af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98a916ddc808ff5b7601a153c7037d2c67578b4e1e78bc3be81c8ae97b027fdebf82a375420eb74dad473b8fe0a68cbb9fb811e13936aa4b588ea46030377f7f
|
7
|
+
data.tar.gz: 8e208212d8166c177a3e66ac421723895067a8f7de5ba97360fc163aaf01598fc40d2e43b23ab7b2eee88c5820bef0ad3de5040e893b9c1afc47c814e842421f
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# SimpleHttpService
|
1
|
+
# SimpleHttpService [](https://badge.fury.io/rb/simple_http_service)
|
2
2
|
|
3
3
|
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
4
|
|
@@ -36,7 +36,7 @@ client = SimpleHttpService.new(
|
|
36
36
|
open_timeout: 5,
|
37
37
|
read_timeout: 10,
|
38
38
|
write_timeout: 5,
|
39
|
-
|
39
|
+
max_retries: 3
|
40
40
|
)
|
41
41
|
```
|
42
42
|
### Making a Request
|
@@ -53,7 +53,7 @@ puts response.body
|
|
53
53
|
- `open_timeout`: Timeout for opening the connection (default is false).
|
54
54
|
- `read_timeout`: Timeout for reading the response (default is false).
|
55
55
|
- `write_timeout`: Timeout for writing the request (default is false).
|
56
|
-
- `
|
56
|
+
- `max_retries`: The number of times to retry the request in case of failure.
|
57
57
|
- `request_body`: The body of the request (used for POST and PUT requests).
|
58
58
|
|
59
59
|
### Example
|
@@ -2,7 +2,7 @@ require 'net/http'
|
|
2
2
|
module SimpleHttpService
|
3
3
|
class Client
|
4
4
|
attr_accessor :uri, :headers, :http_method, :open_timeout, :read_timeout, :write_timeout,
|
5
|
-
:
|
5
|
+
:max_retries, :request_body
|
6
6
|
|
7
7
|
def initialize(opts)
|
8
8
|
raise 'URL must be present' unless opts[:url]
|
@@ -15,7 +15,7 @@ module SimpleHttpService
|
|
15
15
|
@open_timeout = opts[:open_timeout] || false
|
16
16
|
@read_timeout = opts[:read_timeout] || false
|
17
17
|
@write_timeout = opts[:write_timeout] || false
|
18
|
-
@
|
18
|
+
@max_retries = opts[:max_retries] || 1
|
19
19
|
end
|
20
20
|
|
21
21
|
def call
|
@@ -56,6 +56,7 @@ module SimpleHttpService
|
|
56
56
|
http.open_timeout = open_timeout if open_timeout
|
57
57
|
http.read_timeout = read_timeout if read_timeout
|
58
58
|
http.write_timeout = write_timeout if write_timeout
|
59
|
+
http.max_retries = max_retries if max_retries
|
59
60
|
end
|
60
61
|
|
61
62
|
def set_request_params
|
metadata
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_http_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gokul (gklsan)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: net-http
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: 0.4.1
|
19
|
+
name: net-http
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -25,12 +25,12 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.4.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - "~>"
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: 2.5.10
|
33
|
+
name: bundler
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -39,12 +39,12 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 2.5.10
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: rake
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '10.0'
|
47
|
+
name: rake
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -53,12 +53,12 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
58
|
- - "~>"
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '3.0'
|
61
|
+
name: rspec
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -110,7 +110,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
|
-
rubygems_version: 3.
|
113
|
+
rubygems_version: 3.3.26
|
114
114
|
signing_key:
|
115
115
|
specification_version: 4
|
116
116
|
summary: Welcome to SimpleHttpService gem
|