bjjb / ebayr

A small library to help using the eBay Trading API with Ruby
MIT License
60 stars 49 forks source link

Support ActiveSupport v5.x #28

Closed yoonwaiyan closed 6 years ago

yoonwaiyan commented 6 years ago

I'm very new to eBay API so probably I've missed out any helpful information about GetSessionID, not sure if it's related to this gem but I'm trying every possible way.

In my Rails app the current code tries to get a session ID before appending to the authorization URL so that the Rails app can get an auth token for ebay store access, but it didn't work now even though I've set to production environment. I'm trying to call GetSessionID from rails console just to make sure session ID is available before I redirect users to ebay in my controller.

session = Ebayr.call(:GetSessionID, :RuName => Ebayr.ru_name)
=> {:xmlns=>"urn:ebay:apis:eBLBaseComponents",
 :timestamp=>"2017-09-18T06:22:48.336Z",
 :ack=>"Failure",
 :errors=>
  {:short_message=>"Auth token is invalid.",
   :long_message=>"Validation of the authentication token in API request failed.",
   :error_code=>"931",
   :severity_code=>"Error",
   :error_classification=>"RequestError"},
 :version=>"1031",
 :build=>"E1031_CORE_API_18535225_R1"}

I've double checked my app id, dev id, cert id are all set and Ebayr.sandbox is set to false, the only thing I didn't set is the auth_token because new users don't have any before authorizing my app, but if I set an auth_token(of other authorized users) before calling GetSessionID it actually works. Any idea on this? Thanks in advance.

yoonwaiyan commented 6 years ago

Seems like it's related to auth token being added in the request in version 0.0.7, but to update my ebayr gem to the latest I need a version bump on the current activesupport dependencies as my Rails app is upgraded to Rails 5 which is using activesupport 5.0.1. Do you mind bumping the runtime dependencies to support Rails 5?

bjjb commented 6 years ago

Done. Let me know how it works for you.

yoonwaiyan commented 6 years ago

Works fine, thanks!