-
Notifications
You must be signed in to change notification settings - Fork 548
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for the Reporting resources
- Loading branch information
1 parent
1bbbfd4
commit 0f3b0cf
Showing
6 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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( | ||
report_type: "activity.summary.1", | ||
parameters: { | ||
connected_account: "acct_123", | ||
}, | ||
) | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |