bongloy 4.21.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (210) hide show
  1. checksums.yaml +7 -0
  2. data/.circleci/config.yml +76 -0
  3. data/.editorconfig +10 -0
  4. data/.gitattributes +4 -0
  5. data/.github/ISSUE_TEMPLATE.md +5 -0
  6. data/.github/README.md +79 -0
  7. data/.github/pull.yml +5 -0
  8. data/.gitignore +8 -0
  9. data/.rubocop.yml +43 -0
  10. data/.rubocop_todo.yml +38 -0
  11. data/.travis.yml +43 -0
  12. data/.vscode/extensions.json +7 -0
  13. data/.vscode/settings.json +8 -0
  14. data/CHANGELOG.md +770 -0
  15. data/CONTRIBUTORS +3 -0
  16. data/Gemfile +39 -0
  17. data/History.txt +1 -0
  18. data/LICENSE +21 -0
  19. data/README.md +282 -0
  20. data/Rakefile +36 -0
  21. data/VERSION +1 -0
  22. data/bin/stripe-console +16 -0
  23. data/bongloy.gemspec +37 -0
  24. data/lib/bongloy.rb +7 -0
  25. data/lib/data/ca-certificates.crt +4043 -0
  26. data/lib/stripe.rb +208 -0
  27. data/lib/stripe/api_operations/create.rb +12 -0
  28. data/lib/stripe/api_operations/delete.rb +35 -0
  29. data/lib/stripe/api_operations/list.rb +30 -0
  30. data/lib/stripe/api_operations/nested_resource.rb +70 -0
  31. data/lib/stripe/api_operations/request.rb +53 -0
  32. data/lib/stripe/api_operations/save.rb +94 -0
  33. data/lib/stripe/api_resource.rb +107 -0
  34. data/lib/stripe/errors.rb +156 -0
  35. data/lib/stripe/list_object.rb +110 -0
  36. data/lib/stripe/oauth.rb +63 -0
  37. data/lib/stripe/object_types.rb +98 -0
  38. data/lib/stripe/resources.rb +79 -0
  39. data/lib/stripe/resources/account.rb +174 -0
  40. data/lib/stripe/resources/account_link.rb +9 -0
  41. data/lib/stripe/resources/alipay_account.rb +34 -0
  42. data/lib/stripe/resources/apple_pay_domain.rb +16 -0
  43. data/lib/stripe/resources/application_fee.rb +24 -0
  44. data/lib/stripe/resources/application_fee_refund.rb +30 -0
  45. data/lib/stripe/resources/balance.rb +7 -0
  46. data/lib/stripe/resources/balance_transaction.rb +13 -0
  47. data/lib/stripe/resources/bank_account.rb +42 -0
  48. data/lib/stripe/resources/bitcoin_receiver.rb +23 -0
  49. data/lib/stripe/resources/bitcoin_transaction.rb +15 -0
  50. data/lib/stripe/resources/capability.rb +33 -0
  51. data/lib/stripe/resources/card.rb +37 -0
  52. data/lib/stripe/resources/charge.rb +84 -0
  53. data/lib/stripe/resources/checkout/session.rb +11 -0
  54. data/lib/stripe/resources/country_spec.rb +9 -0
  55. data/lib/stripe/resources/coupon.rb +12 -0
  56. data/lib/stripe/resources/credit_note.rb +18 -0
  57. data/lib/stripe/resources/customer.rb +95 -0
  58. data/lib/stripe/resources/customer_balance_transaction.rb +30 -0
  59. data/lib/stripe/resources/discount.rb +7 -0
  60. data/lib/stripe/resources/dispute.rb +23 -0
  61. data/lib/stripe/resources/ephemeral_key.rb +19 -0
  62. data/lib/stripe/resources/event.rb +9 -0
  63. data/lib/stripe/resources/exchange_rate.rb +9 -0
  64. data/lib/stripe/resources/file.rb +44 -0
  65. data/lib/stripe/resources/file_link.rb +11 -0
  66. data/lib/stripe/resources/invoice.rb +48 -0
  67. data/lib/stripe/resources/invoice_item.rb +12 -0
  68. data/lib/stripe/resources/invoice_line_item.rb +7 -0
  69. data/lib/stripe/resources/issuer_fraud_record.rb +9 -0
  70. data/lib/stripe/resources/issuing/authorization.rb +25 -0
  71. data/lib/stripe/resources/issuing/card.rb +20 -0
  72. data/lib/stripe/resources/issuing/card_details.rb +9 -0
  73. data/lib/stripe/resources/issuing/cardholder.rb +13 -0
  74. data/lib/stripe/resources/issuing/dispute.rb +13 -0
  75. data/lib/stripe/resources/issuing/transaction.rb +12 -0
  76. data/lib/stripe/resources/login_link.rb +14 -0
  77. data/lib/stripe/resources/order.rb +32 -0
  78. data/lib/stripe/resources/order_return.rb +9 -0
  79. data/lib/stripe/resources/payment_intent.rb +30 -0
  80. data/lib/stripe/resources/payment_method.rb +24 -0
  81. data/lib/stripe/resources/payout.rb +24 -0
  82. data/lib/stripe/resources/person.rb +31 -0
  83. data/lib/stripe/resources/plan.rb +12 -0
  84. data/lib/stripe/resources/product.rb +12 -0
  85. data/lib/stripe/resources/radar/early_fraud_warning.rb +11 -0
  86. data/lib/stripe/resources/radar/value_list.rb +14 -0
  87. data/lib/stripe/resources/radar/value_list_item.rb +13 -0
  88. data/lib/stripe/resources/recipient.rb +17 -0
  89. data/lib/stripe/resources/recipient_transfer.rb +7 -0
  90. data/lib/stripe/resources/refund.rb +11 -0
  91. data/lib/stripe/resources/reporting/report_run.rb +12 -0
  92. data/lib/stripe/resources/reporting/report_type.rb +12 -0
  93. data/lib/stripe/resources/reversal.rb +29 -0
  94. data/lib/stripe/resources/review.rb +16 -0
  95. data/lib/stripe/resources/setup_intent.rb +24 -0
  96. data/lib/stripe/resources/sigma/scheduled_query_run.rb +15 -0
  97. data/lib/stripe/resources/sku.rb +12 -0
  98. data/lib/stripe/resources/source.rb +42 -0
  99. data/lib/stripe/resources/source_transaction.rb +7 -0
  100. data/lib/stripe/resources/subscription.rb +25 -0
  101. data/lib/stripe/resources/subscription_item.rb +17 -0
  102. data/lib/stripe/resources/subscription_schedule.rb +32 -0
  103. data/lib/stripe/resources/subscription_schedule_revision.rb +34 -0
  104. data/lib/stripe/resources/tax_id.rb +26 -0
  105. data/lib/stripe/resources/tax_rate.rb +11 -0
  106. data/lib/stripe/resources/terminal/connection_token.rb +11 -0
  107. data/lib/stripe/resources/terminal/location.rb +14 -0
  108. data/lib/stripe/resources/terminal/reader.rb +14 -0
  109. data/lib/stripe/resources/three_d_secure.rb +13 -0
  110. data/lib/stripe/resources/token.rb +9 -0
  111. data/lib/stripe/resources/topup.rb +18 -0
  112. data/lib/stripe/resources/transfer.rb +27 -0
  113. data/lib/stripe/resources/usage_record.rb +23 -0
  114. data/lib/stripe/resources/usage_record_summary.rb +7 -0
  115. data/lib/stripe/resources/webhook_endpoint.rb +12 -0
  116. data/lib/stripe/singleton_api_resource.rb +26 -0
  117. data/lib/stripe/stripe_client.rb +686 -0
  118. data/lib/stripe/stripe_object.rb +583 -0
  119. data/lib/stripe/stripe_response.rb +50 -0
  120. data/lib/stripe/util.rb +336 -0
  121. data/lib/stripe/version.rb +5 -0
  122. data/lib/stripe/webhook.rb +90 -0
  123. data/stripe.gemspec +37 -0
  124. data/test/api_stub_helpers.rb +1 -0
  125. data/test/openapi/README.md +9 -0
  126. data/test/stripe/account_link_test.rb +18 -0
  127. data/test/stripe/account_test.rb +428 -0
  128. data/test/stripe/alipay_account_test.rb +37 -0
  129. data/test/stripe/api_operations_test.rb +80 -0
  130. data/test/stripe/api_resource_test.rb +544 -0
  131. data/test/stripe/apple_pay_domain_test.rb +46 -0
  132. data/test/stripe/application_fee_refund_test.rb +37 -0
  133. data/test/stripe/application_fee_test.rb +58 -0
  134. data/test/stripe/balance_test.rb +13 -0
  135. data/test/stripe/bank_account_test.rb +36 -0
  136. data/test/stripe/capability_test.rb +45 -0
  137. data/test/stripe/charge_test.rb +80 -0
  138. data/test/stripe/checkout/session_test.rb +41 -0
  139. data/test/stripe/country_spec_test.rb +20 -0
  140. data/test/stripe/coupon_test.rb +61 -0
  141. data/test/stripe/credit_note_test.rb +61 -0
  142. data/test/stripe/customer_balance_transaction_test.rb +37 -0
  143. data/test/stripe/customer_card_test.rb +42 -0
  144. data/test/stripe/customer_test.rb +269 -0
  145. data/test/stripe/dispute_test.rb +51 -0
  146. data/test/stripe/ephemeral_key_test.rb +93 -0
  147. data/test/stripe/errors_test.rb +20 -0
  148. data/test/stripe/exchange_rate_test.rb +20 -0
  149. data/test/stripe/file_link_test.rb +41 -0
  150. data/test/stripe/file_test.rb +97 -0
  151. data/test/stripe/file_upload_test.rb +79 -0
  152. data/test/stripe/invoice_item_test.rb +66 -0
  153. data/test/stripe/invoice_line_item_test.rb +8 -0
  154. data/test/stripe/invoice_test.rb +213 -0
  155. data/test/stripe/issuer_fraud_record_test.rb +20 -0
  156. data/test/stripe/issuing/authorization_test.rb +72 -0
  157. data/test/stripe/issuing/card_test.rb +62 -0
  158. data/test/stripe/issuing/cardholder_test.rb +53 -0
  159. data/test/stripe/issuing/dispute_test.rb +45 -0
  160. data/test/stripe/issuing/transaction_test.rb +48 -0
  161. data/test/stripe/list_object_test.rb +156 -0
  162. data/test/stripe/login_link_test.rb +37 -0
  163. data/test/stripe/oauth_test.rb +88 -0
  164. data/test/stripe/order_return_test.rb +21 -0
  165. data/test/stripe/order_test.rb +82 -0
  166. data/test/stripe/payment_intent_test.rb +107 -0
  167. data/test/stripe/payment_method_test.rb +84 -0
  168. data/test/stripe/payout_test.rb +57 -0
  169. data/test/stripe/person_test.rb +46 -0
  170. data/test/stripe/plan_test.rb +98 -0
  171. data/test/stripe/product_test.rb +59 -0
  172. data/test/stripe/radar/early_fraud_warning_test.rb +22 -0
  173. data/test/stripe/radar/value_list_item_test.rb +48 -0
  174. data/test/stripe/radar/value_list_test.rb +61 -0
  175. data/test/stripe/recipient_test.rb +62 -0
  176. data/test/stripe/refund_test.rb +39 -0
  177. data/test/stripe/reporting/report_run_test.rb +33 -0
  178. data/test/stripe/reporting/report_type_test.rb +22 -0
  179. data/test/stripe/reversal_test.rb +43 -0
  180. data/test/stripe/review_test.rb +27 -0
  181. data/test/stripe/setup_intent_test.rb +84 -0
  182. data/test/stripe/sigma/scheduled_query_run_test.rb +22 -0
  183. data/test/stripe/sku_test.rb +60 -0
  184. data/test/stripe/source_test.rb +99 -0
  185. data/test/stripe/source_transaction_test.rb +19 -0
  186. data/test/stripe/stripe_client_test.rb +842 -0
  187. data/test/stripe/stripe_object_test.rb +525 -0
  188. data/test/stripe/stripe_response_test.rb +49 -0
  189. data/test/stripe/subscription_item_test.rb +63 -0
  190. data/test/stripe/subscription_schedule_revision_test.rb +37 -0
  191. data/test/stripe/subscription_schedule_test.rb +116 -0
  192. data/test/stripe/subscription_test.rb +80 -0
  193. data/test/stripe/tax_id_test.rb +31 -0
  194. data/test/stripe/tax_rate_test.rb +43 -0
  195. data/test/stripe/terminal/connection_token_test.rb +16 -0
  196. data/test/stripe/terminal/location_test.rb +68 -0
  197. data/test/stripe/terminal/reader_test.rb +62 -0
  198. data/test/stripe/three_d_secure_test.rb +23 -0
  199. data/test/stripe/topup_test.rb +62 -0
  200. data/test/stripe/transfer_test.rb +88 -0
  201. data/test/stripe/usage_record_summary_test.rb +19 -0
  202. data/test/stripe/usage_record_test.rb +28 -0
  203. data/test/stripe/util_test.rb +402 -0
  204. data/test/stripe/webhook_endpoint_test.rb +59 -0
  205. data/test/stripe/webhook_test.rb +96 -0
  206. data/test/stripe_mock.rb +77 -0
  207. data/test/stripe_test.rb +63 -0
  208. data/test/test_data.rb +61 -0
  209. data/test/test_helper.rb +71 -0
  210. metadata +372 -0
