ebay4r 2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: get_categories.rb,v 1.2 2006/01/16 09:52:56 garrydolley Exp $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+
6
+ require 'eBayAPI'
7
+
8
+ #
9
+ # Example of GetCategories call
10
+ #
11
+
12
+ # Put your credentials in this file
13
+ load('myCredentials.rb')
14
+
15
+ # Create new eBay caller object. Omit last argument to use live platform.
16
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
17
+
18
+ # Call "GetCategories"
19
+ resp = eBay.GetCategories(:DetailLevel => 'ReturnAll', # Return all available info
20
+ :CategorySideID => 0, # US site
21
+ :LevelLimit => 1) # Only 1 level deep
22
+
23
+ # Report results
24
+
25
+ puts "eBay Top Level Categories for US site (Cat. Version " + resp.categoryVersion + "):"
26
+ puts ""
27
+
28
+ resp.categoryArray.each do |cat|
29
+ puts " Category Name : " + cat.categoryName
30
+ puts " Category ID : " + cat.categoryID
31
+ puts " Category Level: " + cat.categoryLevel.to_s
32
+ puts " Is Leaf? : " + cat.leafCategory.to_s
33
+ puts " Parent ID : " + cat.categoryParentID.to_s
34
+ puts ""
35
+ end
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: get_categories2.rb,v 1.3 2006/01/16 09:54:08 garrydolley Exp $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+
6
+ require 'eBayAPI'
7
+
8
+ #
9
+ # Example of GetCategories call for eBay Motors
10
+ #
11
+
12
+ # Put your credentials in this file
13
+ load('myCredentials.rb')
14
+
15
+ # Create new eBay caller object. Omit last argument to use live platform.
16
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true, :site_id => 100)
17
+
18
+ # Call "GetCategories"
19
+ resp = eBay.GetCategories(:DetailLevel => 'ReturnAll', # Return all available info
20
+ :CategorySideID => 100, # US eBay Motors Site
21
+ :LevelLimit => 2) # 2 Levels Deep
22
+
23
+ # Report results
24
+
25
+ puts "eBay Motors Top Level Categories (Cat. Version " + resp.categoryVersion + "):"
26
+ puts ""
27
+
28
+ resp.categoryArray.each do |cat|
29
+ puts " Category Name : " + cat.categoryName
30
+ puts " Category ID : " + cat.categoryID
31
+ puts " Category Level: " + cat.categoryLevel.to_s
32
+ puts " Is Leaf? : " + cat.leafCategory.to_s
33
+ puts " Parent ID : " + cat.categoryParentID.to_s
34
+ puts ""
35
+ end
@@ -0,0 +1,38 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: get_category_features.rb,v 1.1 2006/04/30 07:37:52 garrydolley Exp $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+
6
+ require 'eBayAPI'
7
+
8
+ #
9
+ # Example of GetCategoryFeatures call
10
+ #
11
+
12
+ # Put your credentials in this file
13
+ load('myCredentials.rb')
14
+
15
+ # Create new eBay caller object. Omit last argument to use live platform.
16
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
17
+
18
+ # Call "GetCategoryFeatures"
19
+ resp = eBay.GetCategoryFeatures(:DetailLevel => 'ReturnAll', # Return all available info
20
+ :CategoryID => '1',
21
+ :FeatureID => 'ListingDurations') # Tell us about listing durations
22
+
23
+ # Report results
24
+
25
+ durationHash = {}
26
+
27
+ [resp.featureDefinitions.listingDurations.listingDuration].flatten.each do |ld|
28
+ durationHash[ld.xmlattr_durationSetID] = ld.duration
29
+ end
30
+
31
+ puts "Site wide defaults for listing durations given listing type:\n\n"
32
+
33
+ [resp.siteDefaults.listingDuration].flatten.each do |duration|
34
+ puts duration.xmlattr_type # This is an example of how we read an XML attribute, just prepend "xmlattr_" to the name
35
+ [durationHash[duration.to_i]].flatten.each do |c|
36
+ puts " " + c
37
+ end
38
+ end
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: get_ebay_details.rb,v 1.1 2006/05/01 09:32:17 garrydolley Exp $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+
6
+ require 'eBayAPI'
7
+
8
+ #
9
+ # Example of GeteBayDetails call
10
+ #
11
+
12
+ # Put your credentials in this file
13
+ load('myCredentials.rb')
14
+
15
+ # Create new eBay caller object. Omit last argument to use live platform.
16
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
17
+
18
+ # Call "GeteBayDetails"
19
+ resp = eBay.GeteBayDetails(:DetailName => ['ShippingLocationDetails', 'ShippingServiceDetails'])
20
+
21
+ # Report results
22
+
23
+ if resp.respond_to? 'shippingLocationDetails'
24
+ puts "Seller Ship-To choices:\n\n"
25
+
26
+ [resp.shippingLocationDetails].flatten.each do |s|
27
+ puts s.shippingLocation + ": " + s.description
28
+ end
29
+
30
+ puts "\n"
31
+ end
32
+
33
+ if resp.respond_to? 'shippingServiceDetails'
34
+ puts "Shipping service codes:\n\n"
35
+
36
+ [resp.shippingServiceDetails].flatten.each do |s|
37
+ puts s.shippingService + ": " + s.description + " (" + s.shippingServiceID.to_s + ")"
38
+ end
39
+ end
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: get_feedback.rb,v 1.3 2006/01/25 08:38:42 garrydolley Exp $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+ require 'eBayAPI'
6
+
7
+ #
8
+ # Example of GetFeedback call
9
+ #
10
+
11
+ # Put your credentials in this file
12
+ load('myCredentials.rb')
13
+
14
+ # Create new eBay caller object. Omit last argument to use live platform.
15
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
16
+
17
+ resp = eBay.GetFeedback # No arguments = current user, otherwise pass :UserID
18
+
19
+ puts "Aggregate Feedback Score: #{resp.feedbackScore}"
20
+ puts "Neutral Comment Count from Suspended Users: #{resp.feedbackSummary.neutralCommentCountFromSuspendedUsers}"
21
+ puts "Unique Positive Feedbacks: #{resp.feedbackSummary.uniquePositiveFeedbackCount}"
22
+ puts "Unique Negative Feedbacks: #{resp.feedbackSummary.uniqueNegativeFeedbackCount}"
23
+
24
+ puts "Bid Retractions:"
25
+ resp.feedbackSummary.bidRetractionFeedbackPeriodArray.each do |fb|
26
+ puts " Last #{fb.periodInDays} Days: #{fb.count}"
27
+ end
28
+
29
+ puts "Positive Feedback:"
30
+ resp.feedbackSummary.positiveFeedbackPeriodArray.each do |fb|
31
+ puts " Last #{fb.periodInDays} Days: #{fb.count}"
32
+ end
33
+
34
+ puts "Negative Feedback:"
35
+ resp.feedbackSummary.negativeFeedbackPeriodArray.each do |fb|
36
+ puts " Last #{fb.periodInDays} Days: #{fb.count}"
37
+ end
38
+
39
+ puts "Neutral Feedback:"
40
+ resp.feedbackSummary.neutralFeedbackPeriodArray.each do |fb|
41
+ puts " Last #{fb.periodInDays} Days: #{fb.count}"
42
+ end
43
+
44
+ puts "Total Feedback:"
45
+ resp.feedbackSummary.totalFeedbackPeriodArray.each do |fb|
46
+ puts " Last #{fb.periodInDays} Days: #{fb.count}"
47
+ end
48
+
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: get_item.rb,v 1.6 2006/01/07 01:29:55 garrydolley Exp $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+ require 'eBayAPI'
6
+
7
+ load('myCredentials.rb')
8
+
9
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
10
+
11
+ # Replace ItemID with some item you know exists
12
+ resp = eBay.GetItem(:DetailLevel => 'ReturnAll', :ItemID => '110029878327', :IncludeWatchCount => 'true')
13
+
14
+ puts "AutoPay: " + resp.item.autoPay.to_s
15
+ puts "Country: " + resp.item.country
16
+ puts "ItemID: " + resp.item.itemID.to_s
17
+ puts "Descr: " + resp.item.description
18
+ puts "Location: " + resp.item.location
19
+
20
+ puts "Ship To Locations:"
21
+ resp.item.shipToLocations.each { |loc| puts loc }
22
+
23
+ # Many more fields are present, see eBay's SOAP API Guide or GetItemResponseType class in "../lib/eBay.rb"
24
+
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
+ require 'eBayAPI'
5
+
6
+ #
7
+ # Example of GetNotificationPreferences call
8
+ #
9
+
10
+ # Put your credentials in this file
11
+ load('myCredentials.rb')
12
+
13
+ # Create new eBay caller object. Omit last argument to use live platform.
14
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
15
+
16
+ resp = eBay.GetNotificationPreferences(:PreferenceLevel => 'User')
17
+
18
+ if resp.respond_to?('userDeliveryPreferenceArray') && resp.userDeliveryPreferenceArray
19
+ resp.userDeliveryPreferenceArray.each do |pref|
20
+ puts "Event Enable: " + pref.eventEnable
21
+ puts "Event Type: " + pref.eventType
22
+ end
23
+ end
24
+
25
+ begin
26
+ resp = eBay.GetNotificationPreferences(:PreferenceLevel => 'Application')
27
+
28
+ if resp.respond_to?('applicationDeliveryPreferences')
29
+ [resp.applicationDeliveryPreferences].flatten.each do |pref|
30
+ puts "Alert Email: " + pref.alertEmail.to_s if pref.respond_to? 'alertEmail'
31
+ puts "Alert Enable: " + pref.alertEnable if pref.respond_to? 'alertEnable'
32
+ puts "Application Enable: " + pref.applicationEnable if pref.respond_to? 'applicationEnable'
33
+ puts "Application URL: " + pref.applicationURL.to_s if pref.respond_to? 'applicationURL'
34
+ puts "Device Type: " + pref.deviceType if pref.respond_to? 'deviceType'
35
+ puts "Notification Payload: " + pref.notificationPayloadType if pref.respond_to? 'notificationPayloadType'
36
+ end
37
+ end
38
+ rescue EBay::Error::ApplicationError => boom
39
+ puts boom.message
40
+ end
41
+
42
+ begin
43
+ resp = eBay.GetNotificationPreferences(:PreferenceLevel => 'Event')
44
+
45
+ if resp.respond_to?('eventProperty') && resp.eventProperty
46
+ [resp.eventProperty].flatten.each do |e|
47
+ puts "Event Type: " + e.eventType
48
+ puts "Name: " + e.name
49
+ puts "Value: " + e.value
50
+ end
51
+ end
52
+ rescue EBay::Error::ApplicationError => boom
53
+ puts boom.message
54
+ end
55
+
56
+ # More fields are present, see eBay's SOAP API Guide
57
+ #
58
+ # If you add on to this example with more fields, please send it to
59
+ # gdolley@ucla.edu so I can include it with the next release :)
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
+ require 'eBayAPI'
5
+
6
+ #
7
+ # Example of GetNotificationsUsage call
8
+ #
9
+
10
+ # Put your credentials in this file
11
+ load('myCredentials.rb')
12
+
13
+ # Create new eBay caller object. Omit last argument to use live platform.
14
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
15
+
16
+ # Fill this in with a real item number to get more info about notifications
17
+ item_no = '110029878327'
18
+
19
+ if !item_no.empty?
20
+ resp = eBay.GetNotificationsUsage(:ItemID => item_no)
21
+
22
+ resp.notificationDetailsArray.each do |notif|
23
+ puts "Delivery Status: " + notif.deliveryStatus
24
+ puts "Delivery Time: " + notif.deliveryTime if notif.respond_to? 'deliveryTime'
25
+ puts "Delivery URL: " + notif.deliveryURL
26
+ puts "Error Message: " + notif.errorMessage
27
+ puts "Expiration Time: " + notif.expirationTime
28
+ puts "Next Retry Time: " + notif.nextRetryTime
29
+ puts "Retries: " + notif.retries if notif.respond_to?('retries') && notif.retries
30
+ # puts "Type: " + notif.type # Mmmm... "type" is already a method of Object
31
+ end if resp.notificationDetailsArray.respond_to? 'notificationDetails'
32
+ end
33
+
34
+ resp = eBay.GetNotificationsUsage
35
+
36
+ ns = resp.notificationStatistics
37
+
38
+ puts "Current Counters: "
39
+ puts " Delivered: " + ns.deliveredCount.to_s
40
+ puts " Errors: " + ns.errorCount.to_s
41
+ puts " Expired: " + ns.expiredCount.to_s
42
+ puts " Queued New: " + ns.queuedNewCount.to_s
43
+ puts " Queued Pending: " + ns.queuedPendingCount.to_s
44
+
45
+ # More fields are present, see eBay's SOAP API Guide
46
+ #
47
+ # If you add on to this example with more fields, please send it to
48
+ # gdolley@ucla.edu so I can include it with the next release :)
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
+
5
+ require 'eBayAPI'
6
+
7
+ #
8
+ # Example of GetSuggestedCategories call
9
+ #
10
+
11
+ # Put your credentials in this file
12
+ load('myCredentials.rb')
13
+
14
+ # Create new eBay caller object. Omit last argument to use live platform.
15
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
16
+
17
+ # Call "GetSuggestedCategories"
18
+ resp = eBay.GetSuggestedCategories(:Query => "stuff")
19
+
20
+ # Report results
21
+
22
+ if resp.categoryCount.to_i > 0
23
+ resp.suggestedCategoryArray.suggestedCategory.each do |cat|
24
+ puts " Category ID : " + cat.category.categoryID.to_s
25
+ puts " Category Name : " + cat.category.categoryName + " (" + cat.percentItemFound.to_s + "%)"
26
+ puts ""
27
+ end
28
+ else
29
+ puts "No suggested categories found."
30
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: hello_world.rb,v 1.6 2005/12/27 01:13:46 garrydolley Exp $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+
6
+ require 'eBayAPI'
7
+
8
+ #
9
+ # Example of GeteBayOfficialTime call
10
+ #
11
+
12
+ # Put your credentials in this file
13
+ load('myCredentials.rb')
14
+
15
+ # Create new eBay caller object. Omit last argument to use live platform.
16
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
17
+
18
+ # Call "GetEbayOfficialTime"
19
+ resp = eBay.GeteBayOfficialTime
20
+
21
+ # Report results
22
+ puts "Hello, World!"
23
+ puts "The eBay time is now: #{resp.timestamp}"
24
+
25
+ # Wasn't that easy?!
@@ -0,0 +1,6 @@
1
+ # Fill these in before running the examples:
2
+
3
+ $appId = 'CrystalC-4f75-4a31-a866-f776cfcb3005'
4
+ $devId = 'C4R717157S1331817A1Z3F3164C16F'
5
+ $certId = 'fa3a209c-590a-4f70-9b89-4641f1331e16'
6
+ $authToken = "AgAAAA**AQAAAA**aAAAAA**VWVSVA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6AEmISiAZmEqA6dj6x9nY+seQ**szIAAA**AAMAAA**diarcjs51oQvvJPY3O3UNHqDDnBtesuTpEQSSAzANJFWwQRrM2f0bq85TwPGZ4+O+TkXPPfpmo9S+Y2HWg6kEklYQQLXP7wVvk66rr7qw8gai7tt5DnK8XWCe3w8xIX4mhXBM8wo+7iuWz1u4QusuWW2pdqw3CiLX/leLRvtr7ly8V2CaQgGJbAurrbEiUINVHdKDL3ge1Z+sdar5FW2qn9NCATXudsEt7uIkgSvX4iW5MC4Yrih7NwCq19uHNBlUG4vmJPUNHMwj/QLiq0gN83Rfz1v7vzGhxwEEYNy4wRq4OjkaMKzikmbU5RfCCaWk+mC/HlTJxI9fh40XfVIZQGmhy78dk9cL3HBq5EVINA58JKtkX+Umn4Yw3c92ctK1Evz2i50IGjyN3dmm8lTGsyBniib1QWySowaHfDC0Etim8adYvBli40KlbsNsAYcsMbMGa5Z/3mRhdIs6EStul2JKMNFCsNvh6Cs+w1D1nnhyYT6CMrM+XoIuJJ04coIOdUzDpqQXnuSyUoTobZTyBvh8IPuVFggXeo4OlxWX8Xeljtxe8FYoIemeQdWRhmjDbu2euZ8Fm7UK7sOZ2dXgTxnNAF2kbMKoxN30qMwD7MBUXg6EDvwuUjMuwjVjmsHNXa7kkQZwzbKwxE+I0dOnT1YgSoGhuwZ/rHv0/BL5qFULB6qvFArmcdwNdw38jSaWK+CDN7RNJBH1Ny7kzy5RJbFL0rc1vrkmunPSlocGsnmfA+MRfn6ztjXxjrxj3uq"
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # $Id: revise_item.rb,v 1.2 2006/01/07 07:34:27 garrydolley Exp $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+ require 'eBayAPI'
6
+
7
+ load('myCredentials.rb')
8
+
9
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
10
+
11
+ # I want to revise Item #110029878327 -- replace this with an Item # that you know exists and is active
12
+ item = EBay.Item(:ItemID => '110029878327', :Location => 'Brave New World', :Title => 'My new title')
13
+
14
+ resp = eBay.ReviseItem(:DetailLevel => 'ReturnAll', :Item => item,
15
+ :ModifiedFields => [ {:Field => 'Item.Location', :ModifyType => 'Modify'},
16
+ {:Field => 'Item.Title', :ModifyType => 'Modify'} ])
17
+ # Note :Field is case insensitive, so 'item.title' would work also
18
+
19
+ puts "ItemID: " + resp.itemID
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
4
+ require 'eBayAPI'
5
+
6
+ #
7
+ # Example of SetNotificationPreferences call
8
+ #
9
+
10
+ # Put your credentials in this file
11
+ load('myCredentials.rb')
12
+
13
+ # Create new eBay caller object. Omit last argument to use live platform.
14
+ eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
15
+
16
+ resp = eBay.SetNotificationPreferences(:ApplicationDeliveryPreferences => EBay.ApplicationDeliveryPreferences({
17
+ :ApplicationEnable => 'Enable',
18
+ :ApplicationURL => 'http://www.xyz.com/my_script',
19
+ :NotificationPayloadType => 'eBLSchemaSOAP' }),
20
+ :UserDeliveryPreferenceArray => [
21
+ EBay.NotificationEnable(
22
+ :EventEnable => 'Enable',
23
+ :EventType => 'EndOfAuction'),
24
+ EBay.NotificationEnable(
25
+ :EventEnable => 'Enable',
26
+ :EventType => 'Feedback')
27
+ ]
28
+ )