stripe 1.27.2 → 5.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +942 -0
  3. data/CODE_OF_CONDUCT.md +77 -0
  4. data/Gemfile +29 -4
  5. data/History.txt +1 -361
  6. data/README.md +349 -0
  7. data/Rakefile +33 -3
  8. data/VERSION +1 -1
  9. data/bin/stripe-console +14 -5
  10. data/lib/data/ca-certificates.crt +4016 -5138
  11. data/lib/stripe.rb +102 -320
  12. data/lib/stripe/api_operations/create.rb +5 -9
  13. data/lib/stripe/api_operations/delete.rb +32 -4
  14. data/lib/stripe/api_operations/list.rb +11 -9
  15. data/lib/stripe/api_operations/nested_resource.rb +73 -0
  16. data/lib/stripe/api_operations/request.rb +66 -11
  17. data/lib/stripe/api_operations/save.rb +97 -0
  18. data/lib/stripe/api_resource.rb +96 -12
  19. data/lib/stripe/connection_manager.rb +164 -0
  20. data/lib/stripe/error_object.rb +94 -0
  21. data/lib/stripe/errors.rb +177 -0
  22. data/lib/stripe/instrumentation.rb +82 -0
  23. data/lib/stripe/list_object.rb +118 -13
  24. data/lib/stripe/multipart_encoder.rb +131 -0
  25. data/lib/stripe/oauth.rb +65 -0
  26. data/lib/stripe/object_types.rb +104 -0
  27. data/lib/stripe/resources.rb +87 -0
  28. data/lib/stripe/resources/account.rb +170 -0
  29. data/lib/stripe/resources/account_link.rb +10 -0
  30. data/lib/stripe/resources/alipay_account.rb +34 -0
  31. data/lib/stripe/resources/apple_pay_domain.rb +17 -0
  32. data/lib/stripe/resources/application_fee.rb +14 -0
  33. data/lib/stripe/resources/application_fee_refund.rb +30 -0
  34. data/lib/stripe/resources/balance.rb +8 -0
  35. data/lib/stripe/resources/balance_transaction.rb +10 -0
  36. data/lib/stripe/resources/bank_account.rb +43 -0
  37. data/lib/stripe/resources/billing_portal/configuration.rb +14 -0
  38. data/lib/stripe/resources/billing_portal/session.rb +12 -0
  39. data/lib/stripe/resources/bitcoin_receiver.rb +24 -0
  40. data/lib/stripe/resources/bitcoin_transaction.rb +15 -0
  41. data/lib/stripe/resources/capability.rb +33 -0
  42. data/lib/stripe/resources/card.rb +38 -0
  43. data/lib/stripe/resources/charge.rb +23 -0
  44. data/lib/stripe/resources/checkout/session.rb +16 -0
  45. data/lib/stripe/resources/country_spec.rb +10 -0
  46. data/lib/stripe/resources/coupon.rb +13 -0
  47. data/lib/stripe/resources/credit_note.rb +33 -0
  48. data/lib/stripe/resources/credit_note_line_item.rb +7 -0
  49. data/lib/stripe/resources/customer.rb +41 -0
  50. data/lib/stripe/resources/customer_balance_transaction.rb +30 -0
  51. data/lib/stripe/resources/discount.rb +7 -0
  52. data/lib/stripe/resources/dispute.rb +22 -0
  53. data/lib/stripe/resources/ephemeral_key.rb +20 -0
  54. data/lib/stripe/resources/event.rb +10 -0
  55. data/lib/stripe/resources/exchange_rate.rb +10 -0
  56. data/lib/stripe/resources/file.rb +36 -0
  57. data/lib/stripe/resources/file_link.rb +12 -0
  58. data/lib/stripe/resources/identity/verification_report.rb +12 -0
  59. data/lib/stripe/resources/identity/verification_session.rb +35 -0
  60. data/lib/stripe/resources/invoice.rb +74 -0
  61. data/lib/stripe/resources/invoice_item.rb +13 -0
  62. data/lib/stripe/resources/invoice_line_item.rb +7 -0
  63. data/lib/stripe/resources/issuing/authorization.rb +34 -0
  64. data/lib/stripe/resources/issuing/card.rb +25 -0
  65. data/lib/stripe/resources/issuing/card_details.rb +9 -0
  66. data/lib/stripe/resources/issuing/cardholder.rb +14 -0
  67. data/lib/stripe/resources/issuing/dispute.rb +25 -0
  68. data/lib/stripe/resources/issuing/transaction.rb +13 -0
  69. data/lib/stripe/resources/line_item.rb +7 -0
  70. data/lib/stripe/resources/login_link.rb +14 -0
  71. data/lib/stripe/resources/mandate.rb +8 -0
  72. data/lib/stripe/resources/order.rb +33 -0
  73. data/lib/stripe/resources/order_return.rb +10 -0
  74. data/lib/stripe/resources/payment_intent.rb +43 -0
  75. data/lib/stripe/resources/payment_method.rb +33 -0
  76. data/lib/stripe/resources/payout.rb +33 -0
  77. data/lib/stripe/resources/person.rb +31 -0
  78. data/lib/stripe/resources/plan.rb +13 -0
  79. data/lib/stripe/resources/price.rb +12 -0
  80. data/lib/stripe/resources/product.rb +13 -0
  81. data/lib/stripe/resources/promotion_code.rb +12 -0
  82. data/lib/stripe/resources/radar/early_fraud_warning.rb +12 -0
  83. data/lib/stripe/resources/radar/value_list.rb +15 -0
  84. data/lib/stripe/resources/radar/value_list_item.rb +14 -0
  85. data/lib/stripe/resources/recipient.rb +14 -0
  86. data/lib/stripe/resources/recipient_transfer.rb +7 -0
  87. data/lib/stripe/resources/refund.rb +12 -0
  88. data/lib/stripe/resources/reporting/report_run.rb +13 -0
  89. data/lib/stripe/resources/reporting/report_type.rb +13 -0
  90. data/lib/stripe/resources/reversal.rb +29 -0
  91. data/lib/stripe/resources/review.rb +21 -0
  92. data/lib/stripe/resources/setup_attempt.rb +10 -0
  93. data/lib/stripe/resources/setup_intent.rb +33 -0
  94. data/lib/stripe/resources/sigma/scheduled_query_run.rb +16 -0
  95. data/lib/stripe/resources/sku.rb +13 -0
  96. data/lib/stripe/resources/source.rb +47 -0
  97. data/lib/stripe/resources/source_transaction.rb +7 -0
  98. data/lib/stripe/resources/subscription.rb +26 -0
  99. data/lib/stripe/resources/subscription_item.rb +26 -0
  100. data/lib/stripe/resources/subscription_schedule.rb +33 -0
  101. data/lib/stripe/resources/tax_id.rb +26 -0
  102. data/lib/stripe/resources/tax_rate.rb +12 -0
  103. data/lib/stripe/resources/terminal/connection_token.rb +12 -0
  104. data/lib/stripe/resources/terminal/location.rb +15 -0
  105. data/lib/stripe/resources/terminal/reader.rb +15 -0
  106. data/lib/stripe/resources/three_d_secure.rb +14 -0
  107. data/lib/stripe/resources/token.rb +10 -0
  108. data/lib/stripe/resources/topup.rb +23 -0
  109. data/lib/stripe/resources/transfer.rb +27 -0
  110. data/lib/stripe/resources/usage_record.rb +7 -0
  111. data/lib/stripe/resources/usage_record_summary.rb +7 -0
  112. data/lib/stripe/resources/webhook_endpoint.rb +13 -0
  113. data/lib/stripe/singleton_api_resource.rb +13 -7
  114. data/lib/stripe/stripe_client.rb +989 -0
  115. data/lib/stripe/stripe_configuration.rb +194 -0
  116. data/lib/stripe/stripe_object.rb +481 -148
  117. data/lib/stripe/stripe_response.rb +82 -0
  118. data/lib/stripe/util.rb +265 -70
  119. data/lib/stripe/version.rb +3 -1
  120. data/lib/stripe/webhook.rb +121 -0
  121. data/stripe.gemspec +35 -21
  122. metadata +118 -198
  123. data/.gitignore +0 -4
  124. data/.travis.yml +0 -22
  125. data/README.rdoc +0 -43
  126. data/gemfiles/default-with-activesupport.gemfile +0 -10
  127. data/gemfiles/json.gemfile +0 -12
  128. data/gemfiles/yajl.gemfile +0 -12
  129. data/lib/stripe/account.rb +0 -39
  130. data/lib/stripe/api_operations/update.rb +0 -19
  131. data/lib/stripe/application_fee.rb +0 -20
  132. data/lib/stripe/application_fee_refund.rb +0 -14
  133. data/lib/stripe/balance.rb +0 -4
  134. data/lib/stripe/balance_transaction.rb +0 -9
  135. data/lib/stripe/bank_account.rb +0 -19
  136. data/lib/stripe/bitcoin_receiver.rb +0 -20
  137. data/lib/stripe/bitcoin_transaction.rb +0 -9
  138. data/lib/stripe/card.rb +0 -21
  139. data/lib/stripe/charge.rb +0 -62
  140. data/lib/stripe/coupon.rb +0 -8
  141. data/lib/stripe/customer.rb +0 -75
  142. data/lib/stripe/dispute.rb +0 -16
  143. data/lib/stripe/errors/api_connection_error.rb +0 -4
  144. data/lib/stripe/errors/api_error.rb +0 -4
  145. data/lib/stripe/errors/authentication_error.rb +0 -4
  146. data/lib/stripe/errors/card_error.rb +0 -12
  147. data/lib/stripe/errors/invalid_request_error.rb +0 -11
  148. data/lib/stripe/errors/rate_limit_error.rb +0 -4
  149. data/lib/stripe/errors/stripe_error.rb +0 -26
  150. data/lib/stripe/event.rb +0 -5
  151. data/lib/stripe/file_upload.rb +0 -22
  152. data/lib/stripe/invoice.rb +0 -27
  153. data/lib/stripe/invoice_item.rb +0 -8
  154. data/lib/stripe/order.rb +0 -19
  155. data/lib/stripe/plan.rb +0 -8
  156. data/lib/stripe/product.rb +0 -16
  157. data/lib/stripe/recipient.rb +0 -12
  158. data/lib/stripe/refund.rb +0 -7
  159. data/lib/stripe/reversal.rb +0 -14
  160. data/lib/stripe/sku.rb +0 -8
  161. data/lib/stripe/subscription.rb +0 -25
  162. data/lib/stripe/token.rb +0 -5
  163. data/lib/stripe/transfer.rb +0 -17
  164. data/test/stripe/account_test.rb +0 -118
  165. data/test/stripe/api_resource_test.rb +0 -632
  166. data/test/stripe/application_fee_refund_test.rb +0 -47
  167. data/test/stripe/application_fee_test.rb +0 -22
  168. data/test/stripe/balance_test.rb +0 -11
  169. data/test/stripe/bitcoin_receiver_test.rb +0 -61
  170. data/test/stripe/bitcoin_transaction_test.rb +0 -29
  171. data/test/stripe/charge_refund_test.rb +0 -55
  172. data/test/stripe/charge_test.rb +0 -118
  173. data/test/stripe/coupon_test.rb +0 -20
  174. data/test/stripe/customer_card_test.rb +0 -63
  175. data/test/stripe/customer_test.rb +0 -88
  176. data/test/stripe/dispute_test.rb +0 -45
  177. data/test/stripe/file_upload_test.rb +0 -28
  178. data/test/stripe/invoice_test.rb +0 -40
  179. data/test/stripe/list_object_test.rb +0 -16
  180. data/test/stripe/metadata_test.rb +0 -129
  181. data/test/stripe/order_test.rb +0 -52
  182. data/test/stripe/product_test.rb +0 -41
  183. data/test/stripe/recipient_card_test.rb +0 -57
  184. data/test/stripe/refund_test.rb +0 -55
  185. data/test/stripe/reversal_test.rb +0 -47
  186. data/test/stripe/sku_test.rb +0 -24
  187. data/test/stripe/stripe_object_test.rb +0 -28
  188. data/test/stripe/subscription_test.rb +0 -72
  189. data/test/stripe/transfer_test.rb +0 -25
  190. data/test/stripe/util_test.rb +0 -34
  191. data/test/test_data.rb +0 -666
  192. data/test/test_helper.rb +0 -41
