httpigeon 2.3.0 → 2.3.2

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: 687076ba8fc193d290ae5bc527269a48e8f7a407e6c8f47007c1408a42a9c604
4
- data.tar.gz: 1440197153f6fab85582117e97436694ff086df7b22c3c636ddec88f1cfa168b
3
+ metadata.gz: 2e3bd2f3ebb052aef6119e86ec9674f35f1911bb84ec7364a9824b7eb2949778
4
+ data.tar.gz: 5de39fb7884ec828b7d3c8cec04f6db9bbb45fb92eda41c199bacf95f1d1b7af
5
5
  SHA512:
6
- metadata.gz: ee09ec237262bbca31f0c834fb64856cffd5624cff5ac6153e96e31bef75ac307376cb1dc7be4ca90bf9136cb6d200025e3c965d48e3b005ab54965c5644a344
7
- data.tar.gz: 8c584ec73859acfb7b8673e685a0721fd71fd305dbd3076a93dc9c633f0a716d3652c49ee828e6b7a81ea4ea83538b44f19b169b38ef56c0f510ab74a4e91096
6
+ metadata.gz: db8c4a98307aad75072babc2e895bb77b1e316c1c445ee0cc7cb0253a107279fec373319af05ef4f0b3c3ac8fb9f3d4e34881530b6da44ad691e61968eb6b4d2
7
+ data.tar.gz: '099de00614d03209354863f72b3839c8760bbba5f0ace4e604b4c54000a18f2b97d21a6c9f6c7d36604b14675282c9de53300ae870ff5294962878890f23c3c5'
@@ -25,5 +25,5 @@ jobs:
25
25
  - name: Auto Commit
26
26
  uses: stefanzweifel/git-auto-commit-action@v5
27
27
  with:
28
- commit_message: Rubocop Auto Corrections
28
+ commit_message: chore: Rubocop Auto Corrections
29
29
  commit_user_name: Rubocop
data/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.3.2](https://github.com/dailypay/httpigeon/compare/v2.3.1...v2.3.2) (2024-11-14)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **UNTICKETED:** Dont parse pdf as json ([#44](https://github.com/dailypay/httpigeon/issues/44)) ([fd4c13c](https://github.com/dailypay/httpigeon/commit/fd4c13cbb6c8084aa054c2daa756ace651e1338b))
9
+
10
+ ## [2.3.1](https://github.com/dailypay/httpigeon/compare/v2.3.0...v2.3.1) (2024-07-11)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * Execute block within scope ([#42](https://github.com/dailypay/httpigeon/issues/42)) ([a9a43c3](https://github.com/dailypay/httpigeon/commit/a9a43c391b449b3316812e1c99fb88e25c923b31))
16
+
3
17
  ## [2.3.0](https://github.com/dailypay/httpigeon/compare/v2.2.0...v2.3.0) (2024-07-11)
4
18
 
5
19
 
@@ -38,9 +38,9 @@ module HTTPigeon
38
38
  end
39
39
  end
40
40
 
41
- attr_reader :connection, :response, :parsed_response, :base_url, :fuse
41
+ attr_reader :connection, :response, :base_url, :fuse
42
42
 
43
- delegate :status, :body, to: :response, prefix: true
43
+ delegate :status, :body, :parsed_response, to: :response, prefix: true
44
44
 
45
45
  def initialize(base_url:, options: nil, headers: nil, adapter: nil, logger: nil, event_type: nil, log_filters: nil, fuse_config: nil)
46
46
  @base_url = URI.parse(base_url)
@@ -77,7 +77,17 @@ module HTTPigeon
77
77
 
78
78
  connection.headers[REQUEST_ID_HEADER] = SecureRandom.uuid if HTTPigeon.auto_generate_request_id
79
79
 
80
- raw_response = HTTPigeon.mount_circuit_breaker ? run_with_fuse(method, path, payload) : simple_run(method, path, payload)
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
81
91
 
82
92
  @response = HTTPigeon::Response.new(self, raw_response)
83
93
  end
@@ -93,19 +103,5 @@ module HTTPigeon
93
103
  def default_headers
94
104
  { 'Accept' => 'application/json' }
95
105
  end
96
-
97
- def simple_run(method, path, payload)
98
- connection.send(method, path, payload) do |request|
99
- yield(request) if block_given?
100
- end
101
- end
102
-
103
- def run_with_fuse(method, path, payload)
104
- fuse.execute(request_id: connection.headers[REQUEST_ID_HEADER]) do
105
- simple_run(method, path, payload) do |request|
106
- yield(request) if block_given?
107
- end
108
- end
109
- end
110
106
  end
111
107
  end
@@ -5,7 +5,7 @@ module HTTPigeon
5
5
  attr_reader :request, :parsed_response, :raw_response
6
6
 
7
7
  delegate :each, :to_h, :to_json, :with_indifferent_access, to: :parsed_response
8
- delegate :status, :body, :env, to: :raw_response
8
+ delegate :status, :body, :env, :headers, to: :raw_response
9
9
 
10
10
  def initialize(request, raw_response)
11
11
  @request = request
@@ -25,7 +25,8 @@ module HTTPigeon
25
25
  private
26
26
 
27
27
  def parse_response
28
- parsed_body = body.is_a?(String) ? JSON.parse(body) : body
28
+ parsable_content_type = headers.blank? || headers['content-type'].blank? || headers['content-type'].include?('application/json')
29
+ parsed_body = body.is_a?(String) && parsable_content_type ? JSON.parse(body) : body
29
30
  @parsed_response = deep_with_indifferent_access(parsed_body)
30
31
  rescue JSON::ParserError
31
32
  @parsed_response = body.presence || {}
@@ -1,3 +1,3 @@
1
1
  module HTTPigeon
2
- VERSION = "2.3.0".freeze
2
+ VERSION = "2.3.2".freeze
3
3
  end
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.3.0
4
+ version: 2.3.2
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-07-11 00:00:00.000000000 Z
11
+ date: 2024-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday