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 multiple media attachments #9

Closed sathishceg closed 9 years ago

sathishceg commented 9 years ago

Not able to add multiple media attachments for AddMemberMessageRTQ api call...Below is my api call

Ebayr.call(:AddMemberMessageRTQ,:ItemID => "**" ,:MemberMessage => {:Body => Test, :MessageMedia => {:MediaName => "Test1",:MediaURL => "URL1"}, :MessageMedia => {:MediaName => "Test2",:MediaURL => "URL2"}, :ParentMessageID=> "ID" , :RecipientID=> "ID" })

bjjb commented 9 years ago

Did you try an array with multiple MessageMedia objects? With your call above, the second reference simply overwrites the first. You could try playing around with the method here and see whether the test checks your requirements.

sathishceg commented 9 years ago

Yes i tried an array with multiple MessageMedia object but still it constructs only a single MessageMedia...

bjjb commented 9 years ago

Weird. Can you post some code?

neilturner77 commented 9 years ago

Was this ever fixed? I'm running into the same problem with the :PaymentMethods option (it's repeatable) but obviously you can't have 2 hash keys the same.

neilturner77 commented 9 years ago

Oh, and if I try passing an array as the argument for :PaymentMethods it concats the two values into a single string i.e. <PaymentMethods>CreditCardPayPal</PaymentMethods>

bjjb commented 9 years ago

@neilturner77 - this test checks for that, and it's passing. Got some code?

sathishceg commented 9 years ago

Hi can you please give a sample on how to build multiple xml nodes for the outout selector.I am unable to build multiple OutputSelector...

Here is the code which i am using:

Ebayr.call(:GetItem, :DetailLevel => "ReturnAll", :ItemID => "ID", :OutputSelector => "PrimaryCategory",:OutputSelector => "SellingStatus")

Please provide a sample for the above...

SpeerJ commented 9 years ago

hey bjjb i think the problem is that your test onlys check that self.xml can return a correct xml string. Whats happening here is that we are unable to insert a array dirrectly into the option hash eg({foo: 1, bar: 2, [{media: 1}, {media: 2}]}). If we pass it only an array, delete can't select the hashes out of the array.

SpeerJ commented 9 years ago

@sathishceg @neilturner77 if you want to try my proposed patch you can get it with: git clone https://github.com/SpeerJ/ebayr.git --branch patch-1 --single-branch then enter the folder and build with: gem build ebayr.gemspec then install with: gem install ebayr*.gem

the syntax is Ebayr.call(:call_name, :any_keywords, input: [{any_xml: xml_value}, {any_xml: xml_value}])

for example sathishceg's call would be Ebayr.call(:GetItem, input: [{:DetailLevel => "ReturnAll"}, {:ItemID => "ID"},{:OutputSelector => "PrimaryCategory"},{:OutputSelector => "SellingStatus"}])