@@ -1,34 +1,139 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Stripe
2
4
  class ListObject < StripeObject
5
+ include Enumerable
6
+ include Stripe::APIOperations::List
3
7
  include Stripe::APIOperations::Request
8
+ include Stripe::APIOperations::Create
9
+
10
+ OBJECT_NAME = "list"
11
+
12
+ # This accessor allows a `ListObject` to inherit various filters that were
13
+ # given to a predecessor. This allows for things like consistent limits,
14
+ # expansions, and predicates as a user pages through resources.
15
+ attr_accessor :filters
16
+
17
+ # An empty list object. This is returned from +next+ when we know that
18
+ # there isn't a next page in order to replicate the behavior of the API
19
+ # when it attempts to return a page beyond the last.
20
+ def self.empty_list(opts = {})
21
+ ListObject.construct_from({ data: [] }, opts)
22
+ end
23
+
24
+ def initialize(*args)
25
+ super
26
+ self.filters = {}
27
+ end
4
28
 
5
- def [](k)
6
- case k
29
+ def [](key)
30
+ case key
7
31
  when String, Symbol
8
32
  super
9
33
  else
10
- raise ArgumentError.new("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}])")
34
+ raise ArgumentError,
35
+ "You tried to access the #{key.inspect} index, but ListObject " \
36
+ "types only support String keys. (HINT: List calls return an " \
37
+ "object with a 'data' (which is the data array). You likely " \
38
+ "want to call #data[#{key.inspect}])"
11
39
  end
