Class: ThePlaidApi::CreditSession
- Defined in:
- lib/the_plaid_api/models/credit_session.rb
Overview
Metadata and results for a Link session
Instance Attribute Summary collapse
-
#errors ⇒ Array[CreditSessionError]
The set of errors that occurred during the Link session.
-
#link_session_id ⇒ String
The unique identifier associated with the Link session.
-
#results ⇒ CreditSessionResults
The set of results for a Link session.
-
#session_start_time ⇒ DateTime
The time when the Link session started.
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(link_session_id: SKIP, session_start_time: SKIP, results: SKIP, errors: SKIP, additional_properties: nil) ⇒ CreditSession
constructor
A new instance of CreditSession.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_session_start_time ⇒ 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(link_session_id: SKIP, session_start_time: SKIP, results: SKIP, errors: SKIP, additional_properties: nil) ⇒ CreditSession
Returns a new instance of CreditSession.
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 55 def initialize(link_session_id: SKIP, session_start_time: SKIP, results: SKIP, errors: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @link_session_id = link_session_id unless link_session_id == SKIP @session_start_time = session_start_time unless session_start_time == SKIP @results = results unless results == SKIP @errors = errors unless errors == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#errors ⇒ Array[CreditSessionError]
The set of errors that occurred during the Link session.
28 29 30 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 28 def errors @errors end |
#link_session_id ⇒ String
The unique identifier associated with the Link session. This identifier matches the ‘link_session_id` returned in the onSuccess/onExit callbacks.
16 17 18 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 16 def link_session_id @link_session_id end |
#results ⇒ CreditSessionResults
The set of results for a Link session.
24 25 26 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 24 def results @results end |
#session_start_time ⇒ DateTime
The time when the Link session started
20 21 22 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 20 def session_start_time @session_start_time end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
68 69 70 71 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 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 68 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. link_session_id = hash.key?('link_session_id') ? hash['link_session_id'] : SKIP session_start_time = if hash.key?('session_start_time') (DateTimeHelper.from_rfc3339(hash['session_start_time']) if hash['session_start_time']) else SKIP end results = CreditSessionResults.from_hash(hash['results']) if hash['results'] # Parameter is an array, so we need to iterate through it errors = nil unless hash['errors'].nil? errors = [] hash['errors'].each do |structure| errors << (CreditSessionError.from_hash(structure) if structure) end end errors = SKIP unless hash.key?('errors') # 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. CreditSession.new(link_session_id: link_session_id, session_start_time: session_start_time, results: results, errors: errors, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['link_session_id'] = 'link_session_id' @_hash['session_start_time'] = 'session_start_time' @_hash['results'] = 'results' @_hash['errors'] = 'errors' @_hash end |
.nullables ⇒ Object
An array for nullable fields
51 52 53 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 51 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 48 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 41 def self.optionals %w[ link_session_id session_start_time results errors ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
119 120 121 122 123 124 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 119 def inspect class_name = self.class.name.split('::').last "<#{class_name} link_session_id: #{@link_session_id.inspect}, session_start_time:"\ " #{@session_start_time.inspect}, results: #{@results.inspect}, errors: #{@errors.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_custom_session_start_time ⇒ Object
106 107 108 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 106 def to_custom_session_start_time DateTimeHelper.to_rfc3339(session_start_time) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
111 112 113 114 115 116 |
# File 'lib/the_plaid_api/models/credit_session.rb', line 111 def to_s class_name = self.class.name.split('::').last "<#{class_name} link_session_id: #{@link_session_id}, session_start_time:"\ " #{@session_start_time}, results: #{@results}, errors: #{@errors}, additional_properties:"\ " #{@additional_properties}>" end |