stripe 3.25.0 → 3.26.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/CHANGELOG.md +3 -0
- data/VERSION +1 -1
- data/lib/stripe.rb +2 -0
- data/lib/stripe/reporting/report_run.rb +12 -0
- data/lib/stripe/reporting/report_type.rb +12 -0
- data/lib/stripe/stripe_object.rb +1 -4
- data/lib/stripe/util.rb +4 -25
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/api_resource_test.rb +3 -3
- data/test/stripe/reporting/report_run_test.rb +33 -0
- data/test/stripe/reporting/report_type_test.rb +22 -0
- data/test/test_helper.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8e4c5dabe1fd48d0cfeddea151a30bee86c8547
|
4
|
+
data.tar.gz: 726a6104b5ecdf200bd80c0b453257304be359c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f9c83449bc4558dbd2a89b6a41cfa4e4ab35b985c073eb278039114bca94b0c21fe1167a55c68098a40f0cd87f37a742d7ca181aaf2d940efed372b20e55b9a
|
7
|
+
data.tar.gz: 935f38cfdbfd7edfbd84f72ece0b89db1cd8a3198ee0a6cafb52d7d9058f4e64374e25e2454795afbcbc63415bea8ae465ed03ffbc99d5a95143126aade66a15
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 3.26.0 - 2018-09-05
|
4
|
+
* [#681](https://github.com/stripe/stripe-ruby/pull/681) Add support for reporting resources
|
5
|
+
|
3
6
|
## 3.25.0 - 2018-08-28
|
4
7
|
* [#678](https://github.com/stripe/stripe-ruby/pull/678) Allow payment intent `#cancel`, `#capture`, and `#confirm` to take their own parameters
|
5
8
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.26.0
|
data/lib/stripe.rb
CHANGED
@@ -77,6 +77,8 @@ require "stripe/product"
|
|
77
77
|
require "stripe/recipient"
|
78
78
|
require "stripe/recipient_transfer"
|
79
79
|
require "stripe/refund"
|
80
|
+
require "stripe/reporting/report_run"
|
81
|
+
require "stripe/reporting/report_type"
|
80
82
|
require "stripe/reversal"
|
81
83
|
require "stripe/sigma/scheduled_query_run"
|
82
84
|
require "stripe/sku"
|
data/lib/stripe/stripe_object.rb
CHANGED
@@ -141,10 +141,7 @@ module Stripe
|
|
141
141
|
# * +:dirty+ - Whether values should be initiated as "dirty" (unsaved) and
|
142
142
|
# which applies only to new StripeObjects being initiated under this
|
143
143
|
# StripeObject. Defaults to true.
|
144
|
-
def update_attributes(values, opts = {},
|
145
|
-
# Default to true. TODO: Convert to optional arguments after we're off
|
146
|
-
# 1.9 which will make this quite a bit more clear.
|
147
|
-
dirty = method_options.fetch(:dirty, true)
|
144
|
+
def update_attributes(values, opts = {}, dirty: true)
|
148
145
|
values.each do |k, v|
|
149
146
|
add_accessors([k], values) unless metaclass.method_defined?(k.to_sym)
|
150
147
|
@values[k] = Util.convert_to_stripe_object(v, opts)
|
data/lib/stripe/util.rb
CHANGED
@@ -86,6 +86,8 @@ module Stripe
|
|
86
86
|
Recipient::OBJECT_NAME => Recipient,
|
87
87
|
RecipientTransfer::OBJECT_NAME => RecipientTransfer,
|
88
88
|
Refund::OBJECT_NAME => Refund,
|
89
|
+
Reporting::ReportRun::OBJECT_NAME => Reporting::ReportRun,
|
90
|
+
Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
|
89
91
|
Reversal::OBJECT_NAME => Reversal,
|
90
92
|
SKU::OBJECT_NAME => SKU,
|
91
93
|
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
|
@@ -150,18 +152,6 @@ module Stripe
|
|
150
152
|
end
|
151
153
|
end
|
152
154
|
|
153
|
-
def self.file_readable(file)
|
154
|
-
# This is nominally equivalent to File.readable?, but that can
|
155
|
-
# report incorrect results on some more oddball filesystems
|
156
|
-
# (such as AFS)
|
157
|
-
|
158
|
-
::File.open(file) { |f| }
|
159
|
-
rescue StandardError
|
160
|
-
false
|
161
|
-
else
|
162
|
-
true
|
163
|
-
end
|
164
|
-
|
165
155
|
def self.symbolize_names(object)
|
166
156
|
case object
|
167
157
|
when Hash
|
@@ -276,11 +266,8 @@ module Stripe
|
|
276
266
|
# diffent naming schemes.
|
277
267
|
def self.normalize_headers(headers)
|
278
268
|
headers.each_with_object({}) do |(k, v), new_headers|
|
279
|
-
if k.is_a?(Symbol)
|
280
|
-
|
281
|
-
elsif k.is_a?(String)
|
282
|
-
k = titlecase_parts(k)
|
283
|
-
end
|
269
|
+
k = k.to_s.tr("_", "-") if k.is_a?(Symbol)
|
270
|
+
k = k.split("-").reject(&:empty?).map(&:capitalize).join("-")
|
284
271
|
|
285
272
|
new_headers[k] = v
|
286
273
|
end
|
@@ -368,14 +355,6 @@ module Stripe
|
|
368
355
|
end
|
369
356
|
private_class_method :log_internal
|
370
357
|
|
371
|
-
def self.titlecase_parts(s)
|
372
|
-
s.split("-")
|
373
|
-
.reject { |p| p == "" }
|
374
|
-
.map { |p| p[0].upcase + p[1..-1].downcase }
|
375
|
-
.join("-")
|
376
|
-
end
|
377
|
-
private_class_method :titlecase_parts
|
378
|
-
|
379
358
|
# Wraps a value in double quotes if it looks sufficiently complex so that
|
380
359
|
# it can be read by logfmt parsers.
|
381
360
|
def self.wrap_logfmt_value(val)
|
data/lib/stripe/version.rb
CHANGED
@@ -86,7 +86,7 @@ module Stripe
|
|
86
86
|
.with(query: { "expand" => ["customer"] })
|
87
87
|
.to_return(body: JSON.generate(charge_fixture))
|
88
88
|
|
89
|
-
ch = Stripe::Charge.retrieve(id: "ch_123", expand: :customer)
|
89
|
+
ch = Stripe::Charge.retrieve(id: "ch_123", expand: [:customer])
|
90
90
|
ch.refresh
|
91
91
|
end
|
92
92
|
|
@@ -99,7 +99,7 @@ module Stripe
|
|
99
99
|
.to_return(body: JSON.generate(customer_fixture))
|
100
100
|
|
101
101
|
customer = Stripe::Customer.retrieve("cus_123")
|
102
|
-
customer.sources.retrieve(id: "cc_test_card", expand: :customer)
|
102
|
+
customer.sources.retrieve(id: "cc_test_card", expand: [:customer])
|
103
103
|
end
|
104
104
|
|
105
105
|
context "when specifying per-object credentials" do
|
@@ -160,7 +160,7 @@ module Stripe
|
|
160
160
|
.with(query: { customer: "cus_123" })
|
161
161
|
.to_return(body: JSON.generate(data: [charge_fixture],
|
162
162
|
url: "/v1/charges"))
|
163
|
-
charges = Stripe::
|
163
|
+
charges = Stripe::Charge.list(customer: "cus_123")
|
164
164
|
|
165
165
|
stub_request(:get, "#{Stripe.api_base}/v1/charges")
|
166
166
|
.with(query: { customer: "cus_123", created: "123" })
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path("../../../test_helper", __FILE__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
module Reporting
|
7
|
+
class ReportRunTest < Test::Unit::TestCase
|
8
|
+
should "be creatable" do
|
9
|
+
report_run = Stripe::Reporting::ReportRun.create(
|
10
|
+
parameters: {
|
11
|
+
connected_account: "acct_123",
|
12
|
+
},
|
13
|
+
report_type: "activity.summary.1"
|
14
|
+
)
|
15
|
+
assert_requested :post, "#{Stripe.api_base}/v1/reporting/report_runs"
|
16
|
+
assert report_run.is_a?(Stripe::Reporting::ReportRun)
|
17
|
+
end
|
18
|
+
|
19
|
+
should "be listable" do
|
20
|
+
report_runs = Stripe::Reporting::ReportRun.list
|
21
|
+
assert_requested :get, "#{Stripe.api_base}/v1/reporting/report_runs"
|
22
|
+
assert report_runs.data.is_a?(Array)
|
23
|
+
assert report_runs.data[0].is_a?(Stripe::Reporting::ReportRun)
|
24
|
+
end
|
25
|
+
|
26
|
+
should "be retrievable" do
|
27
|
+
report_run = Stripe::Reporting::ReportRun.retrieve("frr_123")
|
28
|
+
assert_requested :get, "#{Stripe.api_base}/v1/reporting/report_runs/frr_123"
|
29
|
+
assert report_run.is_a?(Stripe::Reporting::ReportRun)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require ::File.expand_path("../../../test_helper", __FILE__)
|
4
|
+
|
5
|
+
module Stripe
|
6
|
+
module Reporting
|
7
|
+
class ReportTypeTest < Test::Unit::TestCase
|
8
|
+
should "be listable" do
|
9
|
+
report_types = Stripe::Reporting::ReportType.list
|
10
|
+
assert_requested :get, "#{Stripe.api_base}/v1/reporting/report_types"
|
11
|
+
assert report_types.data.is_a?(Array)
|
12
|
+
assert report_types.data[0].is_a?(Stripe::Reporting::ReportType)
|
13
|
+
end
|
14
|
+
|
15
|
+
should "be retrievable" do
|
16
|
+
report_type = Stripe::Reporting::ReportType.retrieve("activity.summary.1")
|
17
|
+
assert_requested :get, "#{Stripe.api_base}/v1/reporting/report_types/activity.summary.1"
|
18
|
+
assert report_type.is_a?(Stripe::Reporting::ReportType)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -16,7 +16,7 @@ PROJECT_ROOT = ::File.expand_path("../../", __FILE__)
|
|
16
16
|
require ::File.expand_path("../test_data", __FILE__)
|
17
17
|
|
18
18
|
# If changing this number, please also change it in `.travis.yml`.
|
19
|
-
MOCK_MINIMUM_VERSION = "0.
|
19
|
+
MOCK_MINIMUM_VERSION = "0.30.0".freeze
|
20
20
|
MOCK_PORT = ENV["STRIPE_MOCK_PORT"] || 12_111
|
21
21
|
|
22
22
|
# Disable all real network connections except those that are outgoing to
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stripe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -100,6 +100,8 @@ files:
|
|
100
100
|
- lib/stripe/recipient.rb
|
101
101
|
- lib/stripe/recipient_transfer.rb
|
102
102
|
- lib/stripe/refund.rb
|
103
|
+
- lib/stripe/reporting/report_run.rb
|
104
|
+
- lib/stripe/reporting/report_type.rb
|
103
105
|
- lib/stripe/reversal.rb
|
104
106
|
- lib/stripe/sigma/scheduled_query_run.rb
|
105
107
|
- lib/stripe/singleton_api_resource.rb
|
@@ -166,6 +168,8 @@ files:
|
|
166
168
|
- test/stripe/product_test.rb
|
167
169
|
- test/stripe/recipient_test.rb
|
168
170
|
- test/stripe/refund_test.rb
|
171
|
+
- test/stripe/reporting/report_run_test.rb
|
172
|
+
- test/stripe/reporting/report_type_test.rb
|
169
173
|
- test/stripe/reversal_test.rb
|
170
174
|
- test/stripe/sigma/scheduled_query_run_test.rb
|
171
175
|
- test/stripe/sku_test.rb
|
@@ -257,6 +261,8 @@ test_files:
|
|
257
261
|
- test/stripe/product_test.rb
|
258
262
|
- test/stripe/recipient_test.rb
|
259
263
|
- test/stripe/refund_test.rb
|
264
|
+
- test/stripe/reporting/report_run_test.rb
|
265
|
+
- test/stripe/reporting/report_type_test.rb
|
260
266
|
- test/stripe/reversal_test.rb
|
261
267
|
- test/stripe/sigma/scheduled_query_run_test.rb
|
262
268
|
- test/stripe/sku_test.rb
|