diff --git a/lib/stripe.rb b/lib/stripe.rb index e42340ebc..7fe803fa4 100644 --- a/lib/stripe.rb +++ b/lib/stripe.rb @@ -77,6 +77,8 @@ require "stripe/recipient" require "stripe/recipient_transfer" require "stripe/refund" +require "stripe/reporting/report_run" +require "stripe/reporting/report_type" require "stripe/reversal" require "stripe/sigma/scheduled_query_run" require "stripe/sku" diff --git a/lib/stripe/reporting/report_run.rb b/lib/stripe/reporting/report_run.rb new file mode 100644 index 000000000..052122706 --- /dev/null +++ b/lib/stripe/reporting/report_run.rb @@ -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 diff --git a/lib/stripe/reporting/report_type.rb b/lib/stripe/reporting/report_type.rb new file mode 100644 index 000000000..cd355fb4a --- /dev/null +++ b/lib/stripe/reporting/report_type.rb @@ -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 diff --git a/lib/stripe/util.rb b/lib/stripe/util.rb index 8d5d28898..98f7d818a 100644 --- a/lib/stripe/util.rb +++ b/lib/stripe/util.rb @@ -86,6 +86,8 @@ def self.object_classes # rubocop:disable Metrics/MethodLength Recipient::OBJECT_NAME => Recipient, RecipientTransfer::OBJECT_NAME => RecipientTransfer, Refund::OBJECT_NAME => Refund, + Reporting::ReportRun::OBJECT_NAME => Reporting::ReportRun, + Reporting::ReportType::OBJECT_NAME => Reporting::ReportType, Reversal::OBJECT_NAME => Reversal, SKU::OBJECT_NAME => SKU, Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun, diff --git a/test/stripe/reporting/report_run_test.rb b/test/stripe/reporting/report_run_test.rb new file mode 100644 index 000000000..febc83a18 --- /dev/null +++ b/test/stripe/reporting/report_run_test.rb @@ -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 diff --git a/test/stripe/reporting/report_type_test.rb b/test/stripe/reporting/report_type_test.rb new file mode 100644 index 000000000..e7fcba295 --- /dev/null +++ b/test/stripe/reporting/report_type_test.rb @@ -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