Class: Lytix::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/lytix/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, name = nil) ⇒ Account



5
6
7
# File 'lib/lytix/account.rb', line 5

def initialize(key, name = nil)
  @key, @name = key, name
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/lytix/account.rb', line 3

def key
  @key
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/lytix/account.rb', line 3

def name
  @name
end

Instance Method Details

#tracker(*args, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/lytix/account.rb', line 9

def tracker(*args, &block)
  if block_given?
    @tracker_configuration = block
  else
    returning(MethodList.new) do |tracker|
      if @tracker_configuration
        @tracker_configuration.bind(tracker).call(*args)
      end
    end
  end
end

#transaction(*args, &block) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/lytix/account.rb', line 21

def transaction(*args, &block)
  if block_given?
    @transaction_configuration = block
  else
    returning(MethodList.new) do |transaction|
      if @transaction_configuration
        @transaction_configuration.bind(transaction).call(*args)
      end
    end
  end
end