Class: ThePlaidApi::UserAccountSessionGetResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/user_account_session_get_response.rb

Overview

UserAccountSessionGetResponse defines the response schema for ‘/user_account/session/get`

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(identity:, items:, request_id:, identity_edit_history: SKIP, additional_properties: nil) ⇒ UserAccountSessionGetResponse

Returns a new instance of UserAccountSessionGetResponse.



59
60
61
62
63
64
65
66
67
68
69
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 59

def initialize(identity:, items:, request_id:, identity_edit_history: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @identity = identity
  @items = items
  @identity_edit_history = identity_edit_history unless identity_edit_history == SKIP
  @request_id = request_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#identityUserAccountIdentity

The identity data permissioned by the end user during the authorization flow.

Returns:



16
17
18
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 16

def identity
  @identity
end

#identity_edit_historyUserAccountIdentityEditHistory

Statistics tracking the number of edits made to identity fields over various time periods.



26
27
28
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 26

def identity_edit_history
  @identity_edit_history
end

#itemsArray[UserAccountItem]

The identity data permissioned by the end user during the authorization flow.

Returns:



21
22
23
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 21

def items
  @items
end

#request_idString

A unique identifier for the request, which can be used for troubleshooting. This identifier, like all Plaid identifiers, is case sensitive.

Returns:

  • (String)


32
33
34
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 32

def request_id
  @request_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 72

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  identity = UserAccountIdentity.from_hash(hash['identity']) if hash['identity']
  # Parameter is an array, so we need to iterate through it
  items = nil
  unless hash['items'].nil?
    items = []
    hash['items'].each do |structure|
      items << (UserAccountItem.from_hash(structure) if structure)
    end
  end

  items = nil unless hash.key?('items')
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  if hash['identity_edit_history']
    identity_edit_history = UserAccountIdentityEditHistory.from_hash(hash['identity_edit_history'])
  end

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  UserAccountSessionGetResponse.new(identity: identity,
                                    items: items,
                                    request_id: request_id,
                                    identity_edit_history: identity_edit_history,
                                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
41
42
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['identity'] = 'identity'
  @_hash['items'] = 'items'
  @_hash['identity_edit_history'] = 'identity_edit_history'
  @_hash['request_id'] = 'request_id'
  @_hash
end

.nullablesObject

An array for nullable fields



52
53
54
55
56
57
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 52

def self.nullables
  %w[
    identity
    identity_edit_history
  ]
end

.optionalsObject

An array for optional fields



45
46
47
48
49
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 45

def self.optionals
  %w[
    identity_edit_history
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} identity: #{@identity.inspect}, items: #{@items.inspect},"\
  " identity_edit_history: #{@identity_edit_history.inspect}, request_id:"\
  " #{@request_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



108
109
110
111
112
113
# File 'lib/the_plaid_api/models/user_account_session_get_response.rb', line 108

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} identity: #{@identity}, items: #{@items}, identity_edit_history:"\
  " #{@identity_edit_history}, request_id: #{@request_id}, additional_properties:"\
  " #{@additional_properties}>"
end