simple_http_service 0.1.3.2 → 0.1.4

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: 5c214f1f938b020e80596d7c6e2eba2828a18f42d5b5b5ad77ffa740aaf52551
4
- data.tar.gz: ca43b01ce18f3d49ca3f56611c055c301f34d15cd4daa54f74933961a7ffcc0b
3
+ metadata.gz: 4a7cacecc2f74fb10cca4e1e81ea85b7f9be79e9a29a0b2f69c9537f59edee67
4
+ data.tar.gz: 9cb52d7b309240c1dc1ffd64e418aa43d0cc921ef8854cf29c56fbc6a11e3ec4
5
5
  SHA512:
6
- metadata.gz: 4feb2bceb9c102b867aa43056848944b3aed74cf106e31477a1c79de1d7af57789e690509846cfcd877407a2bbac91613c4c3255d16aea76a695b04bc2183c20
7
- data.tar.gz: 1686c396f063a1acb598ac08326394a1a6e74bebb970f396386786de043b8e9a7bc4668fadd22f3979f637778e3c618b33be0a904fb7419f464a54badfa60255
6
+ metadata.gz: a51c95a10ba42fa9a341eab638741fa754359cb89f6bf0171aadf31a936eeb0f2aa5555a61d87d739e7f175c393e5f287cdf94dda297dc722fb7df2a10a35525
7
+ data.tar.gz: 6268ec45c654b35644cff5947f4948aa545332ffeb7e8d9af6186523215ab277e3e55efd9ba0c5be3caef7e591a59be2b0ec4aa4ad441677397c5adc3b632864
data/Gemfile CHANGED
@@ -4,3 +4,9 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in simple_http_service.gemspec
6
6
  gemspec
7
+
8
+
9
+ group :development, :test do
10
+ gem 'rspec', '~> 3.13.0'
11
+ gem 'rspec-core', '~> 3.13.1'
12
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_http_service (0.1.2)
4
+ simple_http_service (0.1.4)
5
5
  net-http (~> 0.4.1)
6
6
 
7
7
  GEM
@@ -15,7 +15,7 @@ GEM
15
15
  rspec-core (~> 3.13.0)
16
16
  rspec-expectations (~> 3.13.0)
17
17
  rspec-mocks (~> 3.13.0)
18
- rspec-core (3.13.0)
18
+ rspec-core (3.13.2)
19
19
  rspec-support (~> 3.13.0)
20
20
  rspec-expectations (3.13.0)
21
21
  diff-lcs (>= 1.2.0, < 2.0)
@@ -24,7 +24,7 @@ GEM
24
24
  diff-lcs (>= 1.2.0, < 2.0)
25
25
  rspec-support (~> 3.13.0)
26
26
  rspec-support (3.13.1)
27
- uri (0.12.0)
27
+ uri (0.12.1)
28
28
 
29
29
  PLATFORMS
30
30
  ruby
@@ -32,7 +32,8 @@ PLATFORMS
32
32
  DEPENDENCIES
33
33
  bundler (~> 2.5.10)
34
34
  rake (~> 10.0)
35
- rspec (~> 3.0)
35
+ rspec (~> 3.13.0)
36
+ rspec-core (~> 3.13.1)
36
37
  simple_http_service!
37
38
 
38
39
  BUNDLED WITH
data/README.md CHANGED
@@ -36,7 +36,10 @@ client = SimpleHttpService.new(
36
36
  open_timeout: 5,
37
37
  read_timeout: 10,
38
38
  write_timeout: 5,
39
- max_retries: 3
39
+ max_retries: 3,
40
+ additional_headers: {
41
+ 'X-Request-Id': '12345'
42
+ }
40
43
  )
41
44
  ```
42
45
  ### Making a Request
@@ -55,6 +58,7 @@ puts response.body
55
58
  - `write_timeout`: Timeout for writing the request (default is false).
56
59
  - `max_retries`: The number of times to retry the request in case of failure.
57
60
  - `request_body`: The body of the request (used for POST and PUT requests).
61
+ - `additional_headers`: Additional headers to include in the request.
58
62
 
59
63
  ### Example
60
64
  Here's a complete example of using `SimpleHttpService` to make a `GET` request:
@@ -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
- :max_retries, :request_body
5
+ :max_retries, :request_body, :additional_headers
6
6
 
7
7
  def initialize(opts)
8
8
  raise 'URL must be present' unless opts[:url]
@@ -16,6 +16,7 @@ module SimpleHttpService
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
+ @additional_headers = opts[:additional_headers] || {}
19
20
  end
20
21
 
21
22
  def call
@@ -32,6 +33,7 @@ module SimpleHttpService
32
33
  request["Authorization"] = headers[:authorization] if headers[:authorization]
33
34
  request["Content-Type"] = headers[:content_type] if headers[:content_type]
34
35
  request["Cookie"] = headers[:cookie] if headers[:cookie]
36
+ additional_headers.each {|key, value| request[key] = value } if additional_headers
35
37
  end
36
38
 
37
39
  def request
@@ -1,3 +1,3 @@
1
1
  module SimpleHttpService
2
- VERSION = "0.1.3.2"
2
+ VERSION = "0.1.4"
3
3
  end
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.3.2
4
+ version: 0.1.4
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-07-13 00:00:00.000000000 Z
11
+ date: 2024-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
+ name: net-http
14
15
  requirement: !ruby/object:Gem::Requirement
15
16
  requirements:
16
17
  - - "~>"
17
18
  - !ruby/object:Gem::Version
18
19
  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
28
29
  requirement: !ruby/object:Gem::Requirement
29
30
  requirements:
30
31
  - - "~>"
31
32
  - !ruby/object:Gem::Version
32
33
  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
42
43
  requirement: !ruby/object:Gem::Requirement
43
44
  requirements:
44
45
  - - "~>"
45
46
  - !ruby/object:Gem::Version
46
47
  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
56
57
  requirement: !ruby/object:Gem::Requirement
57
58
  requirements:
58
59
  - - "~>"
59
60
  - !ruby/object:Gem::Version
60
61
  version: '3.0'
61
- name: rspec
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.3.26
115
+ rubygems_version: 3.4.10
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: SimpleHttpService is a simple Ruby library to make HTTP requests with customizable