bongloy 4.21.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +76 -0
- data/.editorconfig +10 -0
- data/.gitattributes +4 -0
- data/.github/ISSUE_TEMPLATE.md +5 -0
- data/.github/README.md +79 -0
- data/.github/pull.yml +5 -0
- data/.gitignore +8 -0
- data/.rubocop.yml +43 -0
- data/.rubocop_todo.yml +38 -0
- data/.travis.yml +43 -0
- data/.vscode/extensions.json +7 -0
- data/.vscode/settings.json +8 -0
- data/CHANGELOG.md +770 -0
- data/CONTRIBUTORS +3 -0
- data/Gemfile +39 -0
- data/History.txt +1 -0
- data/LICENSE +21 -0
- data/README.md +282 -0
- data/Rakefile +36 -0
- data/VERSION +1 -0
- data/bin/stripe-console +16 -0
- data/bongloy.gemspec +37 -0
- data/lib/bongloy.rb +7 -0
- data/lib/data/ca-certificates.crt +4043 -0
- data/lib/stripe.rb +208 -0
- data/lib/stripe/api_operations/create.rb +12 -0
- data/lib/stripe/api_operations/delete.rb +35 -0
- data/lib/stripe/api_operations/list.rb +30 -0
- data/lib/stripe/api_operations/nested_resource.rb +70 -0
- data/lib/stripe/api_operations/request.rb +53 -0
- data/lib/stripe/api_operations/save.rb +94 -0
- data/lib/stripe/api_resource.rb +107 -0
- data/lib/stripe/errors.rb +156 -0
- data/lib/stripe/list_object.rb +110 -0
- data/lib/stripe/oauth.rb +63 -0
- data/lib/stripe/object_types.rb +98 -0
- data/lib/stripe/resources.rb +79 -0
- data/lib/stripe/resources/account.rb +174 -0
- data/lib/stripe/resources/account_link.rb +9 -0
- data/lib/stripe/resources/alipay_account.rb +34 -0
- data/lib/stripe/resources/apple_pay_domain.rb +16 -0
- data/lib/stripe/resources/application_fee.rb +24 -0
- data/lib/stripe/resources/application_fee_refund.rb +30 -0
- data/lib/stripe/resources/balance.rb +7 -0
- data/lib/stripe/resources/balance_transaction.rb +13 -0
- data/lib/stripe/resources/bank_account.rb +42 -0
- data/lib/stripe/resources/bitcoin_receiver.rb +23 -0
- data/lib/stripe/resources/bitcoin_transaction.rb +15 -0
- data/lib/stripe/resources/capability.rb +33 -0
- data/lib/stripe/resources/card.rb +37 -0
- data/lib/stripe/resources/charge.rb +84 -0
- data/lib/stripe/resources/checkout/session.rb +11 -0
- data/lib/stripe/resources/country_spec.rb +9 -0
- data/lib/stripe/resources/coupon.rb +12 -0
- data/lib/stripe/resources/credit_note.rb +18 -0
- data/lib/stripe/resources/customer.rb +95 -0
- data/lib/stripe/resources/customer_balance_transaction.rb +30 -0
- data/lib/stripe/resources/discount.rb +7 -0
- data/lib/stripe/resources/dispute.rb +23 -0
- data/lib/stripe/resources/ephemeral_key.rb +19 -0
- data/lib/stripe/resources/event.rb +9 -0
- data/lib/stripe/resources/exchange_rate.rb +9 -0
- data/lib/stripe/resources/file.rb +44 -0
- data/lib/stripe/resources/file_link.rb +11 -0
- data/lib/stripe/resources/invoice.rb +48 -0
- data/lib/stripe/resources/invoice_item.rb +12 -0
- data/lib/stripe/resources/invoice_line_item.rb +7 -0
- data/lib/stripe/resources/issuer_fraud_record.rb +9 -0
- data/lib/stripe/resources/issuing/authorization.rb +25 -0
- data/lib/stripe/resources/issuing/card.rb +20 -0
- data/lib/stripe/resources/issuing/card_details.rb +9 -0
- data/lib/stripe/resources/issuing/cardholder.rb +13 -0
- data/lib/stripe/resources/issuing/dispute.rb +13 -0
- data/lib/stripe/resources/issuing/transaction.rb +12 -0
- data/lib/stripe/resources/login_link.rb +14 -0
- data/lib/stripe/resources/order.rb +32 -0
- data/lib/stripe/resources/order_return.rb +9 -0
- data/lib/stripe/resources/payment_intent.rb +30 -0
- data/lib/stripe/resources/payment_method.rb +24 -0
- data/lib/stripe/resources/payout.rb +24 -0
- data/lib/stripe/resources/person.rb +31 -0
- data/lib/stripe/resources/plan.rb +12 -0
- data/lib/stripe/resources/product.rb +12 -0
- data/lib/stripe/resources/radar/early_fraud_warning.rb +11 -0
- data/lib/stripe/resources/radar/value_list.rb +14 -0
- data/lib/stripe/resources/radar/value_list_item.rb +13 -0
- data/lib/stripe/resources/recipient.rb +17 -0
- data/lib/stripe/resources/recipient_transfer.rb +7 -0
- data/lib/stripe/resources/refund.rb +11 -0
- data/lib/stripe/resources/reporting/report_run.rb +12 -0
- data/lib/stripe/resources/reporting/report_type.rb +12 -0
- data/lib/stripe/resources/reversal.rb +29 -0
- data/lib/stripe/resources/review.rb +16 -0
- data/lib/stripe/resources/setup_intent.rb +24 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +15 -0
- data/lib/stripe/resources/sku.rb +12 -0
- data/lib/stripe/resources/source.rb +42 -0
- data/lib/stripe/resources/source_transaction.rb +7 -0
- data/lib/stripe/resources/subscription.rb +25 -0
- data/lib/stripe/resources/subscription_item.rb +17 -0
- data/lib/stripe/resources/subscription_schedule.rb +32 -0
- data/lib/stripe/resources/subscription_schedule_revision.rb +34 -0
- data/lib/stripe/resources/tax_id.rb +26 -0
- data/lib/stripe/resources/tax_rate.rb +11 -0
- data/lib/stripe/resources/terminal/connection_token.rb +11 -0
- data/lib/stripe/resources/terminal/location.rb +14 -0
- data/lib/stripe/resources/terminal/reader.rb +14 -0
- data/lib/stripe/resources/three_d_secure.rb +13 -0
- data/lib/stripe/resources/token.rb +9 -0
- data/lib/stripe/resources/topup.rb +18 -0
- data/lib/stripe/resources/transfer.rb +27 -0
- data/lib/stripe/resources/usage_record.rb +23 -0
- data/lib/stripe/resources/usage_record_summary.rb +7 -0
- data/lib/stripe/resources/webhook_endpoint.rb +12 -0
- data/lib/stripe/singleton_api_resource.rb +26 -0
- data/lib/stripe/stripe_client.rb +686 -0
- data/lib/stripe/stripe_object.rb +583 -0
- data/lib/stripe/stripe_response.rb +50 -0
- data/lib/stripe/util.rb +336 -0
- data/lib/stripe/version.rb +5 -0
- data/lib/stripe/webhook.rb +90 -0
- data/stripe.gemspec +37 -0
- data/test/api_stub_helpers.rb +1 -0
- data/test/openapi/README.md +9 -0
- data/test/stripe/account_link_test.rb +18 -0
- data/test/stripe/account_test.rb +428 -0
- data/test/stripe/alipay_account_test.rb +37 -0
- data/test/stripe/api_operations_test.rb +80 -0
- data/test/stripe/api_resource_test.rb +544 -0
- data/test/stripe/apple_pay_domain_test.rb +46 -0
- data/test/stripe/application_fee_refund_test.rb +37 -0
- data/test/stripe/application_fee_test.rb +58 -0
- data/test/stripe/balance_test.rb +13 -0
- data/test/stripe/bank_account_test.rb +36 -0
- data/test/stripe/capability_test.rb +45 -0
- data/test/stripe/charge_test.rb +80 -0
- data/test/stripe/checkout/session_test.rb +41 -0
- data/test/stripe/country_spec_test.rb +20 -0
- data/test/stripe/coupon_test.rb +61 -0
- data/test/stripe/credit_note_test.rb +61 -0
- data/test/stripe/customer_balance_transaction_test.rb +37 -0
- data/test/stripe/customer_card_test.rb +42 -0
- data/test/stripe/customer_test.rb +269 -0
- data/test/stripe/dispute_test.rb +51 -0
- data/test/stripe/ephemeral_key_test.rb +93 -0
- data/test/stripe/errors_test.rb +20 -0
- data/test/stripe/exchange_rate_test.rb +20 -0
- data/test/stripe/file_link_test.rb +41 -0
- data/test/stripe/file_test.rb +97 -0
- data/test/stripe/file_upload_test.rb +79 -0
- data/test/stripe/invoice_item_test.rb +66 -0
- data/test/stripe/invoice_line_item_test.rb +8 -0
- data/test/stripe/invoice_test.rb +213 -0
- data/test/stripe/issuer_fraud_record_test.rb +20 -0
- data/test/stripe/issuing/authorization_test.rb +72 -0
- data/test/stripe/issuing/card_test.rb +62 -0
- data/test/stripe/issuing/cardholder_test.rb +53 -0
- data/test/stripe/issuing/dispute_test.rb +45 -0
- data/test/stripe/issuing/transaction_test.rb +48 -0
- data/test/stripe/list_object_test.rb +156 -0
- data/test/stripe/login_link_test.rb +37 -0
- data/test/stripe/oauth_test.rb +88 -0
- data/test/stripe/order_return_test.rb +21 -0
- data/test/stripe/order_test.rb +82 -0
- data/test/stripe/payment_intent_test.rb +107 -0
- data/test/stripe/payment_method_test.rb +84 -0
- data/test/stripe/payout_test.rb +57 -0
- data/test/stripe/person_test.rb +46 -0
- data/test/stripe/plan_test.rb +98 -0
- data/test/stripe/product_test.rb +59 -0
- data/test/stripe/radar/early_fraud_warning_test.rb +22 -0
- data/test/stripe/radar/value_list_item_test.rb +48 -0
- data/test/stripe/radar/value_list_test.rb +61 -0
- data/test/stripe/recipient_test.rb +62 -0
- data/test/stripe/refund_test.rb +39 -0
- data/test/stripe/reporting/report_run_test.rb +33 -0
- data/test/stripe/reporting/report_type_test.rb +22 -0
- data/test/stripe/reversal_test.rb +43 -0
- data/test/stripe/review_test.rb +27 -0
- data/test/stripe/setup_intent_test.rb +84 -0
- data/test/stripe/sigma/scheduled_query_run_test.rb +22 -0
- data/test/stripe/sku_test.rb +60 -0
- data/test/stripe/source_test.rb +99 -0
- data/test/stripe/source_transaction_test.rb +19 -0
- data/test/stripe/stripe_client_test.rb +842 -0
- data/test/stripe/stripe_object_test.rb +525 -0
- data/test/stripe/stripe_response_test.rb +49 -0
- data/test/stripe/subscription_item_test.rb +63 -0
- data/test/stripe/subscription_schedule_revision_test.rb +37 -0
- data/test/stripe/subscription_schedule_test.rb +116 -0
- data/test/stripe/subscription_test.rb +80 -0
- data/test/stripe/tax_id_test.rb +31 -0
- data/test/stripe/tax_rate_test.rb +43 -0
- data/test/stripe/terminal/connection_token_test.rb +16 -0
- data/test/stripe/terminal/location_test.rb +68 -0
- data/test/stripe/terminal/reader_test.rb +62 -0
- data/test/stripe/three_d_secure_test.rb +23 -0
- data/test/stripe/topup_test.rb +62 -0
- data/test/stripe/transfer_test.rb +88 -0
- data/test/stripe/usage_record_summary_test.rb +19 -0
- data/test/stripe/usage_record_test.rb +28 -0
- data/test/stripe/util_test.rb +402 -0
- data/test/stripe/webhook_endpoint_test.rb +59 -0
- data/test/stripe/webhook_test.rb +96 -0
- data/test/stripe_mock.rb +77 -0
- data/test/stripe_test.rb +63 -0
- data/test/test_data.rb +61 -0
- data/test/test_helper.rb +71 -0
- metadata +372 -0
data/CONTRIBUTORS
ADDED
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
|
data/History.txt
ADDED
@@ -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.
|
data/README.md
ADDED
@@ -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
|
+
-->
|
data/Rakefile
ADDED
@@ -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
|
data/bin/stripe-console
ADDED
@@ -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
|
data/bongloy.gemspec
ADDED
@@ -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
|