Class: PlaidResponse
- Inherits:
-
Object
- Object
- PlaidResponse
- Includes:
- Plaid::Client::Configurations
- Defined in:
- lib/plaid/plaid_response.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#accounts ⇒ Object
readonly
Returns the value of attribute accounts.
-
#http_code ⇒ Object
readonly
Returns the value of attribute http_code.
-
#mfa_message ⇒ Object
readonly
Returns the value of attribute mfa_message.
-
#transactions ⇒ Object
readonly
Returns the value of attribute transactions.
Instance Method Summary collapse
-
#initialize(response, message = nil) ⇒ PlaidResponse
constructor
A new instance of PlaidResponse.
- #is_mfa? ⇒ Boolean
- #manage_mfa_type(zed) ⇒ Object
- #message ⇒ Object
- #mfa_modes ⇒ Object
- #mfa_type ⇒ Object
- #raw_response ⇒ Object
Constructor Details
#initialize(response, message = nil) ⇒ PlaidResponse
Returns a new instance of PlaidResponse.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/plaid/plaid_response.rb', line 17 def initialize(response, =nil) @http_code = response.code zed = PlaidObject.new(response) if save_full_response.eql?(true) @response = zed end unless .eql?("MFA") @accounts = zed.accounts @transactions = zed.transactions @is_mfa_initialized = false else manage_mfa_type(zed) @is_mfa_initialized = true end @access_token = zed.access_token = if zed = nil end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
7 8 9 |
# File 'lib/plaid/plaid_response.rb', line 7 def access_token @access_token end |
#accounts ⇒ Object (readonly)
Returns the value of attribute accounts.
7 8 9 |
# File 'lib/plaid/plaid_response.rb', line 7 def accounts @accounts end |
#http_code ⇒ Object (readonly)
Returns the value of attribute http_code.
7 8 9 |
# File 'lib/plaid/plaid_response.rb', line 7 def http_code @http_code end |
#mfa_message ⇒ Object (readonly)
Returns the value of attribute mfa_message.
7 8 9 |
# File 'lib/plaid/plaid_response.rb', line 7 def end |
#transactions ⇒ Object (readonly)
Returns the value of attribute transactions.
7 8 9 |
# File 'lib/plaid/plaid_response.rb', line 7 def transactions @transactions end |
Instance Method Details
#is_mfa? ⇒ Boolean
51 52 53 |
# File 'lib/plaid/plaid_response.rb', line 51 def is_mfa? @is_mfa_initialized end |
#manage_mfa_type(zed) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/plaid/plaid_response.rb', line 59 def manage_mfa_type(zed) @mfa_type = zed.type if @mfa_type.eql?("device") = zed.mfa["message"] elsif @mfa_type.eql?("questions") @questions ||= [] zed.mfa.each do |q| @questions << q.question end = @questions.reverse.pop elsif @mfa_type.eql?("list") @mfa_modes ||= [] = "There are several ways to authenticate, or it will default to your email" zed.mfa.each do |q| @mfa_modes << q end end end |
#message ⇒ Object
43 44 45 |
# File 'lib/plaid/plaid_response.rb', line 43 def .eql?("MFA") ? + ": " + : end |
#mfa_modes ⇒ Object
55 56 57 |
# File 'lib/plaid/plaid_response.rb', line 55 def mfa_modes @mfa_modes end |
#mfa_type ⇒ Object
47 48 49 |
# File 'lib/plaid/plaid_response.rb', line 47 def mfa_type .eql?("MFA") ? @mfa_type : "Not a response from an MFA request to a bank" end |
#raw_response ⇒ Object
39 40 41 |
# File 'lib/plaid/plaid_response.rb', line 39 def raw_response @response end |