bjjb / ebayr

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

Not able to add attributes on tags #23

Closed GCorbel closed 6 years ago

GCorbel commented 8 years ago

As you can see in the doc some tag needs attributes. For example, <Total currencyID="CurrencyCodeType"> AmountType (double) </Total>.

I tried to do this :

Ebayr::Request.new(:AddOrder, input: [{ Order: { CreatingUserRole: 'Buyer', 'Total' => 100 } }]).send

And I have this result :

{:xmlns=>"urn:ebay:apis:eBLBaseComponents",
 :timestamp=>"2016-04-04T19:49:15.014Z",
 :ack=>"Failure",
 :errors=>
  [{:short_message=>"No <Order.Total.CurrencyID> exists or <Order.Total.CurrencyID> is specified as an empty tag.",
    :long_message=>
     "No <Order.Total.CurrencyID> exists or <Order.Total.CurrencyID> is specified as an empty tag in the request.",
    :error_code=>"10009",
    :severity_code=>"Error",
    :error_parameters=>{:param_id=>"0", :value=>"Order.Total.CurrencyID"},
    :error_classification=>"RequestError"},
   {:short_message=>"No <Order.TransactionArray> exists or <Order.TransactionArray> is specified as an empty tag.",
    :long_message=>
     "No <Order.TransactionArray> exists or <Order.TransactionArray> is specified as an empty tag in the request.",
    :error_code=>"10009",
    :severity_code=>"Error",
    :error_parameters=>{:param_id=>"0", :value=>"Order.TransactionArray"},
    :error_classification=>"RequestError"}],
 :version=>"949",
 :build=>"E949_CORE_API_17895653_R1"}

By reading the code, at this line, is see there is no way to do. I propose to do a Pull Request with a format like :

Ebayr::Request.new(:AddOrder, input: [{ Order: { CreatingUserRole: 'Buyer', 'Total' => { value : 100, attr: { CurrencyID: 'EUR' } } }]).send

What you think ?

bjjb commented 8 years ago

Looks like a good idea to me, @GCorbel . If the Travis CI build passes, then I'm happy to accept.

GCorbel commented 8 years ago

I don't why it doesn't pass. I have this weird error message : An error occurred while installing rake (11.1.2), and Bundler cannot continue.. Maybe a rebuild will work but I can't do it.

spk commented 8 years ago

Hi @bjjb, look like the errors are not related to the changes, since it is failure with old Rubies:

Are you interested in a PR fixing that ?

bjjb commented 8 years ago

Hmm, I wonder how many people are using 1.8? Maybe there's stats available from Rubygems. If you want to remind me later in the week, I can look into it. And if the usage is negligible (I recently retired a ruby 1.8 ebayr project), then I'd be happy to only support >= 1.9.3. It would need a post-install message and a new minor version.

spk commented 8 years ago

Support for 1.8 is over for a long time now and 1.9 also but still largely used (https://www.ruby-lang.org/en/news/2016/02/24/support-plan-of-ruby-2-0-0-and-2-1/)

bjjb commented 8 years ago

@spk Sure, I'd welcome a PR. I'd merge it first. You can rebase this fix off master, and the CI should pass, so we can merge this PR, too.

spk commented 8 years ago

Hi @bjjb all green on #27 !