Module: Aggcat

Extended by:
Configurable
Defined in:
lib/aggcat.rb,
lib/aggcat/base.rb,
lib/aggcat/client.rb,
lib/aggcat/version.rb,
lib/aggcat/configurable.rb

Defined Under Namespace

Modules: Configurable Classes: Base, Client

Constant Summary collapse

VERSION =
'1.0.1'

Constants included from Configurable

Configurable::KEYS

Class Method Summary collapse

Methods included from Configurable

configure

Class Method Details

.clientObject

Raises:

  • (ArgumentError)


18
19
20
21
# File 'lib/aggcat.rb', line 18

def client
  raise ArgumentError.new('set the client scope first by calling Aggcat.scope(customer_id)') unless defined?(@customer_id)
  @client
end

.scope(customer_id) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/aggcat.rb', line 10

def scope(customer_id)
  if !defined?(@customer_id) || @customer_id != customer_id
    @customer_id = customer_id
    @client = Aggcat::Client.new(options.merge({customer_id: customer_id}))
  end
  @client
end