Method: CTM::Base#initialize

Defined in:
lib/ctm/base.rb

#initialize(data, token = nil) ⇒ Base

Returns a new instance of Base.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ctm/base.rb', line 20

def initialize(data, token=nil)
  @token = token || CTM::Auth.token
  @account_id = data['account_id']
  @list_token_type = case self.class.to_s
                     when 'CTM::Sale' then 'calls'
                     else
                       self.class.to_s.sub(/CTM::/,'').underscore.pluralize
                     end
  if @account_id
    @list_type_path = "accounts/#{@account_id}/#{@list_token_type}"
  else
    @list_type_path = @list_token_type
  end
end