lib/easypost.rb in easypost-4.8.0 vs lib/easypost.rb in easypost-4.8.1
- old
+ new
@@ -24,10 +24,11 @@
require 'easypost/end_shipper'
require 'easypost/event'
require 'easypost/insurance'
require 'easypost/order'
require 'easypost/parcel'
+require 'easypost/payment_method' # deprecated
require 'easypost/pickup_rate'
require 'easypost/pickup'
require 'easypost/postage_label'
require 'easypost/rate'
require 'easypost/referral'
@@ -131,10 +132,10 @@
def self.make_request(method, path, api_key = nil, body = nil)
default_connection.call(method, path, api_key || EasyPost.api_key, body)
end
def self.parse_response(status:, body:, json:)
- if status >= 400
+ if status < 200 || status >= 300
error = JSON.parse(body)['error']
raise EasyPost::Error.new(
error['message'],
status,