class MoesifApi::CompanyModel

Attributes

campaign[RW]

campaign object @return [CampaignModel]

company_domain[RW]

Optionally tag the company with the company domain. @return [String]

company_id[RW]

company id of the company @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]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash

# File lib/moesif_api/models/company_model.rb, line 67
def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash
    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"]
    company_domain = hash["company_domain"]
    metadata = hash["metadata"]
    campaign = CampaignModel.from_hash(hash["campaign"]) if hash["campaign"]

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

A mapping from model property names to API property names

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