Class: CleverTap::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/clever_tap/config.rb

Overview

CleverTap instance’s config store object

Constant Summary collapse

DEFAULT_IDENTITY_FIELD =
'identity'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**config) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
13
# File 'lib/clever_tap/config.rb', line 8

def initialize(**config)
  @account_id = config[:account_id]
  @passcode = config[:passcode]
  @identity_field = config[:identity_field] || DEFAULT_IDENTITY_FIELD
  @configure_faraday = config[:configure_faraday]
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



6
7
8
# File 'lib/clever_tap/config.rb', line 6

def 
  @account_id
end

#identity_fieldObject

Returns the value of attribute identity_field.



6
7
8
# File 'lib/clever_tap/config.rb', line 6

def identity_field
  @identity_field
end

#passcodeObject

Returns the value of attribute passcode.



6
7
8
# File 'lib/clever_tap/config.rb', line 6

def passcode
  @passcode
end

Instance Method Details

#configure_faraday(&block) ⇒ Object

NOTE: reader or writer depending if the block is given



16
17
18
# File 'lib/clever_tap/config.rb', line 16

def configure_faraday(&block)
  block ? @configure_faraday = block : @configure_faraday
end

#validateObject



20
21
22
23
# File 'lib/clever_tap/config.rb', line 20

def validate
  raise 'Missing authentication parameter `account_id`' unless 
  raise 'Missing authentication parameter `passcode`' unless passcode
end