Class: SecureNative::EventOptions
- Inherits:
-
Object
- Object
- SecureNative::EventOptions
- Defined in:
- lib/securenative/event_options.rb
Constant Summary collapse
- MAX_PROPERTIES_SIZE =
10
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#event ⇒ Object
Returns the value of attribute event.
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
-
#user_traits ⇒ Object
Returns the value of attribute user_traits.
Instance Method Summary collapse
-
#initialize(event: nil, user_id: nil, user_traits: nil, user_name: nil, email: nil, phone: nil, created_at: nil, context: nil, properties: nil, timestamp: nil) ⇒ EventOptions
constructor
A new instance of EventOptions.
Constructor Details
#initialize(event: nil, user_id: nil, user_traits: nil, user_name: nil, email: nil, phone: nil, created_at: nil, context: nil, properties: nil, timestamp: nil) ⇒ EventOptions
Returns a new instance of EventOptions.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/securenative/event_options.rb', line 10 def initialize(event: nil, user_id: nil, user_traits: nil, user_name: nil, email: nil, phone: nil, created_at: nil, context: nil, properties: nil, timestamp: nil) if !properties.nil? && properties.length > MAX_PROPERTIES_SIZE raise SecureNativeInvalidOptionsError, "You can have only up to #{MAX_PROPERTIES_SIZE} custom properties" end if user_traits.nil? if user_name && email && phone && created_at user_traits = SecureNative::UserTraits(user_name, email, phone, created_at) elsif user_name && email && phone user_traits = SecureNative::UserTraits(user_name, email, phone) elsif user_name && email user_traits = SecureNative::UserTraits(user_name, email) else user_traits = UserTraits.new end end @event = event @user_id = user_id @user_traits = user_traits @context = context @properties = properties = end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
5 6 7 |
# File 'lib/securenative/event_options.rb', line 5 def context @context end |
#event ⇒ Object
Returns the value of attribute event.
5 6 7 |
# File 'lib/securenative/event_options.rb', line 5 def event @event end |
#properties ⇒ Object
Returns the value of attribute properties.
5 6 7 |
# File 'lib/securenative/event_options.rb', line 5 def properties @properties end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
5 6 7 |
# File 'lib/securenative/event_options.rb', line 5 def end |
#user_id ⇒ Object
Returns the value of attribute user_id.
5 6 7 |
# File 'lib/securenative/event_options.rb', line 5 def user_id @user_id end |
#user_traits ⇒ Object
Returns the value of attribute user_traits.
5 6 7 |
# File 'lib/securenative/event_options.rb', line 5 def user_traits @user_traits end |