12
40
  end
13
41
 
42
+ # Iterates through each resource in the page represented by the current
43
+ # `ListObject`.
44
+ #
45
+ # Note that this method makes no effort to fetch a new page when it gets to
46
+ # the end of the current page's resources. See also +auto_paging_each+.
14
47
  def each(&blk)
15
- self.data.each(&blk)
48
+ data.each(&blk)
49
+ end
50
+
51
+ # Iterates through each resource in all pages, making additional fetches to
52
+ # the API as necessary.
53
+ #
54
+ # The default iteration direction is forwards according to Stripe's API
55
+ # "natural" ordering direction -- newer objects first, and moving towards
56
+ # older objects.
57
+ #
58
+ # However, if the initial list object was fetched using an `ending_before`
59
+ # cursor (and only `ending_before`, `starting_after` cannot also be
60
+ # included), the method assumes that the user is trying to iterate
61
+ # backwards compared to natural ordering and returns results that way --
62
+ # older objects first, and moving towards newer objects.
63
+ #
64
+ # Note that this method will make as many API calls as necessary to fetch
65
+ # all resources. For more granular control, please see +each+ and
66
+ # +next_page+.
67
+ def auto_paging_each(&blk)
68
+ return enum_for(:auto_paging_each) unless block_given?
69
+
70
+ page = self
71
+ loop do
72
+ # Backward iterating activates if we have an `ending_before` constraint
73
+ # and _just_ an `ending_before` constraint. If `starting_after` was
74
+ # also used, we iterate forwards normally.
75
+ if filters.include?(:ending_before) &&
76
+ !filters.include?(:starting_after)
77
+ page.reverse_each(&blk)
78
+ page = page.previous_page
79
+ else
80
+ page.each(&blk)
81
+ page = page.next_page
82
+ end
83
+
84
+ break if page.empty?
85
+ end
16
86
  end
