Module: StripeMock::RequestHandlers::ExternalAccounts
- Included in:
- Instance
- Defined in:
- lib/stripe_mock/request_handlers/external_accounts.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_external_account(route, method_url, params, headers) ⇒ Object
- #delete_external_account(route, method_url, params, headers) ⇒ Object
- #retrieve_external_account(route, method_url, params, headers) ⇒ Object
- #retrieve_external_accounts(route, method_url, params, headers) ⇒ Object
- #update_external_account(route, method_url, params, headers) ⇒ Object
- #verify_external_account(route, method_url, params, headers) ⇒ Object
Class Method Details
.included(klass) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/stripe_mock/request_handlers/external_accounts.rb', line 5 def ExternalAccounts.included(klass) klass.add_handler 'get /v1/accounts/(.*)/external_accounts', :retrieve_external_accounts klass.add_handler 'post /v1/accounts/(.*)/external_accounts', :create_external_account klass.add_handler 'post /v1/accounts/(.*)/external_accounts/(.*)/verify', :verify_external_account klass.add_handler 'get /v1/accounts/(.*)/external_accounts/(.*)', :retrieve_external_account klass.add_handler 'delete /v1/accounts/(.*)/external_accounts/(.*)', :delete_external_account klass.add_handler 'post /v1/accounts/(.*)/external_accounts/(.*)', :update_external_account end |
Instance Method Details
#create_external_account(route, method_url, params, headers) ⇒ Object
14 15 16 17 |
# File 'lib/stripe_mock/request_handlers/external_accounts.rb', line 14 def create_external_account(route, method_url, params, headers) route =~ method_url add_external_account_to(:account, $1, params, accounts) end |
#delete_external_account(route, method_url, params, headers) ⇒ Object
31 32 33 34 |
# File 'lib/stripe_mock/request_handlers/external_accounts.rb', line 31 def delete_external_account(route, method_url, params, headers) route =~ method_url delete_card_from(:account, $1, $2, accounts) end |
#retrieve_external_account(route, method_url, params, headers) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/stripe_mock/request_handlers/external_accounts.rb', line 24 def retrieve_external_account(route, method_url, params, headers) route =~ method_url account = assert_existence :account, $1, accounts[$1] assert_existence :card, $2, get_card(account, $2) end |
#retrieve_external_accounts(route, method_url, params, headers) ⇒ Object
19 20 21 22 |
# File 'lib/stripe_mock/request_handlers/external_accounts.rb', line 19 def retrieve_external_accounts(route, method_url, params, headers) route =~ method_url retrieve_object_cards(:account, $1, accounts) end |
#update_external_account(route, method_url, params, headers) ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/stripe_mock/request_handlers/external_accounts.rb', line 36 def update_external_account(route, method_url, params, headers) route =~ method_url account = assert_existence :account, $1, accounts[$1] card = assert_existence :card, $2, get_card(account, $2) card.merge!(params) card end |
#verify_external_account(route, method_url, params, headers) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/stripe_mock/request_handlers/external_accounts.rb', line 45 def verify_external_account(route, method_url, params, headers) route =~ method_url account = assert_existence :account, $1, accounts[$1] external_account = assert_existence :bank_account, $2, verify_bank_account(account, $2) external_account end |