class MoesifApi::EventModel

Attributes

company_id[RW]

company_id string @return [String]

direction[RW]

direction string @return [String]

metadata[RW]

metadata @return [Hash]

request[RW]

API request object @return [EventRequestModel]

response[RW]

API response Object @return [EventResponseModel]

session_token[RW]

End user’s auth/session token @return [String]

tags[RW]

comma separated list of tags, see documentation @return [String]

user_id[RW]

End user’s user_id string from your app @return [String]

weight[RW]

Weight of an API call @return [Integer]

Public Class Methods

from_hash(hash) click to toggle source

Creates an instance of the object from a hash

# File lib/moesif_api/models/event_model.rb, line 79
def self.from_hash(hash)
  if hash == nil
    nil
  else
    # Extract variables from the hash
    request = EventRequestModel.from_hash(hash["request"]) if hash["request"]
    response = EventResponseModel.from_hash(hash["response"]) if hash["response"]
    session_token = hash["session_token"]
    tags = hash["tags"]
    user_id = hash["user_id"]
    company_id = hash["company_id"]
    metadata = hash["metadata"]
    direction = hash["direction"]
    weight = hash["weight"]

    # Create object from extracted values
    EventModel.new(request,
                         response,
                         session_token,
                         tags,
                         user_id,
                         company_id,
                         metadata,
                         direction,
                         weight)
  end
end
names() click to toggle source

A mapping from model property names to API property names

# File lib/moesif_api/models/event_model.rb, line 42
def self.names
  if @hash.nil?
    @hash = {}
    @hash["request"] = "request"
    @hash["response"] = "response"
    @hash["session_token"] = "session_token"
    @hash["tags"] = "tags"
    @hash["user_id"] = "user_id"
    @hash["company_id"] = "company_id"
    @hash["metadata"] = "metadata"
    @hash["direction"] = "direction"
    @hash["weight"] = "weight"
  end
  @hash
end
new(request = nil, response = nil, session_token = nil, tags = nil, user_id = nil, company_id = nil, metadata = nil, direction = nil, weight = nil) click to toggle source
# File lib/moesif_api/models/event_model.rb, line 58
def initialize(request = nil,
               response = nil,
               session_token = nil,
               tags = nil,
               user_id = nil,
               company_id = nil,
               metadata = nil,
               direction = nil,
               weight = nil)
  @request = request
  @response = response
  @session_token = session_token
  @tags = tags
  @user_id = user_id
  @company_id = company_id
  @metadata = metadata
  @direction = direction
  @weight = weight
end