17
87
 
18
- def retrieve(id, opts={})
88
+ # Returns true if the page object contains no elements.
89
+ def empty?
90
+ data.empty?
91
+ end
92
+
93
+ def retrieve(id, opts = {})
19
94
  id, retrieve_params = Util.normalize_id(id)
20
- response, opts = request(:get,"#{url}/#{CGI.escape(id)}", retrieve_params, opts)
21
- Util.convert_to_stripe_object(response, opts)
95
+ url = "#{resource_url}/#{CGI.escape(id)}"
96
+ resp, opts = execute_resource_request(:get, url, retrieve_params, opts)
97
+ Util.convert_to_stripe_object(resp.data, opts)
98
+ end
99
+
100
+ # Fetches the next page in the resource list (if there is one).
101
+ #
102
+ # This method will try to respect the limit of the current page. If none
103
+ # was given, the default limit will be fetched again.
104
+ def next_page(params = {}, opts = {})
105
+ return self.class.empty_list(opts) unless has_more
106
+
107
+ last_id = data.last.id
108
+
109
+ params = filters.merge(starting_after: last_id).merge(params)
110
+
111
+ list(params, opts)
112
+ end
113
+
114
+ # Fetches the previous page in the resource list (if there is one).
115
+ #
116
+ # This method will try to respect the limit of the current page. If none
117
+ # was given, the default limit will be fetched again.
118
+ def previous_page(params = {}, opts = {})
119
+ return self.class.empty_list(opts) unless has_more
120
+
121
+ first_id = data.first.id
122
+
123
+ params = filters.merge(ending_before: first_id).merge(params)
124
+
125
+ list(params, opts)
22
126
  end
