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

undefined method `[]' for nil:NilClass #18

Open
payal-balanceit opened this issue Dec 6, 2019 · 2 comments · May be fixed by #26
Open

undefined method `[]' for nil:NilClass #18

payal-balanceit opened this issue Dec 6, 2019 · 2 comments · May be fixed by #26

Comments

@payal-balanceit
Copy link

server = UPS::Connection.new(test_mode: true)
response = server.rates do |rate_builder|
  rate_builder.add_access_request 'test', 'test', 'test'
  rate_builder.add_shipper company_name: 'Veeqo Limited',    phone_number: '01792 123456',    address_line_1: '11 Wind Street',    city: 'Swansea',    state: 'Wales',    postal_code: 'SA1 1DA',    country: 'GB',    shipper_number: 'test'
  rate_builder.add_ship_from company_name: 'Veeqo Limited',    phone_number: '01792 123456',    address_line_1: '11 Wind Street',    city: 'Swansea',    state: 'Wales',    postal_code: 'SA1 1DA',    country: 'GB',    shipper_number: 'test'  
  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

(undefined method `[]' for nil:NilClass)

@tcd
Copy link

tcd commented Jan 30, 2020

@payal-balanceit Take a look at response.status_description and response.error_description

@aiperon
Copy link

aiperon commented Oct 26, 2020

I've also experienced this problem.

Error's backtrace leads me to the code:
https://github.com/veeqo/ups-ruby/blob/master/lib/ups/builders/organisation_builder.rb#L51
It means organization builder expects attention_name option passed with a non-blank string. It called from add_ship_from and add_ship_to.

@payal-balanceit , as a workaround you can add non-empty attention_name param to add_ship_from and add_ship_to methods

I suppose Veeqo uses these methods with all options filled in production.

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 a pull request may close this issue.

3 participants