Class: NewStoreApi::Actor
- Defined in:
- lib/new_store_api/models/actor.rb
Overview
Who (or what) caused the audited change. Sourced from the caller's JWT; empty fields are omitted from the payload.
Instance Attribute Summary collapse
-
#authenticated_at ⇒ DateTime
When the actor authenticated (from the JWT
auth_timeclaim). -
#authorized_party ⇒ String
JWT
azp— channel or integration that called the API. -
#display_name ⇒ String
JWT
name. -
#idp_user_id ⇒ String
JWT
sub— IDP user id (human or technical user). -
#session_id ⇒ String
JWT
sid— correlates events in the same auth session. -
#token_id ⇒ String
JWT
jti— per-token identifier. -
#user_id ⇒ String
Legacy internal NewStore user id.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(authenticated_at = SKIP, authorized_party = SKIP, display_name = SKIP, idp_user_id = SKIP, session_id = SKIP, token_id = SKIP, user_id = SKIP) ⇒ Actor
constructor
A new instance of Actor.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_authenticated_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(authenticated_at = SKIP, authorized_party = SKIP, display_name = SKIP, idp_user_id = SKIP, session_id = SKIP, token_id = SKIP, user_id = SKIP) ⇒ Actor
Returns a new instance of Actor.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/new_store_api/models/actor.rb', line 73 def initialize(authenticated_at = SKIP, = SKIP, display_name = SKIP, idp_user_id = SKIP, session_id = SKIP, token_id = SKIP, user_id = SKIP) @authenticated_at = authenticated_at unless authenticated_at == SKIP @authorized_party = unless == SKIP @display_name = display_name unless display_name == SKIP @idp_user_id = idp_user_id unless idp_user_id == SKIP @session_id = session_id unless session_id == SKIP @token_id = token_id unless token_id == SKIP @user_id = user_id unless user_id == SKIP end |
Instance Attribute Details
#authenticated_at ⇒ DateTime
When the actor authenticated (from the JWT auth_time claim).
16 17 18 |
# File 'lib/new_store_api/models/actor.rb', line 16 def authenticated_at @authenticated_at end |
#authorized_party ⇒ String
JWT azp — channel or integration that called the API.
20 21 22 |
# File 'lib/new_store_api/models/actor.rb', line 20 def @authorized_party end |
#display_name ⇒ String
JWT name.
24 25 26 |
# File 'lib/new_store_api/models/actor.rb', line 24 def display_name @display_name end |
#idp_user_id ⇒ String
JWT sub — IDP user id (human or technical user).
28 29 30 |
# File 'lib/new_store_api/models/actor.rb', line 28 def idp_user_id @idp_user_id end |
#session_id ⇒ String
JWT sid — correlates events in the same auth session.
32 33 34 |
# File 'lib/new_store_api/models/actor.rb', line 32 def session_id @session_id end |
#token_id ⇒ String
JWT jti — per-token identifier.
36 37 38 |
# File 'lib/new_store_api/models/actor.rb', line 36 def token_id @token_id end |
#user_id ⇒ String
Legacy internal NewStore user id.
40 41 42 |
# File 'lib/new_store_api/models/actor.rb', line 40 def user_id @user_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/new_store_api/models/actor.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. authenticated_at = if hash.key?('authenticated_at') (DateTimeHelper.from_rfc3339(hash['authenticated_at']) if hash['authenticated_at']) else SKIP end = hash.key?('authorized_party') ? hash['authorized_party'] : SKIP display_name = hash.key?('display_name') ? hash['display_name'] : SKIP idp_user_id = hash.key?('idp_user_id') ? hash['idp_user_id'] : SKIP session_id = hash.key?('session_id') ? hash['session_id'] : SKIP token_id = hash.key?('token_id') ? hash['token_id'] : SKIP user_id = hash.key?('user_id') ? hash['user_id'] : SKIP # Create object from extracted values. Actor.new(authenticated_at, , display_name, idp_user_id, session_id, token_id, user_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/new_store_api/models/actor.rb', line 43 def self.names @_hash = {} if @_hash.nil? @_hash['authenticated_at'] = 'authenticated_at' @_hash['authorized_party'] = 'authorized_party' @_hash['display_name'] = 'display_name' @_hash['idp_user_id'] = 'idp_user_id' @_hash['session_id'] = 'session_id' @_hash['token_id'] = 'token_id' @_hash['user_id'] = 'user_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
69 70 71 |
# File 'lib/new_store_api/models/actor.rb', line 69 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/new_store_api/models/actor.rb', line 56 def self.optionals %w[ authenticated_at authorized_party display_name idp_user_id session_id token_id user_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
126 127 128 129 130 131 132 |
# File 'lib/new_store_api/models/actor.rb', line 126 def inspect class_name = self.class.name.split('::').last "<#{class_name} authenticated_at: #{@authenticated_at.inspect}, authorized_party:"\ " #{@authorized_party.inspect}, display_name: #{@display_name.inspect}, idp_user_id:"\ " #{@idp_user_id.inspect}, session_id: #{@session_id.inspect}, token_id:"\ " #{@token_id.inspect}, user_id: #{@user_id.inspect}>" end |
#to_custom_authenticated_at ⇒ Object
113 114 115 |
# File 'lib/new_store_api/models/actor.rb', line 113 def to_custom_authenticated_at DateTimeHelper.to_rfc3339(authenticated_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
118 119 120 121 122 123 |
# File 'lib/new_store_api/models/actor.rb', line 118 def to_s class_name = self.class.name.split('::').last "<#{class_name} authenticated_at: #{@authenticated_at}, authorized_party:"\ " #{@authorized_party}, display_name: #{@display_name}, idp_user_id: #{@idp_user_id},"\ " session_id: #{@session_id}, token_id: #{@token_id}, user_id: #{@user_id}>" end |