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.
-
#options ⇒ Object
Returns the value of attribute options.
-
#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
- .base_properties ⇒ Object
- .defaults ⇒ Object
- .optional_properties ⇒ Object
- .revenue_properties ⇒ Object
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
14 15 16 |
# File 'lib/amplitude_api/config.rb', line 14 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.
10 11 12 |
# File 'lib/amplitude_api/config.rb', line 10 def api_key @api_key end |
#event_properties_formatter ⇒ Object
Returns the value of attribute event_properties_formatter.
10 11 12 |
# File 'lib/amplitude_api/config.rb', line 10 def event_properties_formatter @event_properties_formatter end |
#options ⇒ Object
Returns the value of attribute options.
10 11 12 |
# File 'lib/amplitude_api/config.rb', line 10 def @options end |
#secret_key ⇒ Object
Returns the value of attribute secret_key.
10 11 12 |
# File 'lib/amplitude_api/config.rb', line 10 def secret_key @secret_key end |
#time_formatter ⇒ Object
Returns the value of attribute time_formatter.
10 11 12 |
# File 'lib/amplitude_api/config.rb', line 10 def time_formatter @time_formatter end |
#user_properties_formatter ⇒ Object
Returns the value of attribute user_properties_formatter.
10 11 12 |
# File 'lib/amplitude_api/config.rb', line 10 def user_properties_formatter @user_properties_formatter end |
#whitelist ⇒ Object
Returns the value of attribute whitelist.
10 11 12 |
# File 'lib/amplitude_api/config.rb', line 10 def whitelist @whitelist end |
Class Method Details
.base_properties ⇒ Object
19 20 21 |
# File 'lib/amplitude_api/config.rb', line 19 def base_properties %i[event_type event_properties user_properties user_id device_id] end |
.defaults ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/amplitude_api/config.rb', line 40 def defaults { api_key: nil, secret_key: nil, whitelist: base_properties + revenue_properties + optional_properties, time_formatter: ->(time) { time ? time.to_i * 1_000 : nil }, event_properties_formatter: ->(props) { props || {} }, user_properties_formatter: ->(props) { props || {} } } end |
.optional_properties ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/amplitude_api/config.rb', line 27 def optional_properties %i[ time ip platform country insert_id groups app_version os_name os_version device_brand device_manufacturer device_model carrier region city dma language location_lat location_lng idfa idfv adid android_id event_id session_id ] end |
.revenue_properties ⇒ Object
23 24 25 |
# File 'lib/amplitude_api/config.rb', line 23 def revenue_properties %i[revenue_type product_id revenue price quantity] end |