Module: EcwidApi

Defined in:
lib/ecwid_api.rb,
lib/ecwid_api/error.rb,
lib/ecwid_api/client.rb,
lib/ecwid_api/version.rb

Overview

Public: This is the main namespace for the EcwidApi. It can be used to store the default client.

Defined Under Namespace

Classes: Client, Error

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.default_client(&block) ⇒ Object

Public: Gets and configures a default client

To configure the default client, just pass a block.

Examples

EcwidApi.default_client do |config|
  config.store_id = '12345'
  config.order_secret_key = 'ORDER_SECRET_KEY'
  config.product_secret_key = 'PRODUCT_SECRET_KEY'
end

client = EcwidApi.default_client.store_id
# => "12345"

Returns an EcwidApi::Client, or null if one hasn’t been configured



27
28
29
30
31
32
# File 'lib/ecwid_api.rb', line 27

def default_client(&block)
  if block_given?
    @default_client = Client.new(&block)
  end
  @default_client
end