Module: Yotpo::Product

Included in:
Client
Defined in:
lib/yotpo/api/product.rb

Instance Method Summary collapse

Instance Method Details

#get_all_bottom_lines(params) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/yotpo/api/product.rb', line 3

def get_all_bottom_lines(params)
  request = {
      utoken: params[:utoken],
      since_date: params[:since_date],
      since_id: params[:since_id]
  }
  request.delete_if{|key,val| val.nil?}
  app_key = params[:app_key]
  get("/apps/#{app_key}/bottom_lines", request)
end

#get_product_bottom_line(params) ⇒ Object

Retrieves the bottom line of a product

Parameters:

  • params (Hash)

Options Hash (params):

  • :app_key (String)

    the accounts app key that was given to it upon registration

  • :product_id (String)

    the id of the product



24
25
26
27
28
# File 'lib/yotpo/api/product.rb', line 24

def get_product_bottom_line(params)
  app_key = params[:app_key]
  sku = params[:product_id]
  get("/products/#{app_key}/#{sku}/bottomline")
end

#get_product_url(params) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/yotpo/api/product.rb', line 30

def get_product_url(params)
  app_key = params[:app_key]
  product_id = params[:product_id]
  request = {
      utoken: params[:utoken],
      reference: params[:reference],
      source: params[:source],
      sub_reference: params[:sub_reference]
  }
  request[:product_id] = product_id if product_id
  get("/products/#{app_key}/product_url", request)
end

#get_products_information(params) ⇒ Object



14
15
16
17
# File 'lib/yotpo/api/product.rb', line 14

def get_products_information(params)
  app_key = params[:app_key]
  get("/v1/widget/#{app_key}/products/products_information", { domain_keys: params[:domain_keys], ref_name: params[:ref_name] })
end