Merge pull request #681 from stripe/remi-add-reporting-resources

Add support for the Reporting resources
This commit is contained in:
Brandur 2018-09-05 14:52:48 -07:00 committed by GitHub
commit 856201f67e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 83 additions and 0 deletions

View File

@ -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"

View 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

View 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

View File

@ -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,

View 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

View 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