Class: Itly::Plugin::Segment::CallOptions
- Inherits:
-
Itly::PluginCallOptions
- Object
- Itly::PluginCallOptions
- Itly::Plugin::Segment::CallOptions
- Defined in:
- lib/itly/plugin/segment/call_options.rb
Overview
Segment specific plugin options class
Instance Attribute Summary collapse
-
#anonymous_id ⇒ Object
readonly
Returns the value of attribute anonymous_id.
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#integrations ⇒ Object
readonly
Returns the value of attribute integrations.
-
#message_id ⇒ Object
readonly
Returns the value of attribute message_id.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(callback: nil, integrations: nil, context: nil, message_id: nil, timestamp: nil, anonymous_id: nil) ⇒ CallOptions
constructor
A new instance of CallOptions.
-
#to_hash ⇒ Hash
Return all properties to be passed to the client While excluding the ‘callback` property.
-
#to_s ⇒ String
Get the plugin description, for logs.
Constructor Details
#initialize(callback: nil, integrations: nil, context: nil, message_id: nil, timestamp: nil, anonymous_id: nil) ⇒ CallOptions
Returns a new instance of CallOptions.
13 14 15 16 17 18 19 20 21 22 23 |
# 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 = @timestamp = @anonymous_id = anonymous_id end |
Instance Attribute Details
#anonymous_id ⇒ Object (readonly)
Returns the value of attribute anonymous_id.
11 12 13 |
# File 'lib/itly/plugin/segment/call_options.rb', line 11 def anonymous_id @anonymous_id end |
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
11 12 13 |
# File 'lib/itly/plugin/segment/call_options.rb', line 11 def callback @callback end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
11 12 13 |
# File 'lib/itly/plugin/segment/call_options.rb', line 11 def context @context end |
#integrations ⇒ Object (readonly)
Returns the value of attribute integrations.
11 12 13 |
# File 'lib/itly/plugin/segment/call_options.rb', line 11 def integrations @integrations end |
#message_id ⇒ Object (readonly)
Returns the value of attribute message_id.
11 12 13 |
# File 'lib/itly/plugin/segment/call_options.rb', line 11 def @message_id end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
11 12 13 |
# File 'lib/itly/plugin/segment/call_options.rb', line 11 def @timestamp end |
Instance Method Details
#to_hash ⇒ Hash
Return all properties to be passed to the client While excluding the ‘callback` property
31 32 33 34 35 |
# 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 ⇒ String
Get the plugin description, for logs
42 43 44 45 46 47 48 |
# 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 |