Class: ContextVWOModel

Inherits:
Object
  • Object
show all
Defined in:
lib/wingify/models/user/context_vwo_model.rb

Overview

Copyright 2024-2026 Wingify Software Pvt. Ltd.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(location = {}, user_agent = {}) ⇒ ContextVWOModel

Returns a new instance of ContextVWOModel.



18
19
20
21
# File 'lib/wingify/models/user/context_vwo_model.rb', line 18

def initialize(location = {}, user_agent = {})
  @location = location
  @user_agent = user_agent
end

Instance Attribute Details

#locationObject

Returns the value of attribute location.



16
17
18
# File 'lib/wingify/models/user/context_vwo_model.rb', line 16

def location
  @location
end

#user_agentObject

Returns the value of attribute user_agent.



16
17
18
# File 'lib/wingify/models/user/context_vwo_model.rb', line 16

def user_agent
  @user_agent
end

Instance Method Details

#get_locationObject



30
31
32
# File 'lib/wingify/models/user/context_vwo_model.rb', line 30

def get_location
    @location
end

#get_ua_infoObject



34
35
36
# File 'lib/wingify/models/user/context_vwo_model.rb', line 34

def get_ua_info
    @user_agent
end

#model_from_dictionary(context) ⇒ Object

Creates a model instance from a hash (dictionary)



24
25
26
27
28
# File 'lib/wingify/models/user/context_vwo_model.rb', line 24

def model_from_dictionary(context)
  @location = context["location"] if context.key?("location")
  @user_agent = context["userAgent"] if context.key?("userAgent")
  self
end