Class: Lazada::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty, API::Brand, API::Category, API::Feed, API::Image, API::Order, API::Product, API::Shipment
Defined in:
lib/lazada_dino/client.rb

Instance Method Summary collapse

Methods included from API::Shipment

#get_shipment_providers, #set_status_to_packed, #set_status_to_shipped

Methods included from API::Brand

#get_brands

Methods included from API::Order

#get_multiple_order_items, #get_order, #get_order_items, #get_orders

Methods included from API::Image

#migrate_image, #migrate_images, #set_images

Methods included from API::Feed

#feed_list, #feed_status

Methods included from API::Category

#get_categories, #get_category_attributes

Methods included from API::Product

#create_product, #get_products, #get_qc_status, #remove_product, #update_product

Constructor Details

#initialize(api_key, user_id, opts = {}) ⇒ Client

Valid opts:

  • tld: Top level domain to use (.com.my, .sg, .th…). Default: com.my

  • debug: $stdout, Rails.logger. Log http requests



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/lazada_dino/client.rb', line 32

def initialize(api_key, user_id, opts = {})
  @api_key = api_key
  @user_id = user_id
  @timezone = opts[:timezone] || 'Singapore'
  @raise_exceptions = opts[:raise_exceptions] || true
  @tld = opts[:tld] || ".com.my"

  # Definitely not thread safe, as the base uri is a class variable.
  # self.class.base_uri "https://api.sellercenter.lazada#{opts[:tld]}" if opts[:tld].present?
  self.class.debug_output opts[:debug] if opts[:debug].present?
end