@@ -0,0 +1,3 @@
1
+ Greg Brockman <gdb@gregbrockman.com>
2
+ Ross Boucher <rboucher@gmail.com>
3
+ Bradley Grzesiak <brad@bendyworks.com>
data/Gemfile ADDED
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gemspec name: "bongloy"
6
+
7
+ group :development do
8
+ gem "coveralls", require: false
9
+ gem "mocha", "~> 0.13.2"
10
+ gem "rake"
11
+ gem "shoulda-context"
12
+ gem "test-unit"
13
+ gem "timecop"
14
+ gem "webmock"
15
+
16
+ # Rubocop changes pretty quickly: new cops get added and old cops change
17
+ # names or go into new namespaces. This is a library and we don't have
18
+ # `Gemfile.lock` checked in, so to prevent good builds from suddenly going
19
+ # bad, pin to a specific version number here. Try to keep this relatively
20
+ # up-to-date, but it's not the end of the world if it's not.
21
+ # Note that 0.57.2 is the most recent version we can use until we drop
22
+ # support for Ruby 2.1.
23
+ gem "rubocop", "0.57.2"
24
+
25
+ # Rack 2.0+ requires Ruby >= 2.2.2 which is problematic for the test suite on
26
+ # older Ruby versions. Check Ruby the version here and put a maximum
27
+ # constraint on Rack if necessary.
28
+ if RUBY_VERSION >= "2.2.2"
29
+ gem "rack", ">= 2.0.6"
30
+ else
31
+ gem "rack", ">= 1.6.11", "< 2.0" # rubocop:disable Bundler/DuplicatedGem
32
+ end
33
+
34
+ platforms :mri do
35
+ gem "byebug"
36
+ gem "pry"
37
+ gem "pry-byebug"
38
+ end
39
+ end
@@ -0,0 +1 @@
1
+ History.txt has been converted to a formal changelog. Please see CHANGELOG.md.
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2011- Stripe, Inc. (https://stripe.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,282 @@
1
+ # Stripe Ruby Library
2
+
3
+ [![Build Status](https://travis-ci.org/stripe/stripe-ruby.svg?branch=master)](https://travis-ci.org/stripe/stripe-ruby)
4
+ [![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-ruby/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-ruby?branch=master)
5
+
6
+ The Stripe Ruby library provides convenient access to the Stripe API from
7
+ applications written in the Ruby language. It includes a pre-defined set of
8
+ classes for API resources that initialize themselves dynamically from API
9
+ responses which makes it compatible with a wide range of versions of the Stripe
10
+ API.
11
+
12
+ The library also provides other features. For example:
13
+
14
+ - Easy configuration path for fast setup and use.
15
+ - Helpers for pagination.
16
+ - Tracking of "fresh" values in API resources so that partial updates can be
17
+ executed.
18
+ - Built-in mechanisms for the serialization of parameters according to the
19
+ expectations of Stripe's API.
20
+
21
+ ## Documentation
22
+
23
+ See the [Ruby API docs](https://stripe.com/docs/api/ruby#intro).
24
+
25
+ ## Installation
26
+
27
+ You don't need this source code unless you want to modify the gem. If you just
28
+ want to use the package, just run:
29
+
30
+ ```sh
31
+ gem install stripe
32
+ ```
33
+
34
+ If you want to build the gem from source:
35
+
36
+ ```sh
37
+ gem build stripe.gemspec
38
+ ```
39
+
40
+ ### Requirements
41
+
42
+ - Ruby 2.1+.
43
+
44
+ ### Bundler
45
+
46
+ If you are installing via bundler, you should be sure to use the https rubygems
47
+ source in your Gemfile, as any gems fetched over http could potentially be
48
+ compromised in transit and alter the code of gems fetched securely over https:
49
+
50
+ ```ruby
51
+ source 'https://rubygems.org'
52
+
53
+ gem 'rails'
54
+ gem 'stripe'
55
+ ```
56
+
57
+ ## Usage
58
+
59
+ The library needs to be configured with your account's secret key which is
60
+ available in your [Stripe Dashboard][api-keys]. Set `Stripe.api_key` to its
61
+ value:
62
+
63
+ ```ruby
64
+ require "stripe"
65
+ Stripe.api_key = "sk_test_..."
66
+
67
+ # list charges
68
+ Stripe::Charge.list()
69
+
70
+ # retrieve single charge
71
+ Stripe::Charge.retrieve(
72
+ "ch_18atAXCdGbJFKhCuBAa4532Z",
73
+ )
74
+ ```
75
+
76
+ ### Per-request Configuration
77
+
78
+ For apps that need to use multiple keys during the lifetime of a process, like
79
+ one that uses [Stripe Connect][connect], it's also possible to set a
80
+ per-request key and/or account:
81
+
82
+ ```ruby
83
+ require "stripe"
84
+
85
+ Stripe::Charge.list(
86
+ {},
87
+ {
88
+ api_key: "sk_test_...",
89
+ stripe_account: "acct_...",
90
+ stripe_version: "2018-02-28",
91
+ }
92
+ )
93
+
94
+ Stripe::Charge.retrieve(
95
+ "ch_18atAXCdGbJFKhCuBAa4532Z",
96
+ {
97
+ api_key: "sk_test_...",
98
+ stripe_account: "acct_...",
99
+ stripe_version: "2018-02-28",
100
+ }
101
+ )
102
+
103
+ Stripe::Charge.retrieve(
104
+ {
105
+ id: "ch_18atAXCdGbJFKhCuBAa4532Z",
106
+ expand: %w(balance_transaction)
107
+ },
108
+ {
109
+ stripe_version: "2018-02-28",
110
+ api_key: "sk_test_...",
111
+ }
112
+ )
113
+ ```
114
+
115
+ ### Configuring a Client
116
+
117
+ While a default HTTP client is used by default, it's also possible to have the
118
+ library use any client supported by [Faraday][faraday] by initializing a
119
+ `Stripe::StripeClient` object and giving it a connection:
120
+
121
+ ```ruby
122
+ conn = Faraday.new
123
+ client = Stripe::StripeClient.new(conn)
124
+ charge, resp = client.request do
125
+ Stripe::Charge.retrieve(
126
+ "ch_18atAXCdGbJFKhCuBAa4532Z",
127
+ )
128
+ end
129
+ puts resp.request_id
130
+ ```
131
+
132
+ ### Configuring a proxy
133
+
134
+ A proxy can be configured with `Stripe.proxy`:
135
+
136
+ ```ruby
137
+ Stripe.proxy = "https://user:pass@example.com:1234"
138
+ ```
139
+
140
+ ### Configuring an API Version
141
+
142
+ By default, the library will use the API version pinned to the account making
143
+ a request. This can be overridden with this global option:
144
+
145
+ ```ruby
146
+ Stripe.api_version = "2018-02-28"
147
+ ```
148
+
149
+ See [versioning in the API reference][versioning] for more information.
150
+
151
+ ### Configuring CA Bundles
152
+
153
+ By default, the library will use its own internal bundle of known CA
154
+ certificates, but it's possible to configure your own:
155
+
156
+ ```ruby
157
+ Stripe.ca_bundle_path = "path/to/ca/bundle"
158
+ ```
159
+
160
+ ### Configuring Automatic Retries
161
+
162
+ The library can be configured to automatically retry requests that fail due to
163
+ an intermittent network problem:
164
+
165
+ ```ruby
166
+ Stripe.max_network_retries = 2
167
+ ```
168
+
169
+ [Idempotency keys][idempotency-keys] are added to requests to guarantee that
170
+ retries are safe.
171
+
172
+ ### Configuring Timeouts
173
+
174
+ Open and read timeouts are configurable:
175
+
176
+ ```ruby
177
+ Stripe.open_timeout = 30 // in seconds
178
+ Stripe.read_timeout = 80
179
+ ```
180
+
181
+ Please take care to set conservative read timeouts. Some API requests can take
182
+ some time, and a short timeout increases the likelihood of a problem within our
183
+ servers.
184
+
185
+ ### Logging
186
+
187
+ The library can be configured to emit logging that will give you better insight
188
+ into what it's doing. The `info` logging level is usually most appropriate for
189
+ production use, but `debug` is also available for more verbosity.
190
+
191
+ There are a few options for enabling it:
192
+
193
+ 1. Set the environment variable `STRIPE_LOG` to the value `debug` or `info`:
194
+
195
+ ```sh
196
+ $ export STRIPE_LOG=info
197
+ ```
198
+
199
+ 2. Set `Stripe.log_level`:
200
+
201
+ ```ruby
202
+ Stripe.log_level = Stripe::LEVEL_INFO
203
+ ```
204
+
205
+ ### Writing a Plugin
206
+
207
+ If you're writing a plugin that uses the library, we'd appreciate it if you
208
+ identified using `#set_app_info`:
209
+
210
+ ```ruby
211
+ Stripe.set_app_info("MyAwesomePlugin", version: "1.2.34", url: "https://myawesomeplugin.info");
212
+ ```
213
+
214
+ This information is passed along when the library makes calls to the Stripe
215
+ API.
216
+
217
+ ### Request latency telemetry
218
+
219
+ By default, the library sends request latency telemetry to Stripe. These
220
+ numbers help Stripe improve the overall latency of its API for all users.
221
+
222
+ You can disable this behavior if you prefer:
223
+
224
+ ```ruby
225
+ Stripe.enable_telemetry = false
226
+ ```
227
+
228
+ ## Development
229
+
230
+ The test suite depends on [stripe-mock], so make sure to fetch and run it from a
231
+ background terminal ([stripe-mock's README][stripe-mock] also contains
232
+ instructions for installing via Homebrew and other methods):
233
+
234
+ ```sh
235
+ go get -u github.com/stripe/stripe-mock
236
+ stripe-mock
237
+ ```
238
+
239
+ Run all tests:
240
+
241
+ ```sh
242
+ bundle exec rake test
243
+ ```
244
+
245
+ Run a single test suite:
246
+
247
+ ```sh
248
+ bundle exec ruby -Ilib/ test/stripe/util_test.rb
249
+ ```
250
+
251
+ Run a single test:
252
+
253
+ ```sh
254
+ bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.symbols/
255
+ ```
256
+
257
+ Run the linter:
258
+
259
+ ```sh
260
+ bundle exec rake rubocop
261
+ ```
262
+
263
+ Update bundled CA certificates from the [Mozilla cURL release][curl]:
264
+
265
+ ```sh
266
+ bundle exec rake update_certs
267
+ ```
268
+
269
+ Update the bundled [stripe-mock] by editing the version number found in
270
+ `.travis.yml`.
271
+
272
+ [api-keys]: https://dashboard.stripe.com/account/apikeys
273
+ [connect]: https://stripe.com/connect
274
+ [curl]: http://curl.haxx.se/docs/caextract.html
275
+ [faraday]: https://github.com/lostisland/faraday
276
+ [idempotency-keys]: https://stripe.com/docs/api/ruby#idempotent_requests
277
+ [stripe-mock]: https://github.com/stripe/stripe-mock
278
+ [versioning]: https://stripe.com/docs/api/ruby#versioning
279
+
280
+ <!--
281
+ # vim: set tw=79:
282
+ -->
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rake/testtask"
4
+ require "rubocop/rake_task"
5
+
6
+ task default: %i[test rubocop]
7
+
8
+ Rake::TestTask.new do |t|
9
+ t.pattern = "./test/**/*_test.rb"
10
+ end
11
+
12
+ RuboCop::RakeTask.new
13
+
14
+ desc "Update bundled certs"
15
+ task :update_certs do
16
+ require "faraday"
17
+
18
+ fetch_file "https://curl.haxx.se/ca/cacert.pem",
19
+ ::File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
20
+ end
21
+
22
+ #
23
+ # helpers
24
+ #
25
+
26
+ def fetch_file(url, dest)
27
+ ::File.open(dest, "w") do |file|
28
+ resp = Faraday.get(url)
29
+ unless resp.status == 200
30
+ abort("bad response when fetching: #{url}\n" \
31
+ "Status #{resp.status}: #{resp.body}")
32
+ end
33
+ file.write(resp.body)
34
+ puts "Successfully fetched: #{url}"
35
+ end
36
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 4.21.3
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # frozen_string_literal: true
4
+
5
+ require "irb"
6
+ require "irb/completion"
7
+
8
+ require "#{::File.dirname(__FILE__)}/../lib/stripe"
9
+
10
+ # Config IRB to enable --simple-prompt and auto indent
11
+ IRB.conf[:PROMPT_MODE] = :SIMPLE
12
+ IRB.conf[:AUTO_INDENT] = true
13
+
14
+ puts "Loaded gem 'stripe'"
15
+
16
+ IRB.start
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.unshift(::File.join(::File.dirname(__FILE__), "lib"))
4
+
5
+ require "stripe/version"
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "bongloy"
9
+ s.version = Stripe::VERSION
10
+ s.required_ruby_version = ">= 2.1.0"
11
+ s.summary = "Ruby bindings for the Bongloy API"
12
+ s.description = "Bongloy is the easiest way to accept payments online. " \
13
+ "See https://www.bongloy.com for details."
14
+ s.author = "Bongloy"
15
+ s.email = "support@bongloy.com"
16
+ s.homepage = "https://www.bongloy.com/documentation"
17
+ s.license = "MIT"
18
+
19
+ s.metadata = {
20
+ "bug_tracker_uri" => "https://github.com/bongloy/bongloy-ruby/issues",
21
+ "changelog_uri" =>
22
+ "https://github.com/bongloy/bongloy-ruby/blob/master/CHANGELOG.md",
23
+ "documentation_uri" => "https://www.bongloy.com/documentation",
24
+ "github_repo" => "ssh://github.com/bongloy/bongloy-ruby",
25
+ "homepage_uri" => "https://www.bongloy.com/documentation",
26
+ "source_code_uri" => "https://github.com/bongloy/bongloy-ruby",
27
+ }
28
+
29
+ s.add_dependency("faraday", "~> 0.13")
30
+ s.add_dependency("net-http-persistent", "~> 3.0")
31
+
32
+ s.files = `git ls-files`.split("\n")
33
+ s.test_files = `git ls-files -- test/*`.split("\n")
34
+ s.executables = `git ls-files -- bin/*`.split("\n")
35
+ .map { |f| ::File.basename(f) }
36
+ s.require_paths = ["lib"]
37
+ end