· 8 years ago · Aug 13, 2018, 01:16 PM
1Ruby add_item for eBay
2@ebay = Ebay::Api.new :auth_token => @seller.ebay_token
3item = Ebay::Types::Item.new( :primary_category => Ebay::Types::Category.new(:category_id => @ebayTemplate.categoryID),
4:title => @ebayTemplate.name,
5:description => @ebayTemplate.description,
6:location => @ebayTemplate.location,
7:start_price => Money.new((@ebayTemplate.startPrice*100).to_d, @ebayTemplate.currency),
8:quantity => 1,
9:listing_duration => @ebayTemplate.listingDuration,
10:country => @ebayTemplate.country,
11:currency => @ebayTemplate.currency,
12:payment_methods => ['VisaMC', 'PayPal'],
13:paypal_email_address => '********@gmail.com',
14:dispatch_time_max => 3,
15:lookup_attributes => [Ebay::Types::LookupAttribute.new( :name => "Condition", :value => "New")],
16# :attribute_sets => [
17# Ebay::Types::AttributeSet.new(
18# :attribute_set_id => 2919,
19# :attributes => [
20# Ebay::Types::Attribute.new(
21# :attribute_id => 10244,
22# :values => [ Ebay::Types::Val.new(:value_id => 10425) ]
23# )
24# ]
25# )
26# ],
27:shipping_details => Ebay::Types::ShippingDetails.new(
28:shipping_service_options => [
29# ShippingServiceOptions.new(
30# :shipping_service_priority => 2, # Display priority in the listing
31# :shipping_service => 'UPSNextDay',
32# :shipping_service_cost => Money.new(1000, 'USD'),
33# :shipping_surcharge => Money.new(299, 'USD')
34# ),
35Ebay::Types::ShippingServiceOptions.new(
36:shipping_service_priority => 1, # Display priority in the listing
37:shipping_service => @ebayTemplate.shipSvc,
38:shipping_service_cost => Money.new((@ebayTemplate.shipSvcCost*100).to_d, @ebayTemplate.currency),
39:shipping_surcharge => Money.new((@ebayTemplate.shipSurcharge*100).to_d, @ebayTemplate.currency)
40)
41],
42:international_shipping_service_options => [
43Ebay::Types::InternationalShippingServiceOptions.new(
44:shipping_service => 'USPSPriorityMailInternational',
45:shipping_service_cost => Money.new((@ebayTemplate.shipSvcCost*100).to_d, @ebayTemplate.currency),
46:shipping_service_priority => 2,
47:ship_to_location => @ebayTemplate.shipToLocation
48)
49]
50
51),
52:return_policy => Ebay::Types::ReturnPolicy.new (
53:description => 'this product for suckers only!',
54:returns_accepted_option => 'ReturnsAccepted'
55)
56#:condition_id => 1000
57)
58
59@response = @ebay.add_item(:item => item)