Module: StripeMock::RequestHandlers::Cards
- Included in:
- Instance
- Defined in:
- lib/stripe_mock/request_handlers/cards.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_recipient_card(route, method_url, params, headers) ⇒ Object
- #delete_recipient_card(route, method_url, params, headers) ⇒ Object
- #retrieve_recipient_card(route, method_url, params, headers) ⇒ Object
- #retrieve_recipient_cards(route, method_url, params, headers) ⇒ Object
Class Method Details
.included(klass) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/stripe_mock/request_handlers/cards.rb', line 5 def Cards.included(klass) klass.add_handler 'get /v1/recipients/(.*)/cards', :retrieve_recipient_cards klass.add_handler 'get /v1/recipients/(.*)/cards/(.*)', :retrieve_recipient_card klass.add_handler 'post /v1/recipients/(.*)/cards', :create_recipient_card klass.add_handler 'delete /v1/recipients/(.*)/cards/(.*)', :delete_recipient_card end |
Instance Method Details
#create_recipient_card(route, method_url, params, headers) ⇒ Object
12 13 14 15 |
# File 'lib/stripe_mock/request_handlers/cards.rb', line 12 def create_recipient_card(route, method_url, params, headers) route =~ method_url add_card_to(:recipient, $1, params, recipients) end |
#delete_recipient_card(route, method_url, params, headers) ⇒ Object
29 30 31 32 |
# File 'lib/stripe_mock/request_handlers/cards.rb', line 29 def delete_recipient_card(route, method_url, params, headers) route =~ method_url delete_card_from(:recipient, $1, $2, recipients) end |
#retrieve_recipient_card(route, method_url, params, headers) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/stripe_mock/request_handlers/cards.rb', line 22 def retrieve_recipient_card(route, method_url, params, headers) route =~ method_url recipient = assert_existence :recipient, $1, recipients[$1] assert_existence :card, $2, get_card(recipient, $2, "Recipient") end |
#retrieve_recipient_cards(route, method_url, params, headers) ⇒ Object
17 18 19 20 |
# File 'lib/stripe_mock/request_handlers/cards.rb', line 17 def retrieve_recipient_cards(route, method_url, params, headers) route =~ method_url retrieve_object_cards(:recipient, $1, recipients) end |