class Projector::EndUser
Internally represents an End User in your application. @api private
Attributes
id[RW]
@return [String] The user’s ID in your application
Public Class Methods
new(params = {})
click to toggle source
@param [Hash] params Properties for a user @option params [String] :id the id of the user in your application @option params [Array] :tags an array of tags to apply to the user
# File lib/projector/end_user.rb, line 13 def initialize(params = {}) raise Projector::Error::InvalidEndUser.new("Invalid end user, id missing") if params[:id].nil? if params.instance_of?(Hash) params.each do |k, v| self.send("#{k}=", v) if self.respond_to?("#{k}=") end else self.id = params.to_s end end
Public Instance Methods
to_hash()
click to toggle source
Serializes the EndUser
object to the correct Projector-defined hash format. @return [Hash]
# File lib/projector/end_user.rb, line 26 def to_hash basic_hash = { id: self.id.to_s, profile: {} } if tags && tags.any? basic_hash.merge({tags: tags}) else basic_hash end end