Skip to content

Conversation

@aiperon
Copy link

@aiperon aiperon commented Oct 27, 2020

When request returns with a successful status, response doesn't contain Error element.
As a result, error_description throws an exception. It's confusing.

Steps to reproduce

require 'ups'
server = UPS::Connection.new(test_mode: true)
response = server.rates do |rate_builder|
  rate_builder.add_access_request 'API_KEY', 'USERNAME', 'PASSWORD'
  rate_builder.add_shipper company_name: 'Veeqo Limited', phone_number: '01792 123456', attention_name: 'Veeqo', address_line_1: '11 Wind Street', city: 'Swansea', state: 'Wales', postal_code: 'SA1 1DA', country: 'GB', shipper_number: 'ACCOUNT_NUMBER'
  rate_builder.add_ship_from company_name: 'Veeqo Limited', phone_number: '01792 123456', attention_name: 'Veeqo', address_line_1: '11 Wind Street', city: 'Swansea', state: 'Wales', postal_code: 'SA1 1DA', country: 'GB', shipper_number: 'ACCOUNT_NUMBER'
  rate_builder.add_ship_to company_name: 'Google Inc.', phone_number: '0207 031 3000', address_line_1: '1 St Giles High Street', city: 'London', state: 'England', postal_code: 'WC2H 8AG', country: 'GB'
  rate_builder.add_package weight: '0.5', unit: 'KGS'
end

response.status_description
# => "Success" 
response.error_description
# => NoMethodError (undefined method `[]' for nil:NilClass)

@aiperon
Copy link
Author

aiperon commented Dec 11, 2020

@benschool , @matt423 Is there any chances of reviewing and merging?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant