helenye-stripe 4705a5f5f9
Refactor after SDK based generation pattern (#1354)
* Refactor after SDK based generation pattern

* update for object types & reorder
2024-03-11 13:10:30 -07:00

130 lines
4.7 KiB
Ruby

# File generated from our OpenAPI spec
# frozen_string_literal: true
module Stripe
module Issuing
# You can [create physical or virtual cards](https://stripe.com/docs/issuing/cards) that are issued to cardholders.
class Card < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save
OBJECT_NAME = "issuing.card"
def self.object_name
"issuing.card"
end
# Creates an Issuing Card object.
def self.create(params = {}, opts = {})
request_stripe_object(method: :post, path: "/v1/issuing/cards", params: params, opts: opts)
end
# Returns a list of Issuing Card objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.
def self.list(filters = {}, opts = {})
request_stripe_object(method: :get, path: "/v1/issuing/cards", params: filters, opts: opts)
end
# Updates the specified Issuing Card object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
def self.update(id, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/issuing/cards/%<id>s", { id: CGI.escape(id) }),
params: params,
opts: opts
)
end
def test_helpers
TestHelpers.new(self)
end
class TestHelpers < APIResourceTestHelpers
RESOURCE_CLASS = Card
def self.resource_class
"Card"
end
# Updates the shipping status of the specified Issuing Card object to delivered.
def self.deliver_card(card, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/deliver", { card: CGI.escape(card) }),
params: params,
opts: opts
)
end
# Updates the shipping status of the specified Issuing Card object to delivered.
def deliver_card(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/deliver", { card: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
# Updates the shipping status of the specified Issuing Card object to failure.
def self.fail_card(card, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/fail", { card: CGI.escape(card) }),
params: params,
opts: opts
)
end
# Updates the shipping status of the specified Issuing Card object to failure.
def fail_card(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/fail", { card: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
# Updates the shipping status of the specified Issuing Card object to returned.
def self.return_card(card, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/return", { card: CGI.escape(card) }),
params: params,
opts: opts
)
end
# Updates the shipping status of the specified Issuing Card object to returned.
def return_card(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/return", { card: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
# Updates the shipping status of the specified Issuing Card object to shipped.
def self.ship_card(card, params = {}, opts = {})
request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/ship", { card: CGI.escape(card) }),
params: params,
opts: opts
)
end
# Updates the shipping status of the specified Issuing Card object to shipped.
def ship_card(params = {}, opts = {})
@resource.request_stripe_object(
method: :post,
path: format("/v1/test_helpers/issuing/cards/%<card>s/shipping/ship", { card: CGI.escape(@resource["id"]) }),
params: params,
opts: opts
)
end
end
end
end
end