Prev | Current Page 171 | Next

David Berube

"Practical Reporting with Ruby and Rails"

pdf. If you open it, you should see
something similar to Figure 6-2.
CHAPTER 6 n TRACKING AUCTIONS WITH EBAY 121
Figure 6-2. Average price report output PDF in Adobe Reader
Let??™s take a look at a few important lines from this example.
Dissecting the eBay Web Services Code
In Listing 6-2, the script first parses the arguments from the command line, which is
fairly straightforward. After that, you define a class that can be used to get the average
price of certain combinations of keywords and sellers:
class EBaySearch
@@ebay_config = {
:ebay_address=> 'rest.api.ebay.com',
:request_token => 'my_request_token',
:user_id => 'my_ebay_user_id' }.freeze # Insert your request token
# and eBay user ID here.
CHAPTER 6 n TRACKING AUCTIONS WITH EBAY 122
def self.get_average_price(keyword, seller_id=nil)
params = {
# Authorization information . . .
'RequestToken' => @@ebay_config[:request_token],
'RequestUserId' => @@ebay_config[:user_id],
# Function name
'CallName' => 'GetSearchResults',
# Search parameters
'Query'=>URI.


Pages:
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183
Malcolm McLaren fajna muza Scott McKenzie MC Lyte mapa muzykowo