stripe 3.3.2 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +20 -0
- data/.rubocop_todo.yml +62 -0
- data/.travis.yml +1 -1
- data/Gemfile +19 -12
- data/History.txt +10 -0
- data/README.md +5 -1
- data/Rakefile +8 -5
- data/VERSION +1 -1
- data/bin/stripe-console +2 -2
- data/lib/stripe.rb +72 -74
- data/lib/stripe/account.rb +15 -17
- data/lib/stripe/alipay_account.rb +10 -7
- data/lib/stripe/api_operations/create.rb +1 -1
- data/lib/stripe/api_operations/delete.rb +1 -1
- data/lib/stripe/api_operations/list.rb +2 -2
- data/lib/stripe/api_operations/request.rb +5 -12
- data/lib/stripe/api_operations/save.rb +6 -6
- data/lib/stripe/api_resource.rb +7 -9
- data/lib/stripe/apple_pay_domain.rb +2 -2
- data/lib/stripe/application_fee.rb +5 -5
- data/lib/stripe/application_fee_refund.rb +5 -5
- data/lib/stripe/balance.rb +1 -1
- data/lib/stripe/balance_transaction.rb +2 -2
- data/lib/stripe/bank_account.rb +7 -7
- data/lib/stripe/bitcoin_receiver.rb +4 -2
- data/lib/stripe/bitcoin_transaction.rb +3 -1
- data/lib/stripe/card.rb +5 -5
- data/lib/stripe/charge.rb +18 -18
- data/lib/stripe/country_spec.rb +2 -2
- data/lib/stripe/coupon.rb +1 -1
- data/lib/stripe/customer.rb +23 -23
- data/lib/stripe/dispute.rb +3 -3
- data/lib/stripe/ephemeral_key.rb +4 -4
- data/lib/stripe/errors.rb +4 -4
- data/lib/stripe/event.rb +1 -1
- data/lib/stripe/file_upload.rb +5 -5
- data/lib/stripe/invoice.rb +7 -7
- data/lib/stripe/invoice_item.rb +1 -1
- data/lib/stripe/invoice_line_item.rb +1 -1
- data/lib/stripe/list_object.rb +14 -18
- data/lib/stripe/login_link.rb +3 -3
- data/lib/stripe/oauth.rb +15 -13
- data/lib/stripe/order.rb +5 -5
- data/lib/stripe/order_return.rb +1 -1
- data/lib/stripe/payout.rb +3 -3
- data/lib/stripe/plan.rb +1 -1
- data/lib/stripe/product.rb +1 -1
- data/lib/stripe/recipient.rb +3 -2
- data/lib/stripe/recipient_transfer.rb +1 -2
- data/lib/stripe/refund.rb +1 -1
- data/lib/stripe/reversal.rb +5 -5
- data/lib/stripe/singleton_api_resource.rb +3 -3
- data/lib/stripe/sku.rb +1 -1
- data/lib/stripe/source.rb +13 -10
- data/lib/stripe/stripe_client.rb +149 -169
- data/lib/stripe/stripe_object.rb +77 -76
- data/lib/stripe/subscription.rb +5 -5
- data/lib/stripe/subscription_item.rb +2 -2
- data/lib/stripe/three_d_secure.rb +1 -1
- data/lib/stripe/token.rb +1 -1
- data/lib/stripe/transfer.rb +3 -3
- data/lib/stripe/util.rb +77 -62
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe/webhook.rb +14 -10
- data/stripe.gemspec +14 -14
- data/test/stripe/account_test.rb +69 -81
- data/test/stripe/alipay_account_test.rb +19 -1
- data/test/stripe/api_operations_test.rb +7 -7
- data/test/stripe/api_resource_test.rb +224 -260
- data/test/stripe/apple_pay_domain_test.rb +8 -8
- data/test/stripe/application_fee_refund_test.rb +8 -8
- data/test/stripe/application_fee_test.rb +3 -3
- data/test/stripe/balance_test.rb +2 -2
- data/test/stripe/bank_account_test.rb +9 -11
- data/test/stripe/charge_test.rb +11 -11
- data/test/stripe/country_spec_test.rb +4 -4
- data/test/stripe/coupon_test.rb +10 -10
- data/test/stripe/customer_card_test.rb +11 -15
- data/test/stripe/customer_test.rb +26 -27
- data/test/stripe/dispute_test.rb +8 -8
- data/test/stripe/ephemeral_key_test.rb +14 -14
- data/test/stripe/errors_test.rb +2 -2
- data/test/stripe/file_upload_test.rb +26 -28
- data/test/stripe/invoice_item_test.rb +14 -14
- data/test/stripe/invoice_line_item_test.rb +1 -1
- data/test/stripe/invoice_test.rb +37 -37
- data/test/stripe/list_object_test.rb +60 -76
- data/test/stripe/login_link_test.rb +14 -14
- data/test/stripe/oauth_test.rb +42 -50
- data/test/stripe/order_return_test.rb +5 -5
- data/test/stripe/order_test.rb +12 -12
- data/test/stripe/payout_test.rb +9 -9
- data/test/stripe/plan_test.rb +9 -9
- data/test/stripe/product_test.rb +8 -8
- data/test/stripe/recipient_test.rb +9 -10
- data/test/stripe/refund_test.rb +9 -9
- data/test/stripe/reversal_test.rb +10 -10
- data/test/stripe/sku_test.rb +8 -8
- data/test/stripe/source_test.rb +14 -16
- data/test/stripe/stripe_client_test.rb +235 -266
- data/test/stripe/stripe_object_test.rb +163 -147
- data/test/stripe/stripe_response_test.rb +4 -3
- data/test/stripe/subscription_item_test.rb +11 -11
- data/test/stripe/subscription_test.rb +14 -14
- data/test/stripe/three_d_secure_test.rb +2 -2
- data/test/stripe/transfer_test.rb +8 -8
- data/test/stripe/util_test.rb +59 -57
- data/test/stripe/webhook_test.rb +18 -16
- data/test/stripe_test.rb +4 -4
- data/test/test_data.rb +26 -26
- data/test/test_helper.rb +29 -25
- metadata +6 -10
- data/test/stripe/bitcoin_receiver_test.rb +0 -67
- data/test/stripe/bitcoin_transaction_test.rb +0 -19
- data/test/stripe/recipient_card_test.rb +0 -44
data/lib/stripe/country_spec.rb
CHANGED
data/lib/stripe/coupon.rb
CHANGED
data/lib/stripe/customer.rb
CHANGED
@@ -5,75 +5,75 @@ module Stripe
|
|
5
5
|
include Stripe::APIOperations::Save
|
6
6
|
extend Stripe::APIOperations::List
|
7
7
|
|
8
|
-
OBJECT_NAME =
|
8
|
+
OBJECT_NAME = "customer".freeze
|
9
9
|
|
10
10
|
save_nested_resource :source
|
11
11
|
|
12
|
-
def add_invoice_item(params, opts={})
|
12
|
+
def add_invoice_item(params, opts = {})
|
13
13
|
opts = @opts.merge(Util.normalize_opts(opts))
|
14
|
-
InvoiceItem.create(params.merge(:
|
14
|
+
InvoiceItem.create(params.merge(customer: id), opts)
|
15
15
|
end
|
16
16
|
|
17
|
-
def invoices(params={}, opts={})
|
17
|
+
def invoices(params = {}, opts = {})
|
18
18
|
opts = @opts.merge(Util.normalize_opts(opts))
|
19
|
-
Invoice.all(params.merge(:
|
19
|
+
Invoice.all(params.merge(customer: id), opts)
|
20
20
|
end
|
21
21
|
|
22
|
-
def invoice_items(params={}, opts={})
|
22
|
+
def invoice_items(params = {}, opts = {})
|
23
23
|
opts = @opts.merge(Util.normalize_opts(opts))
|
24
|
-
InvoiceItem.all(params.merge(:
|
24
|
+
InvoiceItem.all(params.merge(customer: id), opts)
|
25
25
|
end
|
26
26
|
|
27
|
-
def upcoming_invoice(params={}, opts={})
|
27
|
+
def upcoming_invoice(params = {}, opts = {})
|
28
28
|
opts = @opts.merge(Util.normalize_opts(opts))
|
29
|
-
Invoice.upcoming(params.merge(:
|
29
|
+
Invoice.upcoming(params.merge(customer: id), opts)
|
30
30
|
end
|
31
31
|
|
32
|
-
def charges(params={}, opts={})
|
32
|
+
def charges(params = {}, opts = {})
|
33
33
|
opts = @opts.merge(Util.normalize_opts(opts))
|
34
|
-
Charge.all(params.merge(:
|
34
|
+
Charge.all(params.merge(customer: id), opts)
|
35
35
|
end
|
36
36
|
|
37
|
-
def create_upcoming_invoice(params={}, opts={})
|
37
|
+
def create_upcoming_invoice(params = {}, opts = {})
|
38
38
|
opts = @opts.merge(Util.normalize_opts(opts))
|
39
|
-
Invoice.create(params.merge(:
|
39
|
+
Invoice.create(params.merge(customer: id), opts)
|
40
40
|
end
|
41
41
|
|
42
|
-
def cancel_subscription(params={}, opts={})
|
42
|
+
def cancel_subscription(params = {}, opts = {})
|
43
43
|
resp, opts = request(:delete, subscription_url, params, opts)
|
44
|
-
initialize_from({ :
|
44
|
+
initialize_from({ subscription: resp.data }, opts, true)
|
45
45
|
subscription
|
46
46
|
end
|
47
47
|
|
48
|
-
def update_subscription(params={}, opts={})
|
48
|
+
def update_subscription(params = {}, opts = {})
|
49
49
|
resp, opts = request(:post, subscription_url, params, opts)
|
50
|
-
initialize_from({ :
|
50
|
+
initialize_from({ subscription: resp.data }, opts, true)
|
51
51
|
subscription
|
52
52
|
end
|
53
53
|
|
54
|
-
def create_subscription(params={}, opts={})
|
54
|
+
def create_subscription(params = {}, opts = {})
|
55
55
|
resp, opts = request(:post, subscriptions_url, params, opts)
|
56
|
-
initialize_from({ :
|
56
|
+
initialize_from({ subscription: resp.data }, opts, true)
|
57
57
|
subscription
|
58
58
|
end
|
59
59
|
|
60
60
|
def delete_discount
|
61
61
|
_, opts = request(:delete, discount_url)
|
62
|
-
initialize_from({ :
|
62
|
+
initialize_from({ discount: nil }, opts, true)
|
63
63
|
end
|
64
64
|
|
65
65
|
private
|
66
66
|
|
67
67
|
def discount_url
|
68
|
-
resource_url +
|
68
|
+
resource_url + "/discount"
|
69
69
|
end
|
70
70
|
|
71
71
|
def subscription_url
|
72
|
-
resource_url +
|
72
|
+
resource_url + "/subscription"
|
73
73
|
end
|
74
74
|
|
75
75
|
def subscriptions_url
|
76
|
-
resource_url +
|
76
|
+
resource_url + "/subscriptions"
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/lib/stripe/dispute.rb
CHANGED
@@ -3,15 +3,15 @@ module Stripe
|
|
3
3
|
extend Stripe::APIOperations::List
|
4
4
|
include Stripe::APIOperations::Save
|
5
5
|
|
6
|
-
OBJECT_NAME =
|
6
|
+
OBJECT_NAME = "dispute".freeze
|
7
7
|
|
8
|
-
def close(params={}, opts={})
|
8
|
+
def close(params = {}, opts = {})
|
9
9
|
resp, opts = request(:post, close_url, params, opts)
|
10
10
|
initialize_from(resp.data, opts)
|
11
11
|
end
|
12
12
|
|
13
13
|
def close_url
|
14
|
-
resource_url +
|
14
|
+
resource_url + "/close"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
data/lib/stripe/ephemeral_key.rb
CHANGED
@@ -3,15 +3,15 @@ module Stripe
|
|
3
3
|
extend Stripe::APIOperations::Create
|
4
4
|
include Stripe::APIOperations::Delete
|
5
5
|
|
6
|
-
OBJECT_NAME =
|
6
|
+
OBJECT_NAME = "ephemeral_key".freeze
|
7
7
|
|
8
8
|
def self.resource_url
|
9
|
-
|
9
|
+
"/v1/ephemeral_keys"
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.create(params={}, opts={})
|
12
|
+
def self.create(params = {}, opts = {})
|
13
13
|
opts = Util.normalize_opts(opts)
|
14
|
-
raise ArgumentError
|
14
|
+
raise ArgumentError, "stripe_version must be specified to create an ephemeral key" unless opts[:stripe_version]
|
15
15
|
super
|
16
16
|
end
|
17
17
|
end
|
data/lib/stripe/errors.rb
CHANGED
@@ -17,7 +17,7 @@ module Stripe
|
|
17
17
|
attr_reader :request_id
|
18
18
|
|
19
19
|
# Initializes a StripeError.
|
20
|
-
def initialize(message=nil, http_status: nil, http_body: nil, json_body: nil,
|
20
|
+
def initialize(message = nil, http_status: nil, http_body: nil, json_body: nil,
|
21
21
|
http_headers: nil)
|
22
22
|
@message = message
|
23
23
|
@http_status = http_status
|
@@ -60,7 +60,7 @@ module Stripe
|
|
60
60
|
def initialize(message, param, code, http_status: nil, http_body: nil, json_body: nil,
|
61
61
|
http_headers: nil)
|
62
62
|
super(message, http_status: http_status, http_body: http_body,
|
63
|
-
|
63
|
+
json_body: json_body, http_headers: http_headers)
|
64
64
|
@param = param
|
65
65
|
@code = code
|
66
66
|
end
|
@@ -74,7 +74,7 @@ module Stripe
|
|
74
74
|
def initialize(message, param, http_status: nil, http_body: nil, json_body: nil,
|
75
75
|
http_headers: nil)
|
76
76
|
super(message, http_status: http_status, http_body: http_body,
|
77
|
-
|
77
|
+
json_body: json_body, http_headers: http_headers)
|
78
78
|
@param = param
|
79
79
|
end
|
80
80
|
end
|
@@ -109,7 +109,7 @@ module Stripe
|
|
109
109
|
def initialize(code, description, http_status: nil, http_body: nil, json_body: nil,
|
110
110
|
http_headers: nil)
|
111
111
|
super(description, http_status: http_status, http_body: http_body,
|
112
|
-
|
112
|
+
json_body: json_body, http_headers: http_headers)
|
113
113
|
@code = code
|
114
114
|
end
|
115
115
|
end
|
data/lib/stripe/event.rb
CHANGED
data/lib/stripe/file_upload.rb
CHANGED
@@ -3,20 +3,20 @@ module Stripe
|
|
3
3
|
extend Stripe::APIOperations::Create
|
4
4
|
extend Stripe::APIOperations::List
|
5
5
|
|
6
|
-
OBJECT_NAME =
|
6
|
+
OBJECT_NAME = "file_upload".freeze
|
7
7
|
|
8
8
|
def self.resource_url
|
9
9
|
"/v1/files"
|
10
10
|
end
|
11
11
|
|
12
|
-
def self.request(method, url, params={}, opts={})
|
12
|
+
def self.request(method, url, params = {}, opts = {})
|
13
13
|
opts = {
|
14
|
-
:
|
14
|
+
api_base: Stripe.uploads_base,
|
15
15
|
}.merge(Util.normalize_opts(opts))
|
16
16
|
super
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.create(params={}, opts={})
|
19
|
+
def self.create(params = {}, opts = {})
|
20
20
|
# rest-client would accept a vanilla `File` for upload, but Faraday does
|
21
21
|
# not. Support the old API by wrapping a `File` with an `UploadIO` object
|
22
22
|
# if we're given one.
|
@@ -25,7 +25,7 @@ module Stripe
|
|
25
25
|
end
|
26
26
|
|
27
27
|
opts = {
|
28
|
-
:
|
28
|
+
content_type: "multipart/form-data",
|
29
29
|
}.merge(Util.normalize_opts(opts))
|
30
30
|
super
|
31
31
|
end
|
data/lib/stripe/invoice.rb
CHANGED
@@ -4,26 +4,26 @@ module Stripe
|
|
4
4
|
include Stripe::APIOperations::Save
|
5
5
|
extend Stripe::APIOperations::Create
|
6
6
|
|
7
|
-
OBJECT_NAME =
|
7
|
+
OBJECT_NAME = "invoice".freeze
|
8
8
|
|
9
|
-
def self.upcoming(params, opts={})
|
9
|
+
def self.upcoming(params, opts = {})
|
10
10
|
resp, opts = request(:get, upcoming_url, params, opts)
|
11
11
|
Util.convert_to_stripe_object(resp.data, opts)
|
12
12
|
end
|
13
13
|
|
14
|
-
def pay(params={}, opts={})
|
14
|
+
def pay(params = {}, opts = {})
|
15
15
|
resp, opts = request(:post, pay_url, params, opts)
|
16
16
|
initialize_from(resp.data, opts)
|
17
17
|
end
|
18
18
|
|
19
|
-
private
|
20
|
-
|
21
19
|
def self.upcoming_url
|
22
|
-
resource_url +
|
20
|
+
resource_url + "/upcoming"
|
23
21
|
end
|
22
|
+
private_class_method :upcoming_url
|
24
23
|
|
25
24
|
def pay_url
|
26
|
-
resource_url +
|
25
|
+
resource_url + "/pay"
|
27
26
|
end
|
27
|
+
private :pay_url
|
28
28
|
end
|
29
29
|
end
|
data/lib/stripe/invoice_item.rb
CHANGED
data/lib/stripe/list_object.rb
CHANGED
@@ -5,7 +5,7 @@ module Stripe
|
|
5
5
|
include Stripe::APIOperations::Request
|
6
6
|
include Stripe::APIOperations::Create
|
7
7
|
|
8
|
-
OBJECT_NAME =
|
8
|
+
OBJECT_NAME = "list".freeze
|
9
9
|
|
10
10
|
# This accessor allows a `ListObject` to inherit various filters that were
|
11
11
|
# given to a predecessor. This allows for things like consistent limits,
|
@@ -15,8 +15,8 @@ module Stripe
|
|
15
15
|
# An empty list object. This is returned from +next+ when we know that
|
16
16
|
# there isn't a next page in order to replicate the behavior of the API
|
17
17
|
# when it attempts to return a page beyond the last.
|
18
|
-
def self.empty_list(opts={})
|
19
|
-
ListObject.construct_from({ :
|
18
|
+
def self.empty_list(opts = {})
|
19
|
+
ListObject.construct_from({ data: [] }, opts)
|
20
20
|
end
|
21
21
|
|
22
22
|
def initialize(*args)
|
@@ -29,7 +29,7 @@ module Stripe
|
|
29
29
|
when String, Symbol
|
30
30
|
super
|
31
31
|
else
|
32
|
-
raise ArgumentError
|
32
|
+
raise ArgumentError, "You tried to access the #{k.inspect} index, but ListObject types only support String keys. (HINT: List calls return an object with a 'data' (which is the data array). You likely want to call #data[#{k.inspect}])"
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -39,7 +39,7 @@ module Stripe
|
|
39
39
|
# Note that this method makes no effort to fetch a new page when it gets to
|
40
40
|
# the end of the current page's resources. See also +auto_paging_each+.
|
41
41
|
def each(&blk)
|
42
|
-
|
42
|
+
data.each(&blk)
|
43
43
|
end
|
44
44
|
|
45
45
|
# Iterates through each resource in all pages, making additional fetches to
|
@@ -61,12 +61,12 @@ module Stripe
|
|
61
61
|
|
62
62
|
# Returns true if the page object contains no elements.
|
63
63
|
def empty?
|
64
|
-
|
64
|
+
data.empty?
|
65
65
|
end
|
66
66
|
|
67
|
-
def retrieve(id, opts={})
|
67
|
+
def retrieve(id, opts = {})
|
68
68
|
id, retrieve_params = Util.normalize_id(id)
|
69
|
-
resp, opts = request(:get,"#{resource_url}/#{CGI.escape(id)}", retrieve_params, opts)
|
69
|
+
resp, opts = request(:get, "#{resource_url}/#{CGI.escape(id)}", retrieve_params, opts)
|
70
70
|
Util.convert_to_stripe_object(resp.data, opts)
|
71
71
|
end
|
72
72
|
|
@@ -74,13 +74,11 @@ module Stripe
|
|
74
74
|
#
|
75
75
|
# This method will try to respect the limit of the current page. If none
|
76
76
|
# was given, the default limit will be fetched again.
|
77
|
-
def next_page(params={}, opts={})
|
78
|
-
return self.class.empty_list(opts)
|
77
|
+
def next_page(params = {}, opts = {})
|
78
|
+
return self.class.empty_list(opts) unless has_more
|
79
79
|
last_id = data.last.id
|
80
80
|
|
81
|
-
params = filters.merge(
|
82
|
-
:starting_after => last_id,
|
83
|
-
}).merge(params)
|
81
|
+
params = filters.merge(starting_after: last_id).merge(params)
|
84
82
|
|
85
83
|
list(params, opts)
|
86
84
|
end
|
@@ -89,18 +87,16 @@ module Stripe
|
|
89
87
|
#
|
90
88
|
# This method will try to respect the limit of the current page. If none
|
91
89
|
# was given, the default limit will be fetched again.
|
92
|
-
def previous_page(params={}, opts={})
|
90
|
+
def previous_page(params = {}, opts = {})
|
93
91
|
first_id = data.first.id
|
94
92
|
|
95
|
-
params = filters.merge(
|
96
|
-
:ending_before => first_id,
|
97
|
-
}).merge(params)
|
93
|
+
params = filters.merge(ending_before: first_id).merge(params)
|
98
94
|
|
99
95
|
list(params, opts)
|
100
96
|
end
|
101
97
|
|
102
98
|
def resource_url
|
103
|
-
|
99
|
+
url ||
|
104
100
|
raise(ArgumentError, "List object does not contain a 'url' field.")
|
105
101
|
end
|
106
102
|
end
|
data/lib/stripe/login_link.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Stripe
|
2
2
|
class LoginLink < APIResource
|
3
|
-
OBJECT_NAME =
|
3
|
+
OBJECT_NAME = "login_link".freeze
|
4
4
|
|
5
|
-
def self.retrieve(
|
6
|
-
raise NotImplementedError
|
5
|
+
def self.retrieve(_id, _opts = nil)
|
6
|
+
raise NotImplementedError, "Login links do not have IDs and cannot be retrieved. They can only be created using accounts.login_links.create"
|
7
7
|
end
|
8
8
|
end
|
9
9
|
end
|
data/lib/stripe/oauth.rb
CHANGED
@@ -12,43 +12,45 @@ module Stripe
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.get_client_id(params={})
|
15
|
+
def self.get_client_id(params = {})
|
16
16
|
client_id = params[:client_id] || Stripe.client_id
|
17
17
|
unless client_id
|
18
|
-
raise AuthenticationError
|
18
|
+
raise AuthenticationError, "No client_id provided. " \
|
19
19
|
'Set your client_id using "Stripe.client_id = <CLIENT-ID>". ' \
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
"You can find your client_ids in your Stripe dashboard at " \
|
21
|
+
"https://dashboard.stripe.com/account/applications/settings, " \
|
22
|
+
"after registering your account as a platform. See " \
|
23
|
+
"https://stripe.com/docs/connect/standalone-accounts for details, " \
|
24
|
+
"or email support@stripe.com if you have any questions."
|
25
25
|
end
|
26
26
|
client_id
|
27
27
|
end
|
28
28
|
|
29
|
-
def self.authorize_url(params={}, opts={})
|
29
|
+
def self.authorize_url(params = {}, opts = {})
|
30
30
|
base = opts[:connect_base] || Stripe.connect_base
|
31
31
|
|
32
32
|
params[:client_id] = get_client_id(params)
|
33
|
-
params[:response_type] ||=
|
33
|
+
params[:response_type] ||= "code"
|
34
34
|
query = Util.encode_parameters(params)
|
35
35
|
|
36
36
|
"#{base}/oauth/authorize?#{query}"
|
37
37
|
end
|
38
38
|
|
39
|
-
def self.token(params={}, opts={})
|
39
|
+
def self.token(params = {}, opts = {})
|
40
40
|
opts = Util.normalize_opts(opts)
|
41
41
|
resp, opts = OAuthOperations.request(
|
42
|
-
:post,
|
42
|
+
:post, "/oauth/token", params, opts
|
43
|
+
)
|
43
44
|
# This is just going to return a generic StripeObject, but that's okay
|
44
45
|
Util.convert_to_stripe_object(resp.data, opts)
|
45
46
|
end
|
46
47
|
|
47
|
-
def self.deauthorize(params={}, opts={})
|
48
|
+
def self.deauthorize(params = {}, opts = {})
|
48
49
|
opts = Util.normalize_opts(opts)
|
49
50
|
params[:client_id] = get_client_id(params)
|
50
51
|
resp, opts = OAuthOperations.request(
|
51
|
-
:post,
|
52
|
+
:post, "/oauth/deauthorize", params, opts
|
53
|
+
)
|
52
54
|
# This is just going to return a generic StripeObject, but that's okay
|
53
55
|
Util.convert_to_stripe_object(resp.data, opts)
|
54
56
|
end
|