Class: EbaySource
Constant Summary collapse
- EBAY_MERCHANT_PERMALINK =
'ebay'
- EBAY_AFFILIATE_PID =
'711-53200-19255-0'
- EBAY_DEFAULT_CAMPAIGN_ID =
'5336205246'
- EBAY_ADMIN_CAMPAIGN_ID =
'5336210401'
- EBAY_AFFILIATE_URL_PREFIX =
"http://rover.ebay.com/rover/1/#{EBAY_AFFILIATE_PID}/1?type=4&campid=#{EBAY_DEFAULT_CAMPAIGN_ID}&toolid=10001&customid=&mpre="
Constants inherited from Source
Source::SIMPLE_SOURCES_YAML_FILE
Instance Attribute Summary
Attributes inherited from Source
#batch_fetch_delay, #cpc, #for_product_info, #for_review_aggregates, #homepage, #mappable, #name, #offer_affiliate, #offer_enabled, #offer_ttl_seconds, #product_code_examples, #product_code_regexp, #product_page_link_erb, #search_token_separator, #search_url, #supports_lifetime_ratings, #use_for_merchant_ratings
Instance Method Summary collapse
- #affiliate_wrap_deal_url(deal_url, nullify = false) ⇒ Object
-
#initialize ⇒ EbaySource
constructor
A new instance of EbaySource.
- #nullify_offer_url(offer_url) ⇒ Object
- #offer_affiliate_for_merchant?(merchant) ⇒ Boolean
Methods inherited from Source
affiliate_sources, #code_from_merchant_source_page_url, #eql?, #fetch_merchant_source, #fetch_offers, #format_rating, #hash, inherited, #keyname, keyname, keyname=, merchant_rating_sources, method_missing, offer_sources, #product_code_valid?, #product_page_link, source, sources, #to_s, #url_for_merchant_source_page, #url_for_merchant_source_page_alt
Constructor Details
#initialize ⇒ EbaySource
Returns a new instance of EbaySource.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/sources/ebay_source.rb', line 8 def initialize super(:name => 'eBay.com', :homepage => 'http://www.ebay.com/', :cpc => 10, :offer_enabled => false, :offer_ttl_seconds => 86400, :use_for_merchant_ratings => false, :offer_affiliate => true, :supports_lifetime_ratings => false, :batch_fetch_delay => 2, :product_code_regexp => nil, :product_code_examples => []) end |
Instance Method Details
#affiliate_wrap_deal_url(deal_url, nullify = false) ⇒ Object
30 31 32 33 34 |
# File 'lib/sources/ebay_source.rb', line 30 def affiliate_wrap_deal_url(deal_url, nullify=false) offer_url = EBAY_AFFILIATE_URL_PREFIX offer_url += CGI::escape(deal_url) nullify ? nullify_offer_url(offer_url) : offer_url end |
#nullify_offer_url(offer_url) ⇒ Object
22 23 24 |
# File 'lib/sources/ebay_source.rb', line 22 def nullify_offer_url(offer_url) offer_url.gsub(/#{EBAY_DEFAULT_CAMPAIGN_ID}/, EBAY_ADMIN_CAMPAIGN_ID) end |
#offer_affiliate_for_merchant?(merchant) ⇒ Boolean
26 27 28 |
# File 'lib/sources/ebay_source.rb', line 26 def offer_affiliate_for_merchant?(merchant) !merchant.nil? && merchant.permalink == EBAY_MERCHANT_PERMALINK end |