23
127
 
24
- def create(params={}, opts={})
25
- response, opts = request(:post, url, params, opts)
26
- Util.convert_to_stripe_object(response, opts)
128
+ def resource_url
129
+ url ||
130
+ raise(ArgumentError, "List object does not contain a 'url' field.")
27
131
  end
28
132
 
29
- def all(params={}, opts={})
30
- response, opts = request(:get, url, params, opts)
31
- Util.convert_to_stripe_object(response, opts)
133
+ # Iterates through each resource in the page represented by the current
134
+ # `ListObject` in reverse.
135
+ def reverse_each(&blk)
136
+ data.reverse_each(&blk)
32
137
  end
33
138
  end
34
139
  end
@@ -0,0 +1,131 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "securerandom"
4
+ require "tempfile"
5
+
6
+ module Stripe
7
+ # Encodes parameters into a `multipart/form-data` payload as described by RFC
8
+ # 2388:
9
+ #
10
+ # https://tools.ietf.org/html/rfc2388
11
+ #
12
+ # This is most useful for transferring file-like objects.
13
+ #
14
+ # Parameters should be added with `#encode`. When ready, use `#body` to get
15
+ # the encoded result and `#content_type` to get the value that should be
16
+ # placed in the `Content-Type` header of a subsequent request (which includes
17
+ # a boundary value).
18
+ class MultipartEncoder
19
+ MULTIPART_FORM_DATA = "multipart/form-data"
20
+
21
+ # A shortcut for encoding a single set of parameters and finalizing a
22
+ # result.
23
+ #
24
+ # Returns an encoded body and the value that should be set in the content
25
+ # type header of a subsequent request.
26
+ def self.encode(params)
27
+ encoder = MultipartEncoder.new
28
+ encoder.encode(params)
29
+ encoder.close
30
+ [encoder.body, encoder.content_type]
31
+ end
32
+
33
+ # Gets the object's randomly generated boundary string.
34
+ attr_reader :boundary
35
+
36
+ # Initializes a new multipart encoder.
37
+ def initialize
38
+ # Kind of weird, but required by Rubocop because the unary plus operator
39
+ # is considered faster than `Stripe.new`.
40
+ @body = +""
41
+
42
+ # Chose the same number of random bytes that Go uses in its standard
43
+ # library implementation. Easily enough entropy to ensure that it won't
44
+ # be present in a file we're sending.
45
+ @boundary = SecureRandom.hex(30)
46
+
47
+ @closed = false
48
+ @first_field = true
49
+ end
50
+
51
+ # Gets the encoded body. `#close` must be called first.
52
+ def body
53
+ raise "object must be closed before getting body" unless @closed
54
+
55
+ @body
56
+ end
57
+
58
+ # Finalizes the object by writing the final boundary.
59
+ def close
60
+ raise "object already closed" if @closed
61
+
62
+ @body << "\r\n"
63
+ @body << "--#{@boundary}--"
64
+
65
+ @closed = true
66
+
67
+ nil
68
+ end
69
+
70
+ # Gets the value including boundary that should be put into a multipart
71
+ # request's `Content-Type`.
72
+ def content_type
73
+ "#{MULTIPART_FORM_DATA}; boundary=#{@boundary}"
74
+ end
75
+
76
+ # Encodes a set of parameters to the body.
77
+ #
78
+ # Note that parameters are expected to be a hash, but a "flat" hash such
79
+ # that complex substructures like hashes and arrays have already been
80
+ # appropriately Stripe-encoded. Pass a complex structure through
81
+ # `Util.flatten_params` first before handing it off to this method.
82
+ def encode(params)
83
+ raise "no more parameters can be written to closed object" if @closed
84
+
85
+ params.each do |name, val|
86
+ if val.is_a?(::File) || val.is_a?(::Tempfile)
87
+ write_field(name, val.read, filename: ::File.basename(val.path))
88
+ elsif val.respond_to?(:read)
89
+ write_field(name, val.read, filename: "blob")
90
+ else
91
+ write_field(name, val, filename: nil)
92
+ end
93
+ end
94
+
95
+ nil
96
+ end
97
+
98
+ #
99
+ # private
100
+ #
101
+
102
+ # Escapes double quotes so that the given value can be used in a
103
+ # double-quoted string and replaces any linebreak characters with spaces.
104
+ private def escape(str)
105
+ str.gsub('"', "%22").tr("\n", " ").tr("\r", " ")
106
+ end
107
+
108
+ private def write_field(name, data, filename:)
109
+ if !@first_field
110
+ @body << "\r\n"
111
+ else
112
+ @first_field = false
113
+ end
114
+
115
+ @body << "--#{@boundary}\r\n"
116
+
117
+ if filename
118
+ @body << %(Content-Disposition: form-data) +
119
+ %(; name="#{escape(name.to_s)}") +
120
+ %(; filename="#{escape(filename)}"\r\n)
121
+ @body << %(Content-Type: application/octet-stream\r\n)
122
+ else
123
+ @body << %(Content-Disposition: form-data) +
124
+ %(; name="#{escape(name.to_s)}"\r\n)
125
+ end
126
+
127
+ @body << "\r\n"
128
+ @body << data.to_s
129
+ end
130
+ end
131
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ module OAuth
5
+ module OAuthOperations
6
+ extend APIOperations::Request::ClassMethods
7
+
8
+ def self.execute_resource_request(method, url, params, opts)
9
+ opts = Util.normalize_opts(opts)
10
+ opts[:client] ||= opts[:client] || StripeClient.active_client
11
+ opts[:api_base] ||= opts[:client].config.connect_base
12
+
13
+ super(method, url, params, opts)
14
+ end
15
+ end
16
+
17
+ def self.get_client_id(params = {})
18
+ client_id = params[:client_id] || Stripe.client_id
19
+ unless client_id
20
+ raise AuthenticationError, "No client_id provided. " \
21
+ 'Set your client_id using "Stripe.client_id = <CLIENT-ID>". ' \
22
+ "You can find your client_ids in your Stripe dashboard at " \
23
+ "https://dashboard.stripe.com/account/applications/settings, " \
24
+ "after registering your account as a platform. See " \
25
+ "https://stripe.com/docs/connect/standalone-accounts for details, " \
26
+ "or email support@stripe.com if you have any questions."
27
+ end
28
+ client_id
29
+ end
30
+
31
+ def self.authorize_url(params = {}, opts = {})
32
+ client = opts[:client] || StripeClient.active_client
33
+ base = opts[:connect_base] || client.config.connect_base
34
+
35
+ path = "/oauth/authorize"
36
+ path = "/express" + path if opts[:express]
37
+
38
+ params[:client_id] = get_client_id(params)
39
+ params[:response_type] ||= "code"
40
+ query = Util.encode_parameters(params)
41
+
42
+ "#{base}#{path}?#{query}"
43
+ end
44
+
45
+ def self.token(params = {}, opts = {})
46
+ opts = Util.normalize_opts(opts)
47
+ opts[:api_key] = params[:client_secret] if params[:client_secret]
48
+ resp, opts = OAuthOperations.execute_resource_request(
49
+ :post, "/oauth/token", params, opts
50
+ )
51
+ # This is just going to return a generic StripeObject, but that's okay
52
+ Util.convert_to_stripe_object(resp.data, opts)
53
+ end
54
+
55
+ def self.deauthorize(params = {}, opts = {})
56
+ opts = Util.normalize_opts(opts)
57
+ params[:client_id] = get_client_id(params)
58
+ resp, opts = OAuthOperations.execute_resource_request(
59
+ :post, "/oauth/deauthorize", params, opts
60
+ )
61
+ # This is just going to return a generic StripeObject, but that's okay
62
+ Util.convert_to_stripe_object(resp.data, opts)
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,104 @@
1
+ # frozen_string_literal: true
2
+
3
+ # rubocop:disable Metrics/MethodLength
4
+
5
+ module Stripe
6
+ module ObjectTypes
7
+ def self.object_names_to_classes
8
+ {
9
+ # data structures
10
+ ListObject::OBJECT_NAME => ListObject,
11
+
12
+ # business objects
13
+ Account::OBJECT_NAME => Account,
14
+ AccountLink::OBJECT_NAME => AccountLink,
15
+ AlipayAccount::OBJECT_NAME => AlipayAccount,
16
+ ApplePayDomain::OBJECT_NAME => ApplePayDomain,
17
+ ApplicationFee::OBJECT_NAME => ApplicationFee,
18
+ ApplicationFeeRefund::OBJECT_NAME => ApplicationFeeRefund,
19
+ Balance::OBJECT_NAME => Balance,
20
+ BalanceTransaction::OBJECT_NAME => BalanceTransaction,
21
+ BankAccount::OBJECT_NAME => BankAccount,
22
+ BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
23
+ BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
24
+ BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
25
+ BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
26
+ Capability::OBJECT_NAME => Capability,
27
+ Card::OBJECT_NAME => Card,
28
+ Charge::OBJECT_NAME => Charge,
29
+ Checkout::Session::OBJECT_NAME => Checkout::Session,
30
+ CountrySpec::OBJECT_NAME => CountrySpec,
31
+ Coupon::OBJECT_NAME => Coupon,
32
+ CreditNote::OBJECT_NAME => CreditNote,
33
+ CreditNoteLineItem::OBJECT_NAME => CreditNoteLineItem,
34
+ Customer::OBJECT_NAME => Customer,
35
+ CustomerBalanceTransaction::OBJECT_NAME => CustomerBalanceTransaction,
36
+ Discount::OBJECT_NAME => Discount,
37
+ Dispute::OBJECT_NAME => Dispute,
38
+ EphemeralKey::OBJECT_NAME => EphemeralKey,
39
+ Event::OBJECT_NAME => Event,
40
+ ExchangeRate::OBJECT_NAME => ExchangeRate,
41
+ File::OBJECT_NAME => File,
42
+ File::OBJECT_NAME_ALT => File,
43
+ FileLink::OBJECT_NAME => FileLink,
44
+ Identity::VerificationReport::OBJECT_NAME => Identity::VerificationReport,
45
+ Identity::VerificationSession::OBJECT_NAME => Identity::VerificationSession,
46
+ Invoice::OBJECT_NAME => Invoice,
47
+ InvoiceItem::OBJECT_NAME => InvoiceItem,
48
+ InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
49
+ Issuing::Authorization::OBJECT_NAME => Issuing::Authorization,
50
+ Issuing::Card::OBJECT_NAME => Issuing::Card,
51
+ Issuing::CardDetails::OBJECT_NAME => Issuing::CardDetails,
52
+ Issuing::Cardholder::OBJECT_NAME => Issuing::Cardholder,
53
+ Issuing::Dispute::OBJECT_NAME => Issuing::Dispute,
54
+ Issuing::Transaction::OBJECT_NAME => Issuing::Transaction,
55
+ LineItem::OBJECT_NAME => LineItem,
56
+ LoginLink::OBJECT_NAME => LoginLink,
57
+ Mandate::OBJECT_NAME => Mandate,
58
+ Order::OBJECT_NAME => Order,
59
+ OrderReturn::OBJECT_NAME => OrderReturn,
60
+ PaymentIntent::OBJECT_NAME => PaymentIntent,
61
+ PaymentMethod::OBJECT_NAME => PaymentMethod,
62
+ Payout::OBJECT_NAME => Payout,
63
+ Person::OBJECT_NAME => Person,
64
+ Plan::OBJECT_NAME => Plan,
65
+ Price::OBJECT_NAME => Price,
66
+ Product::OBJECT_NAME => Product,
67
+ PromotionCode::OBJECT_NAME => PromotionCode,
68
+ Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
69
+ Radar::ValueList::OBJECT_NAME => Radar::ValueList,
70
+ Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
71
+ Recipient::OBJECT_NAME => Recipient,
72
+ RecipientTransfer::OBJECT_NAME => RecipientTransfer,
73
+ Refund::OBJECT_NAME => Refund,
74
+ Reporting::ReportRun::OBJECT_NAME => Reporting::ReportRun,
75
+ Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
76
+ Reversal::OBJECT_NAME => Reversal,
77
+ Review::OBJECT_NAME => Review,
78
+ SKU::OBJECT_NAME => SKU,
79
+ SetupAttempt::OBJECT_NAME => SetupAttempt,
80
+ SetupIntent::OBJECT_NAME => SetupIntent,
81
+ Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
82
+ Source::OBJECT_NAME => Source,
83
+ SourceTransaction::OBJECT_NAME => SourceTransaction,
84
+ Subscription::OBJECT_NAME => Subscription,
85
+ SubscriptionItem::OBJECT_NAME => SubscriptionItem,
86
+ SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
87
+ TaxId::OBJECT_NAME => TaxId,
88
+ TaxRate::OBJECT_NAME => TaxRate,
89
+ Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken,
90
+ Terminal::Location::OBJECT_NAME => Terminal::Location,
91
+ Terminal::Reader::OBJECT_NAME => Terminal::Reader,
92
+ ThreeDSecure::OBJECT_NAME => ThreeDSecure,
93
+ Token::OBJECT_NAME => Token,
94
+ Topup::OBJECT_NAME => Topup,
95
+ Transfer::OBJECT_NAME => Transfer,
96
+ UsageRecord::OBJECT_NAME => UsageRecord,
97
+ UsageRecordSummary::OBJECT_NAME => UsageRecordSummary,
98
+ WebhookEndpoint::OBJECT_NAME => WebhookEndpoint,
99
+ }
100
+ end
101
+ end
102
+ end
103
+
104
+ # rubocop:enable Metrics/MethodLength