Class: AmplitudeAPI::Config
- Inherits:
-
Object
- Object
- AmplitudeAPI::Config
- Includes:
- Singleton
- Defined in:
- lib/amplitude_api/config.rb
Overview
AmplitudeAPI::Config
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#event_properties_formatter ⇒ Object
Returns the value of attribute event_properties_formatter.
-
#secret_key ⇒ Object
Returns the value of attribute secret_key.
-
#time_formatter ⇒ Object
Returns the value of attribute time_formatter.
-
#user_properties_formatter ⇒ Object
Returns the value of attribute user_properties_formatter.
-
#whitelist ⇒ Object
Returns the value of attribute whitelist.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
11 12 13 |
# File 'lib/amplitude_api/config.rb', line 11 def initialize self.class.defaults.each { |k, v| send("#{k}=", v) } end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/amplitude_api/config.rb', line 8 def api_key @api_key end |
#event_properties_formatter ⇒ Object
Returns the value of attribute event_properties_formatter.
8 9 10 |
# File 'lib/amplitude_api/config.rb', line 8 def event_properties_formatter @event_properties_formatter end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
8 9 10 |
# File 'lib/amplitude_api/config.rb', line 8 def secret_key @secret_key end |
#time_formatter ⇒ Object
Returns the value of attribute time_formatter.
8 9 10 |
# File 'lib/amplitude_api/config.rb', line 8 def time_formatter @time_formatter end |
#user_properties_formatter ⇒ Object
Returns the value of attribute user_properties_formatter.
8 9 10 |
# File 'lib/amplitude_api/config.rb', line 8 def user_properties_formatter @user_properties_formatter end |
#whitelist ⇒ Object
Returns the value of attribute whitelist.
8 9 10 |
# File 'lib/amplitude_api/config.rb', line 8 def whitelist @whitelist end |
Class Method Details
.defaults ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/amplitude_api/config.rb', line 16 def defaults { api_key: nil, secret_key: nil, whitelist: %i[user_id device_id event_type time event_properties user_properties time ip platform country insert_id revenue_type price quantity product_id], time_formatter: ->(time) { time ? time.to_i * 1_000 : nil }, event_properties_formatter: ->(props) { props || {} }, user_properties_formatter: ->(props) { props || {} } } end |