Class: TerminalShop::Resources::Card
- Inherits:
-
Object
- Object
- TerminalShop::Resources::Card
- Defined in:
- lib/terminal_shop/resources/card.rb
Instance Method Summary collapse
-
#collect(request_options: {}) ⇒ TerminalShop::Models::CardCollectResponse
Create a temporary URL for collecting credit card information for the current user.
-
#create(token: , request_options: {}) ⇒ TerminalShop::Models::CardCreateResponse
Some parameter documentations has been truncated, see Models::CardCreateParams for more details.
-
#delete(id, request_options: {}) ⇒ TerminalShop::Models::CardDeleteResponse
Delete a credit card associated with the current user.
-
#get(id, request_options: {}) ⇒ TerminalShop::Models::CardGetResponse
Get a credit card by ID associated with the current user.
-
#initialize(client:) ⇒ Card
constructor
private
A new instance of Card.
-
#list(request_options: {}) ⇒ TerminalShop::Models::CardListResponse
List the credit cards associated with the current user.
Constructor Details
#initialize(client:) ⇒ Card
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Card.
111 112 113 |
# File 'lib/terminal_shop/resources/card.rb', line 111 def initialize(client:) @client = client end |
Instance Method Details
#collect(request_options: {}) ⇒ TerminalShop::Models::CardCollectResponse
Create a temporary URL for collecting credit card information for the current user.
79 80 81 82 83 84 85 86 |
# File 'lib/terminal_shop/resources/card.rb', line 79 def collect(params = {}) @client.request( method: :post, path: "card/collect", model: TerminalShop::Models::CardCollectResponse, options: params[:request_options] ) end |
#create(token: , request_options: {}) ⇒ TerminalShop::Models::CardCreateResponse
Some parameter documentations has been truncated, see Models::CardCreateParams for more details.
Attach a credit card (tokenized via Stripe) to the current user.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/terminal_shop/resources/card.rb', line 20 def create(params) parsed, = TerminalShop::CardCreateParams.dump_request(params) @client.request( method: :post, path: "card", body: parsed, model: TerminalShop::Models::CardCreateResponse, options: ) end |
#delete(id, request_options: {}) ⇒ TerminalShop::Models::CardDeleteResponse
Delete a credit card associated with the current user.
60 61 62 63 64 65 66 67 |
# File 'lib/terminal_shop/resources/card.rb', line 60 def delete(id, params = {}) @client.request( method: :delete, path: ["card/%1$s", id], model: TerminalShop::Models::CardDeleteResponse, options: params[:request_options] ) end |
#get(id, request_options: {}) ⇒ TerminalShop::Models::CardGetResponse
Get a credit card by ID associated with the current user.
99 100 101 102 103 104 105 106 |
# File 'lib/terminal_shop/resources/card.rb', line 99 def get(id, params = {}) @client.request( method: :get, path: ["card/%1$s", id], model: TerminalShop::Models::CardGetResponse, options: params[:request_options] ) end |
#list(request_options: {}) ⇒ TerminalShop::Models::CardListResponse
List the credit cards associated with the current user.
40 41 42 43 44 45 46 47 |
# File 'lib/terminal_shop/resources/card.rb', line 40 def list(params = {}) @client.request( method: :get, path: "card", model: TerminalShop::Models::CardListResponse, options: params[:request_options] ) end |