Module: StripeMock::RequestHandlers::BalanceTransactions
- Included in:
- Instance
- Defined in:
- lib/stripe_mock/request_handlers/balance_transactions.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get_balance_transaction(route, method_url, params, headers) ⇒ Object
- #list_balance_transactions(route, method_url, params, headers) ⇒ Object
Class Method Details
.included(klass) ⇒ Object
5 6 7 8 |
# File 'lib/stripe_mock/request_handlers/balance_transactions.rb', line 5 def BalanceTransactions.included(klass) klass.add_handler 'get /v1/balance_transactions/(.*)', :get_balance_transaction klass.add_handler 'get /v1/balance_transactions', :list_balance_transactions end |
Instance Method Details
#get_balance_transaction(route, method_url, params, headers) ⇒ Object
10 11 12 13 |
# File 'lib/stripe_mock/request_handlers/balance_transactions.rb', line 10 def get_balance_transaction(route, method_url, params, headers) route =~ method_url assert_existence :balance_transaction, $1, hide_additional_attributes(balance_transactions[$1]) end |
#list_balance_transactions(route, method_url, params, headers) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/stripe_mock/request_handlers/balance_transactions.rb', line 15 def list_balance_transactions(route, method_url, params, headers) values = balance_transactions.values if params.has_key?(:transfer) # If transfer supplied as params, need to filter the btxns returned to only include those with the specified transfer id values = values.select{|btxn| btxn[:transfer] == params[:transfer]} end Data.mock_list_object(values.map{|btxn| hide_additional_attributes(btxn)}, params) end |