chargebee 2.63.0 → 2.64.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 +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile.lock +1 -1
- data/chargebee.gemspec +3 -3
- data/lib/chargebee/errors.rb +2 -0
- data/lib/chargebee/{nativeRequest.rb → native_request.rb} +15 -8
- data/lib/chargebee.rb +2 -2
- data/spec/chargebee/native_request_spec.rb +13 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: fe14c7cb3dc2b603cd7c604c383759913f023c9a7ea6a35c9a1ce4856f4525ce
|
|
4
|
+
data.tar.gz: 4e6d015e8e33c469f4a389be822ca917ebc2075fccc63b7c1ff6591190716b7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4c935501f85f6a9ec2e3927df5c7e89b28039825a2e12c8434a38266f47bc0447474bb6392f2ec6b37406c7e893f2324a98ab0843e81b182d321a60dfa148fb
|
|
7
|
+
data.tar.gz: c6a285b0be75c689686eef529c6ae9b0447ecc1958341e8a9aa5a232ee45c648016d9a8ca71b08a0bc4994adf8b1e62af4cf79bda03c5286317c04717823f3ce
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
### v2.64.0 (2025-11-10)
|
|
2
|
+
* * *
|
|
3
|
+
|
|
4
|
+
### Error Handling
|
|
5
|
+
- Added new `ForbiddenError` class that inherits from `Error`
|
|
6
|
+
- Enhanced `handle_for_error` method to detect and handle 403 status codes
|
|
7
|
+
- Provides clear error message: "Access forbidden. You do not have permission to access this resource."
|
|
8
|
+
|
|
9
|
+
### Code Quality Improvements
|
|
10
|
+
- Renamed `lib/chargebee/nativeRequest.rb` → `lib/chargebee/native_request.rb` to follow Ruby naming conventions
|
|
11
|
+
- Refactored `handle_for_error` to return error objects instead of raising them inline (cleaner separation of concerns)
|
|
12
|
+
- Added YARD documentation for `handle_for_error` method
|
|
13
|
+
|
|
14
|
+
### Testing
|
|
15
|
+
- Added comprehensive test coverage for 403 error scenarios
|
|
16
|
+
|
|
1
17
|
### v2.63.0 (2025-10-28)
|
|
2
18
|
* * *
|
|
3
19
|
|
data/Gemfile.lock
CHANGED
data/chargebee.gemspec
CHANGED
|
@@ -4,8 +4,8 @@ Gem::Specification.new do |s|
|
|
|
4
4
|
s.rubygems_version = '1.3.5'
|
|
5
5
|
s.required_ruby_version = '>= 1.9.3'
|
|
6
6
|
s.name = 'chargebee'
|
|
7
|
-
s.version = '2.
|
|
8
|
-
s.date = '2025-10
|
|
7
|
+
s.version = '2.64.0'
|
|
8
|
+
s.date = '2025-11-10'
|
|
9
9
|
s.summary = "Ruby client for Chargebee API."
|
|
10
10
|
s.description = "Subscription Billing - Simple. Secure. Affordable. More details at www.chargebee.com."
|
|
11
11
|
s.metadata = {
|
|
@@ -140,7 +140,7 @@ Gem::Specification.new do |s|
|
|
|
140
140
|
lib/chargebee/models/usage_file.rb
|
|
141
141
|
lib/chargebee/models/virtual_bank_account.rb
|
|
142
142
|
lib/chargebee/models/webhook_endpoint.rb
|
|
143
|
-
lib/chargebee/
|
|
143
|
+
lib/chargebee/native_request.rb
|
|
144
144
|
lib/chargebee/request.rb
|
|
145
145
|
lib/chargebee/rest.rb
|
|
146
146
|
lib/chargebee/result.rb
|
data/lib/chargebee/errors.rb
CHANGED
|
@@ -167,26 +167,33 @@ module ChargeBee
|
|
|
167
167
|
end
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
+
# Handle errors returned by the ChargeBee API.
|
|
171
|
+
#
|
|
172
|
+
# @param rcode [Integer] HTTP status code.
|
|
173
|
+
# @param rbody [String] HTTP response body.
|
|
174
|
+
#
|
|
175
|
+
# @return [ChargeBee::Error] Appropriate ChargeBee error object.
|
|
170
176
|
def self.handle_for_error(rcode, rbody)
|
|
171
177
|
return Error.new("No response returned by ChargeBee API. HTTP status code: #{rcode}") if rcode == 204
|
|
178
|
+
return ForbiddenError.new("Access forbidden. You do not have permission to access this resource.") if rcode == 403
|
|
172
179
|
begin
|
|
173
180
|
error_obj = JSON.parse(rbody)
|
|
174
181
|
error_obj = Util.symbolize_keys(error_obj)
|
|
175
182
|
rescue Exception => e
|
|
176
|
-
|
|
183
|
+
return Error.new("Error response not in JSON format. The http status code is #{rcode} \n #{rbody.inspect}", e)
|
|
177
184
|
end
|
|
178
|
-
|
|
179
|
-
case type
|
|
185
|
+
|
|
186
|
+
case error_obj[:type]
|
|
180
187
|
when "payment"
|
|
181
|
-
|
|
188
|
+
PaymentError.new(rcode, error_obj)
|
|
182
189
|
when "operation_failed"
|
|
183
|
-
|
|
190
|
+
OperationFailedError.new(rcode, error_obj)
|
|
184
191
|
when "invalid_request"
|
|
185
|
-
|
|
192
|
+
InvalidRequestError.new(rcode, error_obj)
|
|
186
193
|
when "ubb_batch_ingestion_invalid_request"
|
|
187
|
-
|
|
194
|
+
UbbBatchIngestionInvalidRequestError.new(rcode, error_obj)
|
|
188
195
|
else
|
|
189
|
-
|
|
196
|
+
APIError.new(rcode, error_obj)
|
|
190
197
|
end
|
|
191
198
|
end
|
|
192
199
|
|
data/lib/chargebee.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/chargebee/environment'
|
|
2
|
-
require File.dirname(__FILE__) + '/chargebee/
|
|
2
|
+
require File.dirname(__FILE__) + '/chargebee/native_request'
|
|
3
3
|
require File.dirname(__FILE__) + '/chargebee/util'
|
|
4
4
|
require File.dirname(__FILE__) + '/chargebee/request'
|
|
5
5
|
require File.dirname(__FILE__) + '/chargebee/result'
|
|
@@ -98,7 +98,7 @@ require File.dirname(__FILE__) + '/chargebee/models/offer_fulfillment'
|
|
|
98
98
|
|
|
99
99
|
module ChargeBee
|
|
100
100
|
|
|
101
|
-
VERSION = '2.
|
|
101
|
+
VERSION = '2.64.0'
|
|
102
102
|
|
|
103
103
|
@@default_env = nil
|
|
104
104
|
@@verify_ca_certs = true
|
|
@@ -141,6 +141,19 @@ module ChargeBee
|
|
|
141
141
|
end
|
|
142
142
|
end
|
|
143
143
|
|
|
144
|
+
it "raises ForbiddenError for 403 status code" do
|
|
145
|
+
stub_request(:get, "https://dummy.chargebee.com/test").to_return(
|
|
146
|
+
body: "<html>\r\n<head><title>403 Forbidden</title></head>\r\n<body>\r\n<center><h1>403 Forbidden</h1></center>\r\n</body>\r\n</html>\r\n",
|
|
147
|
+
status: 403
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
expect {
|
|
151
|
+
NativeRequest.request(:get, "/test", env)
|
|
152
|
+
}.to raise_error(ForbiddenError) do |err|
|
|
153
|
+
expect(err.message).to eq("Access forbidden. You do not have permission to access this resource.")
|
|
154
|
+
end
|
|
155
|
+
end
|
|
156
|
+
|
|
144
157
|
it "retries once on HTTP 503 and succeeds on second attempt" do
|
|
145
158
|
stub_request(:get, "https://dummy.chargebee.com/test")
|
|
146
159
|
.to_return({ status: 503, body: "temporary error" },
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: chargebee
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.64.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rajaraman S
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2025-10
|
|
12
|
+
date: 2025-11-10 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: cgi
|
|
@@ -181,7 +181,7 @@ files:
|
|
|
181
181
|
- lib/chargebee/models/usage_file.rb
|
|
182
182
|
- lib/chargebee/models/virtual_bank_account.rb
|
|
183
183
|
- lib/chargebee/models/webhook_endpoint.rb
|
|
184
|
-
- lib/chargebee/
|
|
184
|
+
- lib/chargebee/native_request.rb
|
|
185
185
|
- lib/chargebee/request.rb
|
|
186
186
|
- lib/chargebee/rest.rb
|
|
187
187
|
- lib/chargebee/result.rb
|