class Itly::Plugin::Segment::CallOptions

Segment specific plugin options class

Attributes

anonymous_id[R]
callback[R]
context[R]
integrations[R]
message_id[R]
timestamp[R]

Public Class Methods

new( callback: nil, integrations: nil, context: nil, message_id: nil, timestamp: nil, anonymous_id: nil ) click to toggle source
Calls superclass method
# File lib/itly/plugin/segment/call_options.rb, line 13
def initialize(
  callback: nil, integrations: nil, context: nil, message_id: nil, timestamp: nil, anonymous_id: nil
)
  super()
  @integrations = integrations
  @callback = callback
  @context = context
  @message_id = message_id
  @timestamp = timestamp
  @anonymous_id = anonymous_id
end

Public Instance Methods

to_hash() click to toggle source

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

@return [Hash] properties

# File lib/itly/plugin/segment/call_options.rb, line 31
def to_hash
  %w[integrations context message_id timestamp anonymous_id].each_with_object({}) do |prop, hash|
    hash[prop.to_sym] = send(prop) unless send(prop).nil?
  end
end
to_s() click to toggle source

Get the plugin description, for logs

@return [String] description

# File lib/itly/plugin/segment/call_options.rb, line 42
def to_s
  class_name = self.class.name.split('::').last
  props = %w[integrations context message_id timestamp anonymous_id].collect do |prop|
    " #{prop}: #{send prop}" unless send(prop).nil?
  end.compact
  "#<Segment::#{class_name} callback: #{callback.nil? ? 'nil' : 'provided'}#{props.join}>"
end