Module: TipsanityMerchantExtractor::Cj::FindCj

Includes:
TipsanityMerchantExtractor::Cj
Defined in:
lib/tipsanity_merchant_extractor/cj.rb

Instance Method Summary collapse

Methods included from TipsanityMerchantExtractor::Cj

#call_to_cj, extended

Methods included from OneEightThousandLighting

#extract_cj_one_eight_thousand_lighting, #find_product_one_eight_thousand_lighting, #is_merchant_cj_one_eight_thousand_lighting?

Methods included from BestBuy

#extract_cj_bestbuy, #find_product_best_buy, #is_merchant_cj_bestbuy?

Instance Method Details

#find_product_cj(merchant_url) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/tipsanity_merchant_extractor/cj.rb', line 28

def find_product_cj merchant_url
  call_to_cj(merchant_url, @options[:cj][:developer_key], @options[:cj][:website_id]) do |product|
    if product

      @product_name = product.name
      @description = product.description
      @list_price = product.price
      @currency_code = product.currency
      @image_url = product.image_url
      @details_url = product.buy_url
      @categories = product.advertiser_category
      @response_object = product
      @product_token = self.class.extract_cj_bestbuy(@merchant_url){|product_name, query| CGI.parse(query)["skuId"].first}
    else
      @product_name = nil
      @description = nil
      @list_price = nil
      @currency_code = nil
      @image_url = nil
      @details_url = nil
      @categories = nil
      @response_object = nil
    end
  end
end