mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-12-09 00:01:53 -05:00
Some safe transformations from codegen
This commit is contained in:
parent
4c95b992cf
commit
eff920662e
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Domains registered for Apple Pay on the Web
|
||||||
module Stripe
|
module Stripe
|
||||||
# Domains registered for Apple Pay on the Web
|
|
||||||
class ApplePayDomain < APIResource
|
class ApplePayDomain < APIResource
|
||||||
extend Stripe::APIOperations::Create
|
extend Stripe::APIOperations::Create
|
||||||
include Stripe::APIOperations::Delete
|
include Stripe::APIOperations::Delete
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Directly creating or retrieving BitcoinReceivers is deprecated. Please use
|
||||||
|
# the Sources API instead: https://stripe.com/docs/sources/bitcoin
|
||||||
module Stripe
|
module Stripe
|
||||||
class BitcoinReceiver < APIResource
|
class BitcoinReceiver < APIResource
|
||||||
# Directly creating or retrieving BitcoinReceivers is deprecated. Please use
|
|
||||||
# the Sources API instead: https://stripe.com/docs/sources/bitcoin
|
|
||||||
extend Stripe::APIOperations::List
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
OBJECT_NAME = "bitcoin_receiver".freeze
|
OBJECT_NAME = "bitcoin_receiver".freeze
|
||||||
@ -14,8 +14,7 @@ module Stripe
|
|||||||
|
|
||||||
def resource_url
|
def resource_url
|
||||||
if respond_to?(:customer) && !customer.nil? && customer != ""
|
if respond_to?(:customer) && !customer.nil? && customer != ""
|
||||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
|
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
||||||
"/#{CGI.escape(id)}"
|
|
||||||
else
|
else
|
||||||
"#{self.class.resource_url}/#{CGI.escape(id)}"
|
"#{self.class.resource_url}/#{CGI.escape(id)}"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -10,14 +10,11 @@ module Stripe
|
|||||||
|
|
||||||
def resource_url
|
def resource_url
|
||||||
if respond_to?(:recipient) && !recipient.nil? && !recipient.empty?
|
if respond_to?(:recipient) && !recipient.nil? && !recipient.empty?
|
||||||
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards" \
|
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards/#{CGI.escape(id)}"
|
||||||
"/#{CGI.escape(id)}"
|
|
||||||
elsif respond_to?(:customer) && !customer.nil? && !customer.empty?
|
elsif respond_to?(:customer) && !customer.nil? && !customer.empty?
|
||||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
|
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
||||||
"/#{CGI.escape(id)}"
|
|
||||||
elsif respond_to?(:account) && !account.nil? && !account.empty?
|
elsif respond_to?(:account) && !account.nil? && !account.empty?
|
||||||
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts" \
|
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
|
||||||
"/#{CGI.escape(id)}"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -21,8 +21,7 @@ module Stripe
|
|||||||
end
|
end
|
||||||
|
|
||||||
def mark_uncollectible(params = {}, opts = {})
|
def mark_uncollectible(params = {}, opts = {})
|
||||||
resp, opts = request(:post, resource_url + "/mark_uncollectible", params,
|
resp, opts = request(:post, resource_url + "/mark_uncollectible", params, opts)
|
||||||
opts)
|
|
||||||
initialize_from(resp.data, opts)
|
initialize_from(resp.data, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ module Stripe
|
|||||||
|
|
||||||
def details(params = {}, opts = {})
|
def details(params = {}, opts = {})
|
||||||
resp, opts = request(:get, resource_url + "/details", params, opts)
|
resp, opts = request(:get, resource_url + "/details", params, opts)
|
||||||
Util.convert_to_stripe_object(resp.data, opts)
|
initialize_from(resp.data, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -12,21 +12,13 @@ module Stripe
|
|||||||
custom_method :return_order, http_verb: :post, http_path: "returns"
|
custom_method :return_order, http_verb: :post, http_path: "returns"
|
||||||
|
|
||||||
def pay(params = {}, opts = {})
|
def pay(params = {}, opts = {})
|
||||||
resp, opts = request(:post, pay_url, params, opts)
|
resp, opts = request(:post, resource_url + "/pay", params, opts)
|
||||||
initialize_from(resp.data, opts)
|
initialize_from(resp.data, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
def return_order(params, opts = {})
|
def return_order(params = {}, opts = {})
|
||||||
resp, opts = request(:post, returns_url, params, opts)
|
resp, opts = request(:post, resource_url + "/returns", params, opts)
|
||||||
Util.convert_to_stripe_object(resp.data, opts)
|
initialize_from(resp.data, opts)
|
||||||
end
|
|
||||||
|
|
||||||
private def pay_url
|
|
||||||
resource_url + "/pay"
|
|
||||||
end
|
|
||||||
|
|
||||||
private def returns_url
|
|
||||||
resource_url + "/returns"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Recipients objects are deprecated. Please use Stripe Connect instead.
|
||||||
module Stripe
|
module Stripe
|
||||||
# Recipients objects are deprecated. Please use Stripe Connect instead.
|
|
||||||
class Recipient < APIResource
|
class Recipient < APIResource
|
||||||
extend Stripe::APIOperations::Create
|
extend Stripe::APIOperations::Create
|
||||||
include Stripe::APIOperations::Delete
|
include Stripe::APIOperations::Delete
|
||||||
|
|||||||
@ -10,8 +10,7 @@ module Stripe
|
|||||||
OBJECT_NAME = "subscription_item".freeze
|
OBJECT_NAME = "subscription_item".freeze
|
||||||
|
|
||||||
def usage_record_summaries(params = {}, opts = {})
|
def usage_record_summaries(params = {}, opts = {})
|
||||||
resp, opts = request(:get, resource_url + "/usage_record_summaries",
|
resp, opts = request(:get, resource_url + "/usage_record_summaries", params, opts)
|
||||||
params, opts)
|
|
||||||
Util.convert_to_stripe_object(resp.data, opts)
|
Util.convert_to_stripe_object(resp.data, opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user