class MoesifApi::UserModel

Attributes

campaign[RW]

campaign object @return [CampaignModel]

company_id[RW]

company id associated with the user if avaialble. @return [String]

ip_address[RW]

ip address associated with user if avaialble. @return [String]

metadata[RW]

meta data @return [Object]

modified_time[RW]

Time when modification was made. default to current time on server side. @return [DateTime]

session_token[RW]

session token associated with user if avaialble. @return [String]

user_agent_string[RW]

Optionally tag the user with an user agent. @return [String]

user_id[RW]

user id of the user @return [String]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash

# File lib/moesif_api/models/user_model.rb, line 74
def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash
    user_id = hash["user_id"]
    company_id = hash["company_id"]
    modified_time = DateTime.iso8601(hash["modified_time"]) if hash["modified_time"]
    ip_address = hash["ip_address"]
    session_token = hash["session_token"]
    user_agent_string = hash["user_agent_string"]
    metadata = hash["metadata"]
    campaign = CampaignModel.from_hash(hash["campaign"]) if hash["campaign"]

    # Create object from extracted values
    UserModel.new(user_id,
                  company_id,
                  modified_time,
                  ip_address,
                  session_token,
                  user_agent_string,
                  metadata,
                  campaign)
  end
end
names() click to toggle source

A mapping from model property names to API property names

# File lib/moesif_api/models/user_model.rb, line 40
def self.names
  if @hash.nil?
    @hash = {}
    @hash["user_id"] = "user_id"
    @hash["company_id"] = "company_id"
    @hash["modified_time"] = "modified_time"
    @hash["ip_address"] = "ip_address"
    @hash["session_token"] = "session_token"
    @hash["user_agent_string"] = "user_agent_string"
    @hash["metadata"] = "metadata"
    @hash["campaign"] = "campaign"
  end
  @hash
end
new(user_id = nil, company_id = nil, modified_time = nil, ip_address = nil, session_token = nil, user_agent_string = nil, metadata = nil, campaign = nil) click to toggle source
# File lib/moesif_api/models/user_model.rb, line 55
def initialize(user_id = nil,
               company_id = nil,
               modified_time = nil,
               ip_address = nil,
               session_token = nil,
               user_agent_string = nil,
               metadata = nil,
               campaign = nil)
  @user_id = user_id
  @company_id = company_id
  @modified_time = modified_time
  @ip_address = ip_address
  @session_token = session_token
  @user_agent_string = user_agent_string
  @metadata = metadata
  @campaign = campaign
end