Class: Itly::Plugin::Amplitude::CallOptions

Inherits:
Itly::PluginCallOptions
  • Object
show all
Defined in:
lib/itly/plugin/amplitude/call_options.rb

Overview

Amplitude specific plugin options class

Constant Summary collapse

PROPS =
%w[device_id time groups app_version platform os_name os_version device_brand device_manufacturer
device_model carrier country region city dma language price quantity revenue productId revenueType
location_lat location_lng ip idfa idfv adid android_id event_id session_id insert_id].freeze

Instance Method Summary collapse

Instance Method Details

#to_hashHash

Return all properties to be passed to the client While excluding the ‘callback` property

Returns:

  • (Hash)

    properties



33
34
35
# File 'lib/itly/plugin/amplitude/call_options.rb', line 33

def to_hash
  PROPS.each_with_object({}) { |prop, hash| hash[prop.to_sym] = send(prop) unless send(prop).nil? }
end

#to_sString

Get the plugin description, for logs

Returns:

  • (String)

    description



42
43
44
45
46
# File 'lib/itly/plugin/amplitude/call_options.rb', line 42

def to_s
  class_name = self.class.name.split('::').last
  props = PROPS.collect { |prop| " #{prop}: #{send prop}" unless send(prop).nil? }.compact
  "#<Amplitude::#{class_name} callback: #{callback.nil? ? 'nil' : 'provided'}#{props.join}>"
end