Class: ThePlaidApi::SmsVerification

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

Overview

Additional information for the individual SMS verification.

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(status:, attempt:, phone_number:, delivery_attempt_count:, solve_attempt_count:, initially_sent_at:, last_sent_at:, redacted_at:, additional_properties: nil) ⇒ SmsVerification

Returns a new instance of SmsVerification.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/the_plaid_api/models/sms_verification.rb', line 81

def initialize(status:, attempt:, phone_number:, delivery_attempt_count:,
               solve_attempt_count:, initially_sent_at:, last_sent_at:,
               redacted_at:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @status = status
  @attempt = attempt
  @phone_number = phone_number
  @delivery_attempt_count = delivery_attempt_count
  @solve_attempt_count = solve_attempt_count
  @initially_sent_at = initially_sent_at
  @last_sent_at = last_sent_at
  @redacted_at = redacted_at
  @additional_properties = additional_properties
end

Instance Attribute Details

#attemptInteger

The attempt field begins with 1 and increments with each subsequent SMS verification.

Returns:

  • (Integer)


20
21
22
# File 'lib/the_plaid_api/models/sms_verification.rb', line 20

def attempt
  @attempt
end

#delivery_attempt_countInteger

The number of delivery attempts made within the verification to send the SMS code to the user. Each delivery attempt represents the user taking action from the front end UI to request creation and delivery of a new SMS verification code, or to resend an existing SMS verification code. There is a limit of 3 delivery attempts per verification.

Returns:

  • (Integer)


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

def delivery_attempt_count
  @delivery_attempt_count
end

#initially_sent_atDateTime

An ISO8601 formatted timestamp.

Returns:

  • (DateTime)


42
43
44
# File 'lib/the_plaid_api/models/sms_verification.rb', line 42

def initially_sent_at
  @initially_sent_at
end

#last_sent_atDateTime

An ISO8601 formatted timestamp.

Returns:

  • (DateTime)


46
47
48
# File 'lib/the_plaid_api/models/sms_verification.rb', line 46

def last_sent_at
  @last_sent_at
end

#phone_numberString

A phone number in E.164 format.

Returns:

  • (String)


24
25
26
# File 'lib/the_plaid_api/models/sms_verification.rb', line 24

def phone_number
  @phone_number
end

#redacted_atDateTime

An ISO8601 formatted timestamp.

Returns:

  • (DateTime)


50
51
52
# File 'lib/the_plaid_api/models/sms_verification.rb', line 50

def redacted_at
  @redacted_at
end

#solve_attempt_countInteger

The number of attempts made by the user within the verification to verify the SMS code by entering it into the front end UI. There is a limit of 3 solve attempts per verification.

Returns:

  • (Integer)


38
39
40
# File 'lib/the_plaid_api/models/sms_verification.rb', line 38

def solve_attempt_count
  @solve_attempt_count
end

#statusSmsVerificationStatus

The outcome status for the individual SMS verification.



15
16
17
# File 'lib/the_plaid_api/models/sms_verification.rb', line 15

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/the_plaid_api/models/sms_verification.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : nil
  attempt = hash.key?('attempt') ? hash['attempt'] : nil
  phone_number = hash.key?('phone_number') ? hash['phone_number'] : nil
  delivery_attempt_count =
    hash.key?('delivery_attempt_count') ? hash['delivery_attempt_count'] : nil
  solve_attempt_count =
    hash.key?('solve_attempt_count') ? hash['solve_attempt_count'] : nil
  initially_sent_at = if hash.key?('initially_sent_at')
                        (DateTimeHelper.from_rfc3339(hash['initially_sent_at']) if hash['initially_sent_at'])
                      end
  last_sent_at = if hash.key?('last_sent_at')
                   (DateTimeHelper.from_rfc3339(hash['last_sent_at']) if hash['last_sent_at'])
                 end
  redacted_at = if hash.key?('redacted_at')
                  (DateTimeHelper.from_rfc3339(hash['redacted_at']) if hash['redacted_at'])
                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.
  SmsVerification.new(status: status,
                      attempt: attempt,
                      phone_number: phone_number,
                      delivery_attempt_count: delivery_attempt_count,
                      solve_attempt_count: solve_attempt_count,
                      initially_sent_at: initially_sent_at,
                      last_sent_at: last_sent_at,
                      redacted_at: redacted_at,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/the_plaid_api/models/sms_verification.rb', line 53

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['attempt'] = 'attempt'
  @_hash['phone_number'] = 'phone_number'
  @_hash['delivery_attempt_count'] = 'delivery_attempt_count'
  @_hash['solve_attempt_count'] = 'solve_attempt_count'
  @_hash['initially_sent_at'] = 'initially_sent_at'
  @_hash['last_sent_at'] = 'last_sent_at'
  @_hash['redacted_at'] = 'redacted_at'
  @_hash
end

.nullablesObject

An array for nullable fields



72
73
74
75
76
77
78
79
# File 'lib/the_plaid_api/models/sms_verification.rb', line 72

def self.nullables
  %w[
    phone_number
    initially_sent_at
    last_sent_at
    redacted_at
  ]
end

.optionalsObject

An array for optional fields



67
68
69
# File 'lib/the_plaid_api/models/sms_verification.rb', line 67

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



162
163
164
165
166
167
168
169
# File 'lib/the_plaid_api/models/sms_verification.rb', line 162

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status.inspect}, attempt: #{@attempt.inspect}, phone_number:"\
  " #{@phone_number.inspect}, delivery_attempt_count: #{@delivery_attempt_count.inspect},"\
  " solve_attempt_count: #{@solve_attempt_count.inspect}, initially_sent_at:"\
  " #{@initially_sent_at.inspect}, last_sent_at: #{@last_sent_at.inspect}, redacted_at:"\
  " #{@redacted_at.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_initially_sent_atObject



139
140
141
# File 'lib/the_plaid_api/models/sms_verification.rb', line 139

def to_custom_initially_sent_at
  DateTimeHelper.to_rfc3339(initially_sent_at)
end

#to_custom_last_sent_atObject



143
144
145
# File 'lib/the_plaid_api/models/sms_verification.rb', line 143

def to_custom_last_sent_at
  DateTimeHelper.to_rfc3339(last_sent_at)
end

#to_custom_redacted_atObject



147
148
149
# File 'lib/the_plaid_api/models/sms_verification.rb', line 147

def to_custom_redacted_at
  DateTimeHelper.to_rfc3339(redacted_at)
end

#to_sObject

Provides a human-readable string representation of the object.



152
153
154
155
156
157
158
159
# File 'lib/the_plaid_api/models/sms_verification.rb', line 152

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status}, attempt: #{@attempt}, phone_number: #{@phone_number},"\
  " delivery_attempt_count: #{@delivery_attempt_count}, solve_attempt_count:"\
  " #{@solve_attempt_count}, initially_sent_at: #{@initially_sent_at}, last_sent_at:"\
  " #{@last_sent_at}, redacted_at: #{@redacted_at}, additional_properties:"\
  " #{@additional_properties}>"
end