Class: Stripe::SourceService
- Inherits:
-
StripeService
- Object
- StripeService
- Stripe::SourceService
- Defined in:
- lib/stripe/services/source_service.rb
Defined Under Namespace
Classes: CreateParams, DetachParams, RetrieveParams, UpdateParams, VerifyParams
Instance Attribute Summary collapse
-
#transactions ⇒ Object
readonly
Returns the value of attribute transactions.
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Object
Creates a new source object.
-
#detach(customer, id, params = {}, opts = {}) ⇒ Object
Delete a specified source for a given customer.
-
#initialize(requestor) ⇒ SourceService
constructor
A new instance of SourceService.
-
#retrieve(source, params = {}, opts = {}) ⇒ Object
Retrieves an existing source object.
-
#update(source, params = {}, opts = {}) ⇒ Object
Updates the specified source by setting the values of the parameters passed.
-
#verify(source, params = {}, opts = {}) ⇒ Object
Verify a given source.
Methods inherited from StripeService
Constructor Details
#initialize(requestor) ⇒ SourceService
Returns a new instance of SourceService.
8 9 10 11 |
# File 'lib/stripe/services/source_service.rb', line 8 def initialize(requestor) super(requestor) @transactions = Stripe::SourceTransactionService.new(@requestor) end |
Instance Attribute Details
#transactions ⇒ Object (readonly)
Returns the value of attribute transactions.
6 7 8 |
# File 'lib/stripe/services/source_service.rb', line 6 def transactions @transactions end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Object
Creates a new source object.
615 616 617 |
# File 'lib/stripe/services/source_service.rb', line 615 def create(params = {}, opts = {}) request(method: :post, path: "/v1/sources", params: params, opts: opts, base_address: :api) end |
#detach(customer, id, params = {}, opts = {}) ⇒ Object
Delete a specified source for a given customer.
620 621 622 623 624 625 626 627 628 |
# File 'lib/stripe/services/source_service.rb', line 620 def detach(customer, id, params = {}, opts = {}) request( method: :delete, path: format("/v1/customers/%<customer>s/sources/%<id>s", { customer: CGI.escape(customer), id: CGI.escape(id) }), params: params, opts: opts, base_address: :api ) end |
#retrieve(source, params = {}, opts = {}) ⇒ Object
Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.
631 632 633 634 635 636 637 638 639 |
# File 'lib/stripe/services/source_service.rb', line 631 def retrieve(source, params = {}, opts = {}) request( method: :get, path: format("/v1/sources/%<source>s", { source: CGI.escape(source) }), params: params, opts: opts, base_address: :api ) end |
#update(source, params = {}, opts = {}) ⇒ Object
Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our [payment method guides](stripe.com/docs/sources) for more detail.
644 645 646 647 648 649 650 651 652 |
# File 'lib/stripe/services/source_service.rb', line 644 def update(source, params = {}, opts = {}) request( method: :post, path: format("/v1/sources/%<source>s", { source: CGI.escape(source) }), params: params, opts: opts, base_address: :api ) end |
#verify(source, params = {}, opts = {}) ⇒ Object
Verify a given source.
655 656 657 658 659 660 661 662 663 |
# File 'lib/stripe/services/source_service.rb', line 655 def verify(source, params = {}, opts = {}) request( method: :post, path: format("/v1/sources/%<source>s/verify", { source: CGI.escape(source) }), params: params, opts: opts, base_address: :api ) end |