Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error_description on successful response #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant