Skip to content

Commit fb3e528

Browse files
author
Chris Taggart
committed
Initial commit of gem version of ebay_shopping plugin. Not yet working
0 parents  commit fb3e528

26 files changed

+3109
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

History.txt

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
== 0.1.0 2008-05-12
2+
3+
* 1 major enhancement:
4+
* Converted to gem from Rails plugin
5+
6+
March 2
7+
* Backed out of r12. No longer raise TimeoutError when error code 1.23 return. Now re-attempts call, then returns SystemError
8+
9+
* Jan 20
10+
* Raise TimeoutError when ebay internal timeout error (Error code 1.23)
11+
12+
* January 13
13+
* Changed instance variable used in FindProductsResponse#products to @products
14+
15+
* January 12, 2008
16+
* Added support for FindProducts call
17+
* Added GenericItem class from which Item class and new Product class inherit
18+
19+
* January 11, 2008
20+
* Tweaked error handling so ebay's error response is passed to ebay_error_raised hook
21+
* Made Request#check_error_cache a protected method
22+
* Changed ebay API version to 547
23+
* Cached error checking now done before checking for cached response
24+
* Changed name of cached_response to cached_xml_response. cached_response is better name for a public method, which might return Response object, if there's a cached_xml_response, nil otherwise. Allows loading of pages to be speeded up, with queries perhaps being triggered on demand (and then cached) or by js
25+
26+
* January 10, 2008
27+
* First checkin on plugin

License.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2008 FIXME full name
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.txt

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
= ebay_shopping
2+
3+
* FIX (url)
4+
5+
== DESCRIPTION:
6+
7+
Ebay_Shopping Plugin
8+
===================
9+
10+
The ebay_shopping plugin is a RubyonRails library for Ebay's Shopping API (http://developer.ebay.com/products/shopping/).
11+
Unlike the trading API (http://developer.ebay.com/products/trading/), the shopping API is only for retrieval of information, not
12+
for posting items, or bidding on them.
13+
14+
If you need that sort of thing, check out Cody Fauser's gem for the trading API (http://code.google.com/p/ebay/). If you don't,
15+
the Shopping API is simpler, leaner, and quite a bit faster too.
16+
17+
Ebay_Shopping was developed by Chris Taggart for Autopendium :: Stuff about old cars (http://autopendium.com), a classic car
18+
community site. It's still in development, and news of updates will be posted at http://pushrod.wordpress.com
19+
20+
Installation
21+
============
22+
23+
To install, simply run the usual: script/plugin install http://ebay-shopping.googlecode.com/svn/trunk/ ebay_shopping
24+
25+
Then from the root of your rails app run ruby vendor/plugins/ebay_shopping/install.rb.
26+
27+
This will copy a basic configuration file into your app's config directory. This is where
28+
you put your ebay settings (Ebay Application id, affiliate info, etc).
29+
30+
Basic usage
31+
===========
32+
33+
Then from your rails app, construct a new request ebay request:
34+
35+
request = EbayShopping::Request.new(:find_items, {:query_keywords => "chevrolet camaro"}) # use "ruby-ized" version of Ebay API calls and params
36+
37+
response = request.response
38+
39+
response.total_items # => 7081
40+
41+
items_for_sale = response.items
42+
43+
items_for_sale.first.title # => "Chevrolet Camaro"
44+
45+
items_for_sale.first.view_item_url_for_natural_search # => "http://cgi.ebay.com/Chevrolet-Camaro_W0QQitemZ290197239377QQcategoryZ6161QQcmdZViewItemQQ"
46+
47+
items_for_sale.first.gallery_url # => "http://thumbs.ebaystatic.com/pict/290197239377.jpg"
48+
49+
items_for_sale.first.converted_current_price.to_s # => "$38000.00"
50+
51+
...etc
52+
53+
For more methods and more details see the test suite, the comments with the class and method definitions, or wait for me to write more stuff.
54+
== FEATURES/PROBLEMS:
55+
56+
* FIX (list of features or problems)
57+
58+
== SYNOPSIS:
59+
60+
FIX (code sample of usage)
61+
62+
== REQUIREMENTS:
63+
64+
* FIX (list of requirements)
65+
66+
== INSTALL:
67+
68+
* FIX (sudo gem install, anything else)
69+
70+
== LICENSE:
71+
72+
(The MIT License)
73+
74+
Copyright (c) 2008 FIX
75+
76+
Permission is hereby granted, free of charge, to any person obtaining
77+
a copy of this software and associated documentation files (the
78+
'Software'), to deal in the Software without restriction, including
79+
without limitation the rights to use, copy, modify, merge, publish,
80+
distribute, sublicense, and/or sell copies of the Software, and to
81+
permit persons to whom the Software is furnished to do so, subject to
82+
the following conditions:
83+
84+
The above copyright notice and this permission notice shall be
85+
included in all copies or substantial portions of the Software.
86+
87+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
88+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
89+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
90+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
91+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
92+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
93+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Rakefile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
require 'config/requirements'
2+
require 'config/hoe' # setup Hoe + all gem configuration
3+
4+
Dir['tasks/**/*.rake'].each { |rake| load rake }

TODO

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* Add more reader methods for Products and Item classes and add FindProductsResponse#total products

config/hoe.rb

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
require 'ebay_shopping/version'
2+
3+
AUTHOR = 'Chris Taggart' # can also be an array of Authors
4+
EMAIL = "chris.taggart@pushrodmedia.co.uk"
5+
DESCRIPTION = "A Ruby library for Ebay's lightweight Shopping API"
6+
GEM_NAME = 'ebay_shopping' # what ppl will type to install your gem
7+
RUBYFORGE_PROJECT = 'ebay_shopping' # The unix name for your project
8+
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
9+
DOWNLOAD_PATH = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
10+
EXTRA_DEPENDENCIES = [
11+
['xmlsimple', '>= 1.0.11']
12+
] # An array of rubygem dependencies [name, version]
13+
14+
@config_file = "~/.rubyforge/user-config.yml"
15+
@config = nil
16+
RUBYFORGE_USERNAME = "unknown"
17+
def rubyforge_username
18+
unless @config
19+
begin
20+
@config = YAML.load(File.read(File.expand_path(@config_file)))
21+
rescue
22+
puts <<-EOS
23+
ERROR: No rubyforge config file found: #{@config_file}
24+
Run 'rubyforge setup' to prepare your env for access to Rubyforge
25+
- See http://newgem.rubyforge.org/rubyforge.html for more details
26+
EOS
27+
exit
28+
end
29+
end
30+
RUBYFORGE_USERNAME.replace @config["username"]
31+
end
32+
33+
34+
REV = nil
35+
# UNCOMMENT IF REQUIRED:
36+
# REV = YAML.load(`svn info`)['Revision']
37+
VERS = EbayShopping::VERSION::STRING + (REV ? ".#{REV}" : "")
38+
RDOC_OPTS = ['--quiet', '--title', 'ebay_shopping documentation',
39+
"--opname", "index.html",
40+
"--line-numbers",
41+
"--main", "README",
42+
"--inline-source"]
43+
44+
class Hoe
45+
def extra_deps
46+
@extra_deps.reject! { |x| Array(x).first == 'hoe' }
47+
@extra_deps
48+
end
49+
end
50+
51+
# Generate all the Rake tasks
52+
# Run 'rake -T' to see list of generated tasks (from gem root directory)
53+
$hoe = Hoe.new(GEM_NAME, VERS) do |p|
54+
p.developer(AUTHOR, EMAIL)
55+
p.description = DESCRIPTION
56+
p.summary = DESCRIPTION
57+
p.url = HOMEPATH
58+
p.rubyforge_name = RUBYFORGE_PROJECT if RUBYFORGE_PROJECT
59+
p.test_globs = ["test/**/test_*.rb"]
60+
p.clean_globs |= ['**/.*.sw?', '*.gem', '.config', '**/.DS_Store'] #An array of file patterns to delete on clean.
61+
62+
# == Optional
63+
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
64+
#p.extra_deps = EXTRA_DEPENDENCIES
65+
66+
#p.spec_extras = {} # A hash of extra values to set in the gemspec.
67+
end
68+
69+
CHANGES = $hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
70+
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
71+
$hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
72+
$hoe.rsync_args = '-av --delete --ignore-errors'
73+
$hoe.spec.post_install_message = File.open(File.dirname(__FILE__) + "/../PostInstall.txt").read rescue ""

config/requirements.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
require 'fileutils'
2+
include FileUtils
3+
4+
require 'rubygems'
5+
%w[rake hoe newgem rubigen].each do |req_gem|
6+
begin
7+
require req_gem
8+
rescue LoadError
9+
puts "This Rakefile requires the '#{req_gem}' RubyGem."
10+
puts "Installation: gem install #{req_gem} -y"
11+
exit
12+
end
13+
end
14+
15+
$:.unshift(File.join(File.dirname(__FILE__), %w[.. lib]))

ebay.yml.tpl

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
:production:
3+
:app_id:
4+
:affiliate_partner: "1" # the affiliate provider (aka tracking partner). For Commission Junction this is 1. For others see http://developer.ebay.com/DevZone/shopping/docs/Concepts/ShoppingAPI_FormatOverview.html#AffiliateURLParameters
5+
:affiliate_id: # your site's affiliate id, also known as tracking id, or PID
6+
:affiliate_shopper_id: "my_campaign" # default campaign identifier, also known (confusingly) as affiliate_user_id, or SID. Only applicable if affiliate provider is Commission Junction
7+
:default_site_id: # set the default ebay country here (for details see http://developer.ebay.com/DevZone/shopping/docs/CallRef/types/SiteCodeType.html). If this is blank, the US site (site_id=0) is used by ebay. Can be overridden on individual requests
8+
9+
# if you want to have different params for different environments specify them here, otherwise the production settings will be used for that environment
10+
# :development:
11+
# :app_id: some other id
12+
# :affiliate_partner: "1"
13+
# :affiliate_id:
14+
# :default_site_id:

0 commit comments

Comments
 (0)