Class: SynapseClient::BankAccount
- Inherits:
-
APIResource
- Object
- APIResource
- SynapseClient::BankAccount
- Includes:
- APIOperations::List
- Defined in:
- lib/synapse_client/bank_account.rb
Instance Attribute Summary collapse
-
#account_class ⇒ Object
Returns the value of attribute account_class.
-
#account_number_string ⇒ Object
Returns the value of attribute account_number_string.
-
#account_type ⇒ Object
Returns the value of attribute account_type.
-
#bank_name ⇒ Object
Returns the value of attribute bank_name.
-
#date ⇒ Object
Returns the value of attribute date.
-
#is_active ⇒ Object
Returns the value of attribute is_active.
-
#is_buyer_default ⇒ Object
Returns the value of attribute is_buyer_default.
-
#is_seller_default ⇒ Object
Returns the value of attribute is_seller_default.
-
#is_verified ⇒ Object
Returns the value of attribute is_verified.
-
#name_on_account ⇒ Object
Returns the value of attribute name_on_account.
-
#nickname ⇒ Object
Returns the value of attribute nickname.
-
#resource_uri ⇒ Object
Returns the value of attribute resource_uri.
-
#routing_number_string ⇒ Object
Returns the value of attribute routing_number_string.
Attributes inherited from APIResource
Class Method Summary collapse
- .add(params = {}) ⇒ Object
- .all(params = {}) ⇒ Object
- .api_resource_name ⇒ Object
- .finish_linking(params = {}) ⇒ Object
- .link(params = {}) ⇒ Object
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ BankAccount
constructor
A new instance of BankAccount.
Methods included from APIOperations::List
Methods inherited from APIResource
class_name, #refresh, retrieve, #successful?, #to_hash, #url, url
Constructor Details
#initialize(options = {}) ⇒ BankAccount
Returns a new instance of BankAccount.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/synapse_client/bank_account.rb', line 12 def initialize( = {}) = Map.new() @account_class = [:account_class] @account_number_string = [:account_number_string] @account_type = [:account_type] @bank_name = [:bank_name] @date = [:date] @id = [:id] || [:bank_id] @is_active = [:is_active] @is_buyer_default = [:is_buyer_default] @is_seller_default = [:is_seller_default] @is_verified = [:is_verified] @name_on_account = [:name_on_account] @nickname = [:nickname] @resource_uri = [:resource_uri] @routing_number_string = [:routing_number_string] end |
Instance Attribute Details
#account_class ⇒ Object
Returns the value of attribute account_class.
8 9 10 |
# File 'lib/synapse_client/bank_account.rb', line 8 def account_class @account_class end |
#account_number_string ⇒ Object
Returns the value of attribute account_number_string.
9 10 11 |
# File 'lib/synapse_client/bank_account.rb', line 9 def account_number_string @account_number_string end |
#account_type ⇒ Object
Returns the value of attribute account_type.
8 9 10 |
# File 'lib/synapse_client/bank_account.rb', line 8 def account_type @account_type end |
#bank_name ⇒ Object
Returns the value of attribute bank_name.
7 8 9 |
# File 'lib/synapse_client/bank_account.rb', line 7 def bank_name @bank_name end |
#date ⇒ Object
Returns the value of attribute date.
7 8 9 |
# File 'lib/synapse_client/bank_account.rb', line 7 def date @date end |
#is_active ⇒ Object
Returns the value of attribute is_active.
10 11 12 |
# File 'lib/synapse_client/bank_account.rb', line 10 def is_active @is_active end |
#is_buyer_default ⇒ Object
Returns the value of attribute is_buyer_default.
10 11 12 |
# File 'lib/synapse_client/bank_account.rb', line 10 def is_buyer_default @is_buyer_default end |
#is_seller_default ⇒ Object
Returns the value of attribute is_seller_default.
10 11 12 |
# File 'lib/synapse_client/bank_account.rb', line 10 def is_seller_default @is_seller_default end |
#is_verified ⇒ Object
Returns the value of attribute is_verified.
10 11 12 |
# File 'lib/synapse_client/bank_account.rb', line 10 def is_verified @is_verified end |
#name_on_account ⇒ Object
Returns the value of attribute name_on_account.
6 7 8 |
# File 'lib/synapse_client/bank_account.rb', line 6 def name_on_account @name_on_account end |
#nickname ⇒ Object
Returns the value of attribute nickname.
6 7 8 |
# File 'lib/synapse_client/bank_account.rb', line 6 def nickname @nickname end |
#resource_uri ⇒ Object
Returns the value of attribute resource_uri.
7 8 9 |
# File 'lib/synapse_client/bank_account.rb', line 7 def resource_uri @resource_uri end |
#routing_number_string ⇒ Object
Returns the value of attribute routing_number_string.
9 10 11 |
# File 'lib/synapse_client/bank_account.rb', line 9 def routing_number_string @routing_number_string end |
Class Method Details
.add(params = {}) ⇒ Object
40 41 42 43 44 |
# File 'lib/synapse_client/bank_account.rb', line 40 def self.add(params={}) response = SynapseClient.request(:post, url + "add", params) return response unless response.successful? BankAccount.new(response.data.bank) end |
.all(params = {}) ⇒ Object
35 36 37 38 |
# File 'lib/synapse_client/bank_account.rb', line 35 def self.all(params={}) bank_accounts = list(params).banks bank_accounts.map{|ba| BankAccount.new(ba)} end |
.api_resource_name ⇒ Object
31 32 33 |
# File 'lib/synapse_client/bank_account.rb', line 31 def self.api_resource_name "bank" end |
.finish_linking(params = {}) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/synapse_client/bank_account.rb', line 59 def self.finish_linking(params={}) unless params[:bank] raise ArgumentError.new("You must include the bank name when responding to an MFA question.") end unless params[:bank_account_token] raise ArgumentError.new("You must include the bank account token when responding to an MFA question.") end unless params[:mfa] raise ArgumentError.new("You must include the answer(s) when responding to an MFA question.") end response = SynapseClient.request(:post, url + "mfa", params) return response unless response.successful? if response.data["is_mfa"] MFA.new(response.data.response) else response.data.banks.map do |bank| BankAccount.new(bank) end end end |
.link(params = {}) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/synapse_client/bank_account.rb', line 46 def self.link(params={}) response = SynapseClient.request(:post, url + "login", params) return response unless response.successful? if response.data["is_mfa"] MFA.new(response.data.response) else response.data.banks.map do |bank| BankAccount.new(bank) end end end |