mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-10-04 00:00:47 -04:00
Merge pull request #681 from stripe/remi-add-reporting-resources
Add support for the Reporting resources
This commit is contained in:
commit
856201f67e
@ -77,6 +77,8 @@ require "stripe/product"
|
|||||||
require "stripe/recipient"
|
require "stripe/recipient"
|
||||||
require "stripe/recipient_transfer"
|
require "stripe/recipient_transfer"
|
||||||
require "stripe/refund"
|
require "stripe/refund"
|
||||||
|
require "stripe/reporting/report_run"
|
||||||
|
require "stripe/reporting/report_type"
|
||||||
require "stripe/reversal"
|
require "stripe/reversal"
|
||||||
require "stripe/sigma/scheduled_query_run"
|
require "stripe/sigma/scheduled_query_run"
|
||||||
require "stripe/sku"
|
require "stripe/sku"
|
||||||
|
12
lib/stripe/reporting/report_run.rb
Normal file
12
lib/stripe/reporting/report_run.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Reporting
|
||||||
|
class ReportRun < Stripe::APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "reporting.report_run".freeze
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
12
lib/stripe/reporting/report_type.rb
Normal file
12
lib/stripe/reporting/report_type.rb
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Reporting
|
||||||
|
class ReportType < Stripe::APIResource
|
||||||
|
extend Stripe::APIOperations::Create
|
||||||
|
extend Stripe::APIOperations::List
|
||||||
|
|
||||||
|
OBJECT_NAME = "reporting.report_type".freeze
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -86,6 +86,8 @@ module Stripe
|
|||||||
Recipient::OBJECT_NAME => Recipient,
|
Recipient::OBJECT_NAME => Recipient,
|
||||||
RecipientTransfer::OBJECT_NAME => RecipientTransfer,
|
RecipientTransfer::OBJECT_NAME => RecipientTransfer,
|
||||||
Refund::OBJECT_NAME => Refund,
|
Refund::OBJECT_NAME => Refund,
|
||||||
|
Reporting::ReportRun::OBJECT_NAME => Reporting::ReportRun,
|
||||||
|
Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
|
||||||
Reversal::OBJECT_NAME => Reversal,
|
Reversal::OBJECT_NAME => Reversal,
|
||||||
SKU::OBJECT_NAME => SKU,
|
SKU::OBJECT_NAME => SKU,
|
||||||
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
|
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
|
||||||
|
33
test/stripe/reporting/report_run_test.rb
Normal file
33
test/stripe/reporting/report_run_test.rb
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require ::File.expand_path("../../../test_helper", __FILE__)
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Reporting
|
||||||
|
class ReportRunTest < Test::Unit::TestCase
|
||||||
|
should "be creatable" do
|
||||||
|
report_run = Stripe::Reporting::ReportRun.create(
|
||||||
|
parameters: {
|
||||||
|
connected_account: "acct_123",
|
||||||
|
},
|
||||||
|
report_type: "activity.summary.1"
|
||||||
|
)
|
||||||
|
assert_requested :post, "#{Stripe.api_base}/v1/reporting/report_runs"
|
||||||
|
assert report_run.is_a?(Stripe::Reporting::ReportRun)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "be listable" do
|
||||||
|
report_runs = Stripe::Reporting::ReportRun.list
|
||||||
|
assert_requested :get, "#{Stripe.api_base}/v1/reporting/report_runs"
|
||||||
|
assert report_runs.data.is_a?(Array)
|
||||||
|
assert report_runs.data[0].is_a?(Stripe::Reporting::ReportRun)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "be retrievable" do
|
||||||
|
report_run = Stripe::Reporting::ReportRun.retrieve("frr_123")
|
||||||
|
assert_requested :get, "#{Stripe.api_base}/v1/reporting/report_runs/frr_123"
|
||||||
|
assert report_run.is_a?(Stripe::Reporting::ReportRun)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
22
test/stripe/reporting/report_type_test.rb
Normal file
22
test/stripe/reporting/report_type_test.rb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require ::File.expand_path("../../../test_helper", __FILE__)
|
||||||
|
|
||||||
|
module Stripe
|
||||||
|
module Reporting
|
||||||
|
class ReportTypeTest < Test::Unit::TestCase
|
||||||
|
should "be listable" do
|
||||||
|
report_types = Stripe::Reporting::ReportType.list
|
||||||
|
assert_requested :get, "#{Stripe.api_base}/v1/reporting/report_types"
|
||||||
|
assert report_types.data.is_a?(Array)
|
||||||
|
assert report_types.data[0].is_a?(Stripe::Reporting::ReportType)
|
||||||
|
end
|
||||||
|
|
||||||
|
should "be retrievable" do
|
||||||
|
report_type = Stripe::Reporting::ReportType.retrieve("activity.summary.1")
|
||||||
|
assert_requested :get, "#{Stripe.api_base}/v1/reporting/report_types/activity.summary.1"
|
||||||
|
assert report_type.is_a?(Stripe::Reporting::ReportType)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user