ebay4r 2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README +426 -0
- data/contrib/ebay_platform_notifications.txt +68 -0
- data/contrib/get_and_store_ebay_categories.rb +240 -0
- data/examples/add_item.rb +57 -0
- data/examples/add_item2.rb +74 -0
- data/examples/get_account.rb +31 -0
- data/examples/get_account2.rb +31 -0
- data/examples/get_account3.rb +31 -0
- data/examples/get_categories.rb +35 -0
- data/examples/get_categories2.rb +35 -0
- data/examples/get_category_features.rb +38 -0
- data/examples/get_ebay_details.rb +39 -0
- data/examples/get_feedback.rb +48 -0
- data/examples/get_item.rb +24 -0
- data/examples/get_notification_preferences.rb +59 -0
- data/examples/get_notifications_usage.rb +48 -0
- data/examples/get_suggested_categories.rb +30 -0
- data/examples/hello_world.rb +25 -0
- data/examples/myCredentials.rb +6 -0
- data/examples/revise_item.rb +19 -0
- data/examples/set_notification_preferences.rb +28 -0
- data/examples/verify_add_item.rb +59 -0
- data/lib/.document +1 -0
- data/lib/RequesterCredentialsHandler.rb +56 -0
- data/lib/eBay.rb +41163 -0
- data/lib/eBayAPI.rb +233 -0
- data/lib/eBayAPIInterfaceServiceClient.rb +1931 -0
- data/lib/eBayDriver.rb +1321 -0
- data/lib/eBayMappingRegistry.rb +42631 -0
- data/test/TODO +16 -0
- data/test/myCredentials.rb +6 -0
- data/test/tc_hello_world.rb +46 -0
- data/test/tc_items.rb +96 -0
- data/test/tc_routing.rb +51 -0
- metadata +79 -0
@@ -0,0 +1,240 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id: get_and_store_ebay_categories.rb,v 1.2 2006/01/18 09:42:02 garrydolley Exp $
|
3
|
+
#
|
4
|
+
# == Copyright
|
5
|
+
#
|
6
|
+
# Copyright (c) 2005,2006 Garry C. Dolley
|
7
|
+
#
|
8
|
+
# This file is part of eBay4R.
|
9
|
+
#
|
10
|
+
# eBay4R is free software; you can redistribute it and/or modify it under the
|
11
|
+
# terms of the GNU General Public License as published by the Free Software
|
12
|
+
# Foundation; either version 2 of the License, or (at your option) any later
|
13
|
+
# version.
|
14
|
+
#
|
15
|
+
# eBay4R is distributed in the hope that it will be useful, but WITHOUT ANY
|
16
|
+
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
17
|
+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
18
|
+
# details.
|
19
|
+
#
|
20
|
+
# You should have received a copy of the GNU General Public License along with
|
21
|
+
# eBay4R; if not, write to the Free Software Foundation, Inc., 51 Franklin
|
22
|
+
# Street, Fifth Floor, Boston, MA 02110-1301, USA
|
23
|
+
#
|
24
|
+
# Created : 01/16/2006
|
25
|
+
#
|
26
|
+
# == Synopsis
|
27
|
+
#
|
28
|
+
# This script will retrieve the entire eBay Category tree for a specified eBay
|
29
|
+
# site (site_id) and store it in a MySQL database.
|
30
|
+
#
|
31
|
+
# == Database
|
32
|
+
#
|
33
|
+
# The schema used is as follows:
|
34
|
+
#
|
35
|
+
# CREATE TABLE ebay_categories (
|
36
|
+
# id int(11) NOT NULL auto_increment,
|
37
|
+
# site_id smallint(6) default NULL,
|
38
|
+
# category_id varchar(10) NOT NULL default '',
|
39
|
+
# category_parent_id varchar(10) default NULL,
|
40
|
+
# category_name varchar(128) NOT NULL default '',
|
41
|
+
# category_level int(11) default NULL,
|
42
|
+
# leaf_category tinyint(1) NOT NULL default '0',
|
43
|
+
# expired tinyint(1) NOT NULL default '0',
|
44
|
+
# virtual tinyint(1) NOT NULL default '0',
|
45
|
+
# auto_pay_enabled tinyint(1) NOT NULL default '0',
|
46
|
+
# b2b_vat_enabled tinyint(1) NOT NULL default '0',
|
47
|
+
# best_offer_enabled tinyint(1) NOT NULL default '0',
|
48
|
+
# intl_autos_fixed_cat tinyint(1) NOT NULL default '0',
|
49
|
+
# lsd tinyint(1) NOT NULL default '0',
|
50
|
+
# orpa tinyint(1) NOT NULL default '0',
|
51
|
+
# orra tinyint(1) NOT NULL default '0',
|
52
|
+
# PRIMARY KEY (id),
|
53
|
+
# UNIQUE KEY site_id (site_id,category_id),
|
54
|
+
# KEY category_id (category_id),
|
55
|
+
# KEY category_parent_id (category_parent_id),
|
56
|
+
# CONSTRAINT ebay_categories_ibfk_1 FOREIGN KEY (category_parent_id)
|
57
|
+
# REFERENCES ebay_categories (category_id)
|
58
|
+
# ) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
59
|
+
#
|
60
|
+
# and
|
61
|
+
#
|
62
|
+
# CREATE TABLE ebay_categories_info (
|
63
|
+
# id int(11) NOT NULL auto_increment,
|
64
|
+
# site_id smallint(6) default NULL,
|
65
|
+
# category_version varchar(16) NOT NULL default '',
|
66
|
+
# minimum_reserve_price double default NULL,
|
67
|
+
# reduce_reserve_allowed tinyint(1) NOT NULL default '0',
|
68
|
+
# reserve_price_allowed tinyint(1) NOT NULL default '0',
|
69
|
+
# update_time datetime default NULL,
|
70
|
+
# PRIMARY KEY (id)
|
71
|
+
# UNIQUE KEY site_id (site_id)
|
72
|
+
# ) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
73
|
+
#
|
74
|
+
# == Usage
|
75
|
+
#
|
76
|
+
# ./get_and_store_ebay_categories.rb -s site_id [ -t | --table TABLE_BASE_NAME ] [ -h | --host HOST ] [ -d | --database DB ] [ -u | --user USER ] [ -p | --password PW ] [ --debug ] [ -c concurrency ]
|
77
|
+
#
|
78
|
+
# Example site IDs: 0 = eBay USA, 2 = eBay Canada, 100 = eBay Motors
|
79
|
+
#
|
80
|
+
# Just like the examples/ directory, you need a file named
|
81
|
+
# "myCredentials.rb" in the current directory or Ruby load path.
|
82
|
+
#
|
83
|
+
# The "-c concurrency" command line option says how many category nodes we
|
84
|
+
# retrieve at a time. Default is 20. All direct children are also
|
85
|
+
# downloaded (grouped BFS).
|
86
|
+
#
|
87
|
+
# If you are getting out of memory errors, reduce this number.
|
88
|
+
# If you have lots of memory, you can increase this number and the import
|
89
|
+
# will be faster.
|
90
|
+
#
|
91
|
+
# Note: The eBay Category tree is very large. This script can run for 20
|
92
|
+
# minutes or longer.
|
93
|
+
|
94
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
95
|
+
|
96
|
+
require 'eBayAPI'
|
97
|
+
|
98
|
+
require 'optparse'
|
99
|
+
require 'rdoc/usage'
|
100
|
+
|
101
|
+
begin
|
102
|
+
require 'rubygems'
|
103
|
+
require_gem 'mysql'
|
104
|
+
rescue LoadError
|
105
|
+
require 'mysql'
|
106
|
+
end
|
107
|
+
|
108
|
+
#
|
109
|
+
# Set defaults and parse command line args
|
110
|
+
#
|
111
|
+
|
112
|
+
mysql_hostname = 'localhost'
|
113
|
+
mysql_database = 'test'
|
114
|
+
mysql_username = 'test'
|
115
|
+
mysql_password = ''
|
116
|
+
|
117
|
+
site_id = 0
|
118
|
+
table_name = "ebay_categories"
|
119
|
+
concurrency = 20
|
120
|
+
|
121
|
+
debug = false
|
122
|
+
|
123
|
+
opts = OptionParser.new
|
124
|
+
opts.on("-h", "--help") { RDoc::usage('usage') }
|
125
|
+
opts.on("-s SITE_ID") { |sid| site_id = sid }
|
126
|
+
opts.on("-c concurrency") { |c| concurrency = c.to_i }
|
127
|
+
|
128
|
+
opts.on("-h", "--host HOST") { |h| mysql_hostname = h }
|
129
|
+
opts.on("-d", "--database DB") { |d| mysql_database = d }
|
130
|
+
opts.on("-u", "--user USER") { |u| mysql_username = u }
|
131
|
+
opts.on("-p", "--password PW") { |p| mysql_password = p }
|
132
|
+
opts.on("--debug") { debug = true }
|
133
|
+
|
134
|
+
opts.on("-t", "--table TABLE_NAME") { |t| table_name = t }
|
135
|
+
|
136
|
+
opts.parse(ARGV) rescue RDoc::usage('usage')
|
137
|
+
|
138
|
+
if ARGV.size < 1
|
139
|
+
RDoc::usage('usage')
|
140
|
+
exit
|
141
|
+
end
|
142
|
+
|
143
|
+
#
|
144
|
+
# Open MySQL database
|
145
|
+
#
|
146
|
+
|
147
|
+
mysql = Mysql.new(mysql_hostname, mysql_username, mysql_password)
|
148
|
+
mysql.select_db(mysql_database)
|
149
|
+
|
150
|
+
# Put your credentials in this file
|
151
|
+
load('myCredentials.rb')
|
152
|
+
|
153
|
+
# Create new eBay caller object. Omit last argument to use live platform.
|
154
|
+
eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
|
155
|
+
eBay.debug = true if debug
|
156
|
+
|
157
|
+
parents_to_process = [ :id => '', :depth => 0 ]
|
158
|
+
|
159
|
+
#
|
160
|
+
# Traverse entire category tree and import into our database
|
161
|
+
#
|
162
|
+
|
163
|
+
puts "Starting import... Go get some coffee, this is going to take a while..."
|
164
|
+
|
165
|
+
imported_site_wide_info = false
|
166
|
+
i = 0
|
167
|
+
while (some_parents = parents_to_process.first(concurrency)).length > 0
|
168
|
+
seek_depth = some_parents.max { |a,b| a[:depth] <=> b[:depth] }
|
169
|
+
seek_depth = seek_depth[:depth] + 1
|
170
|
+
|
171
|
+
if debug
|
172
|
+
puts "Current process queue:"
|
173
|
+
p parents_to_process
|
174
|
+
puts "Up next:"
|
175
|
+
p some_parents
|
176
|
+
end
|
177
|
+
|
178
|
+
resp = eBay.GetCategories(:DetailLevel => 'ReturnAll', # Return all available info
|
179
|
+
:CategorySideID => site_id,
|
180
|
+
:CategoryParent => (some_parents[0][:id] == '' && some_parents.length == 1) ? '' : some_parents.collect { |a| a[:id] },
|
181
|
+
:ViewAllNotes => true,
|
182
|
+
:LevelLimit => seek_depth)
|
183
|
+
|
184
|
+
parents_to_process -= some_parents
|
185
|
+
|
186
|
+
if !imported_site_wide_info
|
187
|
+
mysql.query("DELETE FROM #{table_name}_info WHERE site_id = #{site_id}")
|
188
|
+
|
189
|
+
mysql.query("INSERT INTO #{table_name}_info VALUES (null, '#{site_id}', '#{resp.categoryVersion}', '#{resp.minimumReservePrice}', #{resp.reduceReserveAllowed},
|
190
|
+
#{resp.reservePriceAllowed}, '#{resp.updateTime}')")
|
191
|
+
|
192
|
+
imported_site_wide_info = true
|
193
|
+
end
|
194
|
+
|
195
|
+
if resp.categoryCount.to_i > 0
|
196
|
+
resp.categoryArray.each do |cat|
|
197
|
+
if cat.categoryLevel.to_i == seek_depth
|
198
|
+
if cat.leafCategory == "false"
|
199
|
+
parents_to_process << { :id => cat.categoryID, :depth => cat.categoryLevel.to_i }
|
200
|
+
puts "Added Category ##{cat.categoryID} to process queue..." if debug
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
# Make sure we don't try to INSERT a category we already have
|
205
|
+
r = mysql.query("SELECT category_id FROM #{table_name} WHERE category_id = #{cat.categoryID} AND site_id = #{site_id}")
|
206
|
+
|
207
|
+
if r.num_rows < 1
|
208
|
+
if cat.categoryID == cat.categoryParentID
|
209
|
+
cat.categoryParentID = "null"
|
210
|
+
else
|
211
|
+
cat.categoryParentID = "'#{cat.categoryParentID}'"
|
212
|
+
end
|
213
|
+
|
214
|
+
cat.categoryName = mysql.escape_string(cat.categoryName)
|
215
|
+
|
216
|
+
# Determine values of conditional fields
|
217
|
+
auto_pay = cat.respond_to?(:autoPayEnabled) ? cat.autoPayEnabled : false
|
218
|
+
b2b_vat = cat.respond_to?(:b2BVATEnabled) ? cat.b2BVATEnabled : false
|
219
|
+
best_offer = cat.respond_to?(:bestOfferEnabled) ? cat.bestOfferEnabled : false
|
220
|
+
orra = cat.respond_to?(:oRRA) ? cat.oRRA : false
|
221
|
+
sge = cat.respond_to?(:sellerGuaranteeEligible) ? cat.sellerGuaranteeEligible : false
|
222
|
+
|
223
|
+
puts "Inserting Category ##{cat.categoryID}: #{cat.categoryName}..." if debug
|
224
|
+
|
225
|
+
#
|
226
|
+
# Do the actual writing to the database
|
227
|
+
#
|
228
|
+
mysql.query("INSERT INTO #{table_name}
|
229
|
+
VALUES (null, '#{site_id}', '#{cat.categoryID}', #{cat.categoryParentID}, '#{cat.categoryName}', '#{cat.categoryLevel}', #{cat.leafCategory},
|
230
|
+
#{cat.expired}, #{cat.virtual}, #{auto_pay}, #{b2b_vat}, #{best_offer}, #{cat.intlAutosFixedCat}, #{cat.lSD}, #{cat.oRPA}, #{orra},
|
231
|
+
#{sge})")
|
232
|
+
|
233
|
+
i += 1
|
234
|
+
puts "Imported #{i} categories so far..." if i % 100 == 0
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
240
|
+
mysql.close
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id: add_item.rb,v 1.11 2006/01/13 09:56:29 garrydolley Exp $
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
+
require 'eBayAPI'
|
6
|
+
|
7
|
+
#
|
8
|
+
# Example of AddItem call
|
9
|
+
#
|
10
|
+
|
11
|
+
load('myCredentials.rb')
|
12
|
+
|
13
|
+
eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
|
14
|
+
|
15
|
+
# Shorter way of passing complex types (implied by hashing) than when we did in v0.5.2 and prior
|
16
|
+
resp = eBay.AddItem(:Item => EBay.Item({ :PrimaryCategory => EBay.Category({ :CategoryID => 57882 }),
|
17
|
+
:Title => 'Mouse Pad',
|
18
|
+
:Description => 'A really cool mouse pad, you know you want it...',
|
19
|
+
:Location => 'On Earth',
|
20
|
+
:StartPrice => '12.0',
|
21
|
+
:Quantity => 1,
|
22
|
+
:ListingDuration => "Days_7",
|
23
|
+
:Country => "US",
|
24
|
+
:Currency => "USD",
|
25
|
+
:PaymentMethods => ["VisaMC", "PersonalCheck"] }))
|
26
|
+
|
27
|
+
puts "New Item #" + resp.itemID + " added."
|
28
|
+
puts "You spent:\n"
|
29
|
+
|
30
|
+
|
31
|
+
# The fees part of the response looks like this:
|
32
|
+
#
|
33
|
+
# <Fees>
|
34
|
+
# <Fee>
|
35
|
+
# <Name>AuctionLengthFee</Name>
|
36
|
+
# <Fee currencyID="USD">0.0</Fee>
|
37
|
+
# </Fee>
|
38
|
+
# <Fee>
|
39
|
+
# <Name>BoldFee</Name>
|
40
|
+
# <Fee currencyID="USD">0.0</Fee>
|
41
|
+
# </Fee>
|
42
|
+
# ...
|
43
|
+
# <Fee>
|
44
|
+
# <Name>InsertionFee</Name>
|
45
|
+
# <Fee currencyID="USD">0.6</Fee>
|
46
|
+
# </Fee>
|
47
|
+
# ...
|
48
|
+
# </Fees>
|
49
|
+
#
|
50
|
+
# So this is now we traverse it:
|
51
|
+
resp.fees.each do |fee|
|
52
|
+
puts fee.name + ": " + fee.fee + " " + fee.fee.xmlattr_currencyID
|
53
|
+
end
|
54
|
+
|
55
|
+
# Notice how the object names reflect the XML element names, and any element
|
56
|
+
# that is repeated automatically becomes an array, so you can run "each" on
|
57
|
+
# it.
|
@@ -0,0 +1,74 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id: add_item.rb,v 1.11 2006/01/13 09:56:29 garrydolley Exp $
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
+
require 'eBayAPI'
|
6
|
+
|
7
|
+
#
|
8
|
+
# Example of AddItem call
|
9
|
+
#
|
10
|
+
|
11
|
+
load('myCredentials.rb')
|
12
|
+
|
13
|
+
eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
|
14
|
+
|
15
|
+
# Added some shipping options
|
16
|
+
|
17
|
+
resp = eBay.AddItem(:Item => EBay.Item({ :PrimaryCategory => EBay.Category(:CategoryID => 57882),
|
18
|
+
:Title => 'Mouse Pad',
|
19
|
+
:Description => 'A really cool mouse pad, you know you want it...',
|
20
|
+
:Location => 'USA',
|
21
|
+
:StartPrice => '0.50',
|
22
|
+
:BuyItNowPrice => '9.50',
|
23
|
+
:Quantity => 1,
|
24
|
+
:ShippingDetails => EBay.ShippingDetails(
|
25
|
+
:ShippingServiceOptions => [
|
26
|
+
EBay.ShippingServiceOptions(
|
27
|
+
:ShippingService => ShippingServiceCodeType::USPSPriority,
|
28
|
+
:ShippingServiceCost => '0.0',
|
29
|
+
:ShippingServiceAdditionalCost => '0.0'),
|
30
|
+
EBay.ShippingServiceOptions(
|
31
|
+
:ShippingService => ShippingServiceCodeType::USPSPriorityFlatRateBox,
|
32
|
+
:ShippingServiceCost => '7.0',
|
33
|
+
:ShippingServiceAdditionalCost => '0.0')]),
|
34
|
+
:ShippingTermsInDescription => false,
|
35
|
+
:ShipToLocations => "US",
|
36
|
+
:ShipToLocations => "CA",
|
37
|
+
:ListingDuration => "Days_7",
|
38
|
+
:Country => "US",
|
39
|
+
:Currency => "USD",
|
40
|
+
:PayPalEmailAddress => "foobar@example.com",
|
41
|
+
:PaymentMethods => ["VisaMC", "PayPal"] }))
|
42
|
+
|
43
|
+
|
44
|
+
puts "New Item #" + resp.itemID + " added."
|
45
|
+
puts "You spent:\n"
|
46
|
+
|
47
|
+
|
48
|
+
# The fees part of the response looks like this:
|
49
|
+
#
|
50
|
+
# <Fees>
|
51
|
+
# <Fee>
|
52
|
+
# <Name>AuctionLengthFee</Name>
|
53
|
+
# <Fee currencyID="USD">0.0</Fee>
|
54
|
+
# </Fee>
|
55
|
+
# <Fee>
|
56
|
+
# <Name>BoldFee</Name>
|
57
|
+
# <Fee currencyID="USD">0.0</Fee>
|
58
|
+
# </Fee>
|
59
|
+
# ...
|
60
|
+
# <Fee>
|
61
|
+
# <Name>InsertionFee</Name>
|
62
|
+
# <Fee currencyID="USD">0.6</Fee>
|
63
|
+
# </Fee>
|
64
|
+
# ...
|
65
|
+
# </Fees>
|
66
|
+
#
|
67
|
+
# So this is now we traverse it:
|
68
|
+
resp.fees.each do |fee|
|
69
|
+
puts fee.name + ": " + fee.fee + " " + fee.fee.xmlattr_currencyID
|
70
|
+
end
|
71
|
+
|
72
|
+
# Notice how the object names reflect the XML element names, and any element
|
73
|
+
# that is repeated automatically becomes an array, so you can run "each" on
|
74
|
+
# it.
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id: get_account.rb,v 1.7 2005/12/27 01:17:01 garrydolley Exp $
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
+
require 'eBayAPI'
|
6
|
+
|
7
|
+
#
|
8
|
+
# Example of GetAccount call requesting the last monthly statement
|
9
|
+
#
|
10
|
+
|
11
|
+
load('myCredentials.rb')
|
12
|
+
|
13
|
+
eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
|
14
|
+
|
15
|
+
resp = eBay.GetAccount(:AccountHistorySelection => 'LastInvoice')
|
16
|
+
|
17
|
+
puts "AccountID: " + resp.accountID
|
18
|
+
puts "Account Summary -- Account State: " + resp.accountSummary.accountState
|
19
|
+
|
20
|
+
# Not all statements will have an <AccountState>, so we only print it if present
|
21
|
+
puts "Account Summary -- Account State: " + resp.accountSummary.accountState if resp.accountSummary.respond_to?(:accountState)
|
22
|
+
|
23
|
+
# Some statements may not have any entries in them (no sales that month?), so
|
24
|
+
# we must test to make sure "accountEntries" exists before we traverse it.
|
25
|
+
if resp.respond_to?(:accountEntries)
|
26
|
+
resp.accountEntries.each do |entry|
|
27
|
+
puts "Account Entries -- Description: " + entry.description
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Many more fields may be present, see eBay's SOAP API Guide or GetAccountResponseType class in "../lib/eBay.rb"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id: get_account2.rb,v 1.5 2005/12/27 01:17:01 garrydolley Exp $
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
+
require 'eBayAPI'
|
6
|
+
|
7
|
+
#
|
8
|
+
# Example of GetAccount call requesting a specific monthly statement
|
9
|
+
#
|
10
|
+
|
11
|
+
load('myCredentials.rb')
|
12
|
+
|
13
|
+
eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
|
14
|
+
|
15
|
+
resp = eBay.GetAccount(:AccountHistorySelection => 'SpecifiedInvoice', :InvoiceDate => '2008-03-01')
|
16
|
+
|
17
|
+
puts "AccountID: " + resp.accountID
|
18
|
+
puts "Account Summary -- Invoice Balance: " + resp.accountSummary.invoiceBalance
|
19
|
+
|
20
|
+
# Not all statements will have an <AccountState>, so we only print it if present
|
21
|
+
puts "Account Summary -- Account State: " + resp.accountSummary.accountState if resp.accountSummary.respond_to?(:accountState)
|
22
|
+
|
23
|
+
# Some statements may not have any entries in them (no sales that month?), so
|
24
|
+
# we must test to make sure "accountEntries" exists before we traverse it.
|
25
|
+
if resp.respond_to?(:accountEntries)
|
26
|
+
resp.accountEntries.each do |entry|
|
27
|
+
puts "Account Entries -- Description: " + entry.description
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Many more fields may be present, see eBay's SOAP API Guide or GetAccountResponseType class in "../lib/eBay.rb"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# $Id: get_account3.rb,v 1.5 2005/12/27 01:17:01 garrydolley Exp $
|
3
|
+
|
4
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
5
|
+
require 'eBayAPI'
|
6
|
+
|
7
|
+
#
|
8
|
+
# Example of GetAccount call requesting all statements in a date range
|
9
|
+
#
|
10
|
+
|
11
|
+
load('myCredentials.rb')
|
12
|
+
|
13
|
+
eBay = EBay::API.new($authToken, $devId, $appId, $certId, :sandbox => true)
|
14
|
+
|
15
|
+
resp = eBay.GetAccount(:AccountHistorySelection => 'BetweenSpecifiedDates', :BeginDate => '2005-10-01', :EndDate => '2005-11-01')
|
16
|
+
|
17
|
+
puts "AccountID: " + resp.accountID
|
18
|
+
puts "Account Summary -- Invoice Balance: " + resp.accountSummary.invoiceBalance if resp.accountSummary.respond_to?(:invoiceBalance)
|
19
|
+
|
20
|
+
# Not all statements will have an <AccountState>, so we only print it if present
|
21
|
+
puts "Account Summary -- Account State: " + resp.accountSummary.accountState if resp.accountSummary.respond_to?(:accountState)
|
22
|
+
|
23
|
+
# Some statements may not have any entries in them (no sales that month?), so
|
24
|
+
# we must test to make sure "accountEntries" exists before we traverse it.
|
25
|
+
if resp.respond_to?(:accountEntries)
|
26
|
+
resp.accountEntries.each do |entry|
|
27
|
+
puts "Account Entries -- Description: " + entry.description
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Many more fields may be present, see eBay's SOAP API Guide or GetAccountResponseType class in "../lib/eBay.rb"
|