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
|
||||
|
||||
# Domains registered for Apple Pay on the Web
|
||||
module Stripe
|
||||
# Domains registered for Apple Pay on the Web
|
||||
class ApplePayDomain < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
include Stripe::APIOperations::Delete
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
# 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
|
||||
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
|
||||
|
||||
OBJECT_NAME = "bitcoin_receiver".freeze
|
||||
@ -14,8 +14,7 @@ module Stripe
|
||||
|
||||
def resource_url
|
||||
if respond_to?(:customer) && !customer.nil? && customer != ""
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
|
||||
"/#{CGI.escape(id)}"
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
||||
else
|
||||
"#{self.class.resource_url}/#{CGI.escape(id)}"
|
||||
end
|
||||
|
||||
@ -10,14 +10,11 @@ module Stripe
|
||||
|
||||
def resource_url
|
||||
if respond_to?(:recipient) && !recipient.nil? && !recipient.empty?
|
||||
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards" \
|
||||
"/#{CGI.escape(id)}"
|
||||
"#{Recipient.resource_url}/#{CGI.escape(recipient)}/cards/#{CGI.escape(id)}"
|
||||
elsif respond_to?(:customer) && !customer.nil? && !customer.empty?
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources" \
|
||||
"/#{CGI.escape(id)}"
|
||||
"#{Customer.resource_url}/#{CGI.escape(customer)}/sources/#{CGI.escape(id)}"
|
||||
elsif respond_to?(:account) && !account.nil? && !account.empty?
|
||||
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts" \
|
||||
"/#{CGI.escape(id)}"
|
||||
"#{Account.resource_url}/#{CGI.escape(account)}/external_accounts/#{CGI.escape(id)}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -21,8 +21,7 @@ module Stripe
|
||||
end
|
||||
|
||||
def mark_uncollectible(params = {}, opts = {})
|
||||
resp, opts = request(:post, resource_url + "/mark_uncollectible", params,
|
||||
opts)
|
||||
resp, opts = request(:post, resource_url + "/mark_uncollectible", params, opts)
|
||||
initialize_from(resp.data, opts)
|
||||
end
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ module Stripe
|
||||
|
||||
def 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
|
||||
|
||||
@ -12,21 +12,13 @@ module Stripe
|
||||
custom_method :return_order, http_verb: :post, http_path: "returns"
|
||||
|
||||
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)
|
||||
end
|
||||
|
||||
def return_order(params, opts = {})
|
||||
resp, opts = request(:post, returns_url, params, opts)
|
||||
Util.convert_to_stripe_object(resp.data, opts)
|
||||
end
|
||||
|
||||
private def pay_url
|
||||
resource_url + "/pay"
|
||||
end
|
||||
|
||||
private def returns_url
|
||||
resource_url + "/returns"
|
||||
def return_order(params = {}, opts = {})
|
||||
resp, opts = request(:post, resource_url + "/returns", params, opts)
|
||||
initialize_from(resp.data, opts)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Recipients objects are deprecated. Please use Stripe Connect instead.
|
||||
module Stripe
|
||||
# Recipients objects are deprecated. Please use Stripe Connect instead.
|
||||
class Recipient < APIResource
|
||||
extend Stripe::APIOperations::Create
|
||||
include Stripe::APIOperations::Delete
|
||||
|
||||
@ -10,8 +10,7 @@ module Stripe
|
||||
OBJECT_NAME = "subscription_item".freeze
|
||||
|
||||
def usage_record_summaries(params = {}, opts = {})
|
||||
resp, opts = request(:get, resource_url + "/usage_record_summaries",
|
||||
params, opts)
|
||||
resp, opts = request(:get, resource_url + "/usage_record_summaries", params, opts)
|
||||
Util.convert_to_stripe_object(resp.data, opts)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user