httpigeon 2.2.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +20 -0
- data/httpigeon.gemspec +2 -2
- data/lib/httpigeon/request.rb +28 -18
- data/lib/httpigeon/response.rb +3 -1
- data/lib/httpigeon/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16ce49310907bd1fa04c88e931ece4ef802242cd02de04902f8e46c5fe1abf70
|
4
|
+
data.tar.gz: d556922db92044afa1b0f27ab8711319e5475c9e9ea2248139b4b58d5d120f42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3f59f055d2c4d7f9f27008bbf61b80eb2479fb4c2d9e7f723954bdbe334d01a926a06800b613fabac69de0057d08e4c7144f17b1c10098130f8befa7826fb35
|
7
|
+
data.tar.gz: 8ae56db04ef5262ac0f606ee349f0e8c1807d2ff8209f526e6e5677a0d18d96f479aaf55c49e97f0368251dfa01f84c64809bc834fc89a96128c7f920fda350b
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [2.3.1](https://github.com/dailypay/httpigeon/compare/v2.3.0...v2.3.1) (2024-07-11)
|
4
|
+
|
5
|
+
|
6
|
+
### Bug Fixes
|
7
|
+
|
8
|
+
* Execute block within scope ([#42](https://github.com/dailypay/httpigeon/issues/42)) ([a9a43c3](https://github.com/dailypay/httpigeon/commit/a9a43c391b449b3316812e1c99fb88e25c923b31))
|
9
|
+
|
10
|
+
## [2.3.0](https://github.com/dailypay/httpigeon/compare/v2.2.0...v2.3.0) (2024-07-11)
|
11
|
+
|
12
|
+
|
13
|
+
### Features
|
14
|
+
|
15
|
+
* add and fix put and delete methods ([#41](https://github.com/dailypay/httpigeon/issues/41)) ([1d9e9b0](https://github.com/dailypay/httpigeon/commit/1d9e9b0585d56c9785efa97e5a743cdcbd179884))
|
16
|
+
* Use enumarable for collection delegation ([8fc143a](https://github.com/dailypay/httpigeon/commit/8fc143a8717aebdd072bd48dceccc34a318657b7))
|
17
|
+
|
18
|
+
|
19
|
+
### Bug Fixes
|
20
|
+
|
21
|
+
* Delegate :map to parsed response ([#39](https://github.com/dailypay/httpigeon/issues/39)) ([59b77e8](https://github.com/dailypay/httpigeon/commit/59b77e821a1356884cb7c426fe433229aa1bdfcc))
|
22
|
+
|
3
23
|
## [2.2.0](https://github.com/dailypay/httpigeon/compare/v2.1.0...v2.2.0) (2024-05-17)
|
4
24
|
|
5
25
|
|
data/httpigeon.gemspec
CHANGED
@@ -33,8 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
spec.add_development_dependency "rake", "~> 13.0"
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.4"
|
35
35
|
spec.add_development_dependency "simplecov"
|
36
|
-
spec.add_development_dependency "rubocop", "~> 1.
|
37
|
-
spec.add_development_dependency "rubocop-rspec", "~>
|
36
|
+
spec.add_development_dependency "rubocop", "~> 1.65"
|
37
|
+
spec.add_development_dependency "rubocop-rspec", "~> 3.0"
|
38
38
|
spec.add_development_dependency "pry", "~> 0.13.1"
|
39
39
|
spec.add_development_dependency "timecop", "~> 0.9.8"
|
40
40
|
|
data/lib/httpigeon/request.rb
CHANGED
@@ -22,11 +22,25 @@ module HTTPigeon
|
|
22
22
|
yield(req) if block_given?
|
23
23
|
end
|
24
24
|
end
|
25
|
+
|
26
|
+
def put(endpoint, payload, headers = {}, event_type = nil, log_filters = [])
|
27
|
+
request = new(base_url: endpoint, headers: headers, event_type: event_type, log_filters: log_filters)
|
28
|
+
request.run(method: :put, path: '', payload: payload) do |req|
|
29
|
+
yield(req) if block_given?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def delete(endpoint, query = {}, headers = {}, event_type = nil, log_filters = [])
|
34
|
+
request = new(base_url: endpoint, headers: headers, event_type: event_type, log_filters: log_filters)
|
35
|
+
request.run(method: :delete, path: '', payload: query) do |req|
|
36
|
+
yield(req) if block_given?
|
37
|
+
end
|
38
|
+
end
|
25
39
|
end
|
26
40
|
|
27
|
-
attr_reader :connection, :response, :
|
41
|
+
attr_reader :connection, :response, :base_url, :fuse
|
28
42
|
|
29
|
-
delegate :status, :body, to: :response, prefix: true
|
43
|
+
delegate :status, :body, :parsed_response, to: :response, prefix: true
|
30
44
|
|
31
45
|
def initialize(base_url:, options: nil, headers: nil, adapter: nil, logger: nil, event_type: nil, log_filters: nil, fuse_config: nil)
|
32
46
|
@base_url = URI.parse(base_url)
|
@@ -56,14 +70,24 @@ module HTTPigeon
|
|
56
70
|
end
|
57
71
|
|
58
72
|
def run(method: :get, path: '/', payload: {})
|
59
|
-
unless method.to_sym == :get
|
73
|
+
unless method.to_sym == :get || method.to_sym == :delete
|
60
74
|
payload = payload.presence&.to_json
|
61
75
|
connection.headers['Content-Type'] = 'application/json'
|
62
76
|
end
|
63
77
|
|
64
78
|
connection.headers[REQUEST_ID_HEADER] = SecureRandom.uuid if HTTPigeon.auto_generate_request_id
|
65
79
|
|
66
|
-
raw_response = HTTPigeon.mount_circuit_breaker
|
80
|
+
raw_response = if HTTPigeon.mount_circuit_breaker
|
81
|
+
fuse.execute(request_id: connection.headers[REQUEST_ID_HEADER]) do
|
82
|
+
connection.send(method, path, payload) do |request|
|
83
|
+
yield(request) if block_given?
|
84
|
+
end
|
85
|
+
end
|
86
|
+
else
|
87
|
+
connection.send(method, path, payload) do |request|
|
88
|
+
yield(request) if block_given?
|
89
|
+
end
|
90
|
+
end
|
67
91
|
|
68
92
|
@response = HTTPigeon::Response.new(self, raw_response)
|
69
93
|
end
|
@@ -79,19 +103,5 @@ module HTTPigeon
|
|
79
103
|
def default_headers
|
80
104
|
{ 'Accept' => 'application/json' }
|
81
105
|
end
|
82
|
-
|
83
|
-
def simple_run(method, path, payload)
|
84
|
-
connection.send(method, path, payload) do |request|
|
85
|
-
yield(request) if block_given?
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def run_with_fuse(method, path, payload)
|
90
|
-
fuse.execute(request_id: connection.headers[REQUEST_ID_HEADER]) do
|
91
|
-
simple_run(method, path, payload) do |request|
|
92
|
-
yield(request) if block_given?
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
96
106
|
end
|
97
107
|
end
|
data/lib/httpigeon/response.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
module HTTPigeon
|
2
2
|
class Response
|
3
|
+
include Enumerable
|
4
|
+
|
3
5
|
attr_reader :request, :parsed_response, :raw_response
|
4
6
|
|
5
|
-
delegate :to_h, :to_json, :with_indifferent_access, to: :parsed_response
|
7
|
+
delegate :each, :to_h, :to_json, :with_indifferent_access, to: :parsed_response
|
6
8
|
delegate :status, :body, :env, to: :raw_response
|
7
9
|
|
8
10
|
def initialize(request, raw_response)
|
data/lib/httpigeon/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpigeon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 2k-joker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '1.
|
89
|
+
version: '1.65'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '1.
|
96
|
+
version: '1.65'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rubocop-rspec
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '3.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '3.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|