diff --git a/API_VERSION b/API_VERSION index 8e27f52b..258eb5a0 100644 --- a/API_VERSION +++ b/API_VERSION @@ -1 +1 @@ -56689dcbcaa4c7ce6bf1b51a5add451972e0689c \ No newline at end of file +85f516560e557fcd787735d9603bd57c7abb3a91 \ No newline at end of file diff --git a/lib/stripe/event_types.rb b/lib/stripe/event_types.rb index 5e64915a..f955d494 100644 --- a/lib/stripe/event_types.rb +++ b/lib/stripe/event_types.rb @@ -480,6 +480,11 @@ module Stripe Events::V2PaymentsOffSessionPaymentRequiresCaptureEvent, Events::V2PaymentsOffSessionPaymentSucceededEvent.lookup_type => Events::V2PaymentsOffSessionPaymentSucceededEvent, + Events::V2ReportingReportRunCreatedEvent.lookup_type => Events::V2ReportingReportRunCreatedEvent, + Events::V2ReportingReportRunFailedEvent.lookup_type => Events::V2ReportingReportRunFailedEvent, + Events::V2ReportingReportRunSucceededEvent.lookup_type => + Events::V2ReportingReportRunSucceededEvent, + Events::V2ReportingReportRunUpdatedEvent.lookup_type => Events::V2ReportingReportRunUpdatedEvent, # v2 event types: The end of the section generated from our OpenAPI spec } end @@ -1059,6 +1064,14 @@ module Stripe Events::V2PaymentsOffSessionPaymentRequiresCaptureEventNotification, Events::V2PaymentsOffSessionPaymentSucceededEventNotification.lookup_type => Events::V2PaymentsOffSessionPaymentSucceededEventNotification, + Events::V2ReportingReportRunCreatedEventNotification.lookup_type => + Events::V2ReportingReportRunCreatedEventNotification, + Events::V2ReportingReportRunFailedEventNotification.lookup_type => + Events::V2ReportingReportRunFailedEventNotification, + Events::V2ReportingReportRunSucceededEventNotification.lookup_type => + Events::V2ReportingReportRunSucceededEventNotification, + Events::V2ReportingReportRunUpdatedEventNotification.lookup_type => + Events::V2ReportingReportRunUpdatedEventNotification, # event notification types: The end of the section generated from our OpenAPI spec } end diff --git a/lib/stripe/events/v2_reporting_report_run_created_event.rb b/lib/stripe/events/v2_reporting_report_run_created_event.rb new file mode 100644 index 00000000..ce1b735b --- /dev/null +++ b/lib/stripe/events/v2_reporting_report_run_created_event.rb @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Events + # Occurs when a ReportRun is created. + class V2ReportingReportRunCreatedEvent < Stripe::V2::Core::Event + def self.lookup_type + "v2.reporting.report_run.created" + end + + # Retrieves the related object from the API. Makes an API request on every call. + def fetch_related_object + _request( + method: :get, + path: related_object.url, + base_address: :api, + opts: { stripe_context: context } + ) + end + attr_reader :related_object + end + + # Occurs when a ReportRun is created. + class V2ReportingReportRunCreatedEventNotification < Stripe::V2::Core::EventNotification + def self.lookup_type + "v2.reporting.report_run.created" + end + + attr_reader :related_object + + # Retrieves the ReportRun related to this EventNotification from the Stripe API. Makes an API request on every call. + def fetch_related_object + resp = @client.raw_request( + :get, + related_object.url, + opts: { stripe_context: context }, + usage: ["fetch_related_object"] + ) + @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url)) + end + end + end +end diff --git a/lib/stripe/events/v2_reporting_report_run_failed_event.rb b/lib/stripe/events/v2_reporting_report_run_failed_event.rb new file mode 100644 index 00000000..2d4b74d5 --- /dev/null +++ b/lib/stripe/events/v2_reporting_report_run_failed_event.rb @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Events + # Occurs when a ReportRun has failed to complete. + class V2ReportingReportRunFailedEvent < Stripe::V2::Core::Event + def self.lookup_type + "v2.reporting.report_run.failed" + end + + # Retrieves the related object from the API. Makes an API request on every call. + def fetch_related_object + _request( + method: :get, + path: related_object.url, + base_address: :api, + opts: { stripe_context: context } + ) + end + attr_reader :related_object + end + + # Occurs when a ReportRun has failed to complete. + class V2ReportingReportRunFailedEventNotification < Stripe::V2::Core::EventNotification + def self.lookup_type + "v2.reporting.report_run.failed" + end + + attr_reader :related_object + + # Retrieves the ReportRun related to this EventNotification from the Stripe API. Makes an API request on every call. + def fetch_related_object + resp = @client.raw_request( + :get, + related_object.url, + opts: { stripe_context: context }, + usage: ["fetch_related_object"] + ) + @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url)) + end + end + end +end diff --git a/lib/stripe/events/v2_reporting_report_run_succeeded_event.rb b/lib/stripe/events/v2_reporting_report_run_succeeded_event.rb new file mode 100644 index 00000000..77f235c2 --- /dev/null +++ b/lib/stripe/events/v2_reporting_report_run_succeeded_event.rb @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Events + # Occurs when a ReportRun has successfully completed. + class V2ReportingReportRunSucceededEvent < Stripe::V2::Core::Event + def self.lookup_type + "v2.reporting.report_run.succeeded" + end + + # Retrieves the related object from the API. Makes an API request on every call. + def fetch_related_object + _request( + method: :get, + path: related_object.url, + base_address: :api, + opts: { stripe_context: context } + ) + end + attr_reader :related_object + end + + # Occurs when a ReportRun has successfully completed. + class V2ReportingReportRunSucceededEventNotification < Stripe::V2::Core::EventNotification + def self.lookup_type + "v2.reporting.report_run.succeeded" + end + + attr_reader :related_object + + # Retrieves the ReportRun related to this EventNotification from the Stripe API. Makes an API request on every call. + def fetch_related_object + resp = @client.raw_request( + :get, + related_object.url, + opts: { stripe_context: context }, + usage: ["fetch_related_object"] + ) + @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url)) + end + end + end +end diff --git a/lib/stripe/events/v2_reporting_report_run_updated_event.rb b/lib/stripe/events/v2_reporting_report_run_updated_event.rb new file mode 100644 index 00000000..152f8c35 --- /dev/null +++ b/lib/stripe/events/v2_reporting_report_run_updated_event.rb @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module Events + # Occurs when a ReportRun is updated. + class V2ReportingReportRunUpdatedEvent < Stripe::V2::Core::Event + def self.lookup_type + "v2.reporting.report_run.updated" + end + + # Retrieves the related object from the API. Makes an API request on every call. + def fetch_related_object + _request( + method: :get, + path: related_object.url, + base_address: :api, + opts: { stripe_context: context } + ) + end + attr_reader :related_object + end + + # Occurs when a ReportRun is updated. + class V2ReportingReportRunUpdatedEventNotification < Stripe::V2::Core::EventNotification + def self.lookup_type + "v2.reporting.report_run.updated" + end + + attr_reader :related_object + + # Retrieves the ReportRun related to this EventNotification from the Stripe API. Makes an API request on every call. + def fetch_related_object + resp = @client.raw_request( + :get, + related_object.url, + opts: { stripe_context: context }, + usage: ["fetch_related_object"] + ) + @client.deserialize(resp.http_body, api_mode: Util.get_api_mode(related_object.url)) + end + end + end +end diff --git a/lib/stripe/object_types.rb b/lib/stripe/object_types.rb index 13fb0901..27ef62fa 100644 --- a/lib/stripe/object_types.rb +++ b/lib/stripe/object_types.rb @@ -247,6 +247,8 @@ module Stripe V2::MoneyManagement::Transaction.object_name => V2::MoneyManagement::Transaction, V2::MoneyManagement::TransactionEntry.object_name => V2::MoneyManagement::TransactionEntry, V2::Payments::OffSessionPayment.object_name => V2::Payments::OffSessionPayment, + V2::Reporting::Report.object_name => V2::Reporting::Report, + V2::Reporting::ReportRun.object_name => V2::Reporting::ReportRun, V2::Tax::AutomaticRule.object_name => V2::Tax::AutomaticRule, # v2 object classes: The end of the section generated from our OpenAPI spec } diff --git a/lib/stripe/params.rb b/lib/stripe/params.rb index 284d97c8..6835980f 100644 --- a/lib/stripe/params.rb +++ b/lib/stripe/params.rb @@ -830,6 +830,9 @@ require "stripe/params/v2/payments/off_session_payment_capture_params" require "stripe/params/v2/payments/off_session_payment_create_params" require "stripe/params/v2/payments/off_session_payment_list_params" require "stripe/params/v2/payments/off_session_payment_retrieve_params" +require "stripe/params/v2/reporting/report_retrieve_params" +require "stripe/params/v2/reporting/report_run_create_params" +require "stripe/params/v2/reporting/report_run_retrieve_params" require "stripe/params/v2/tax/automatic_rule_create_params" require "stripe/params/v2/tax/automatic_rule_deactivate_params" require "stripe/params/v2/tax/automatic_rule_find_params" diff --git a/lib/stripe/params/v2/reporting/report_retrieve_params.rb b/lib/stripe/params/v2/reporting/report_retrieve_params.rb new file mode 100644 index 00000000..d8343f92 --- /dev/null +++ b/lib/stripe/params/v2/reporting/report_retrieve_params.rb @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module V2 + module Reporting + class ReportRetrieveParams < ::Stripe::RequestParams; end + end + end +end diff --git a/lib/stripe/params/v2/reporting/report_run_create_params.rb b/lib/stripe/params/v2/reporting/report_run_create_params.rb new file mode 100644 index 00000000..c8c86f3f --- /dev/null +++ b/lib/stripe/params/v2/reporting/report_run_create_params.rb @@ -0,0 +1,33 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module V2 + module Reporting + class ReportRunCreateParams < ::Stripe::RequestParams + class ResultOptions < ::Stripe::RequestParams + # If set, the generated report file will be compressed into a ZIP folder. + # This is useful for reducing file size and download time for large reports. + attr_accessor :compress_file + + def initialize(compress_file: nil) + @compress_file = compress_file + end + end + # The unique identifier of the `Report` being requested. + attr_accessor :report + # A map of parameter names to values, specifying how the report should be customized. + # The accepted parameters depend on the specific `Report` being run. + attr_accessor :report_parameters + # Optional settings to customize the results of the `ReportRun`. + attr_accessor :result_options + + def initialize(report: nil, report_parameters: nil, result_options: nil) + @report = report + @report_parameters = report_parameters + @result_options = result_options + end + end + end + end +end diff --git a/lib/stripe/params/v2/reporting/report_run_retrieve_params.rb b/lib/stripe/params/v2/reporting/report_run_retrieve_params.rb new file mode 100644 index 00000000..1f76c569 --- /dev/null +++ b/lib/stripe/params/v2/reporting/report_run_retrieve_params.rb @@ -0,0 +1,10 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module V2 + module Reporting + class ReportRunRetrieveParams < ::Stripe::RequestParams; end + end + end +end diff --git a/lib/stripe/resources.rb b/lib/stripe/resources.rb index 62acdda1..d6c44eb8 100644 --- a/lib/stripe/resources.rb +++ b/lib/stripe/resources.rb @@ -222,6 +222,8 @@ require "stripe/resources/v2/money_management/recipient_verification" require "stripe/resources/v2/money_management/transaction" require "stripe/resources/v2/money_management/transaction_entry" require "stripe/resources/v2/payments/off_session_payment" +require "stripe/resources/v2/reporting/report" +require "stripe/resources/v2/reporting/report_run" require "stripe/resources/v2/tax/automatic_rule" require "stripe/resources/webhook_endpoint" require "stripe/events/v1_account_updated_event" @@ -537,3 +539,7 @@ require "stripe/events/v2_payments_off_session_payment_created_event" require "stripe/events/v2_payments_off_session_payment_failed_event" require "stripe/events/v2_payments_off_session_payment_requires_capture_event" require "stripe/events/v2_payments_off_session_payment_succeeded_event" +require "stripe/events/v2_reporting_report_run_created_event" +require "stripe/events/v2_reporting_report_run_failed_event" +require "stripe/events/v2_reporting_report_run_succeeded_event" +require "stripe/events/v2_reporting_report_run_updated_event" diff --git a/lib/stripe/resources/v2/reporting/report.rb b/lib/stripe/resources/v2/reporting/report.rb new file mode 100644 index 00000000..c9c8bcb2 --- /dev/null +++ b/lib/stripe/resources/v2/reporting/report.rb @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module V2 + module Reporting + # The Report resource represents a customizable report template that provides insights into various aspects of your Stripe integration. + class Report < APIResource + OBJECT_NAME = "v2.reporting.report" + def self.object_name + "v2.reporting.report" + end + + class Parameters < ::Stripe::StripeObject + class ArrayDetails < ::Stripe::StripeObject + class EnumDetails < ::Stripe::StripeObject + # Allowed values of the enum. + attr_reader :allowed_values + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end + # Data type of the elements in the array. + attr_reader :element_type + # Details about enum elements in the array. + attr_reader :enum_details + + def self.inner_class_types + @inner_class_types = { enum_details: EnumDetails } + end + + def self.field_remappings + @field_remappings = {} + end + end + + class EnumDetails < ::Stripe::StripeObject + # Allowed values of the enum. + attr_reader :allowed_values + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end + + class TimestampDetails < ::Stripe::StripeObject + # Maximum permitted timestamp which can be requested. + attr_reader :max + # Minimum permitted timestamp which can be requested. + attr_reader :min + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end + # For array parameters, provides details about the array elements. + attr_reader :array_details + # Explains the purpose and usage of the parameter. + attr_reader :description + # For enum parameters, provides the list of allowed values. + attr_reader :enum_details + # Indicates whether the parameter must be provided. + attr_reader :required + # For timestamp parameters, specifies the allowed date range. + attr_reader :timestamp_details + # The data type of the parameter. + attr_reader :type + + def self.inner_class_types + @inner_class_types = { + array_details: ArrayDetails, + enum_details: EnumDetails, + timestamp_details: TimestampDetails, + } + end + + def self.field_remappings + @field_remappings = {} + end + end + # The unique identifier of the `Report` object. + attr_reader :id + # The human-readable name of the `Report`. + attr_reader :name + # String representing the object's type. Objects of the same type share the same value of the object field. + attr_reader :object + # Specification of the parameters that the `Report` accepts. It details each parameter's + # name, description, whether it is required, and any validations performed. + attr_reader :parameters + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + attr_reader :livemode + + def self.inner_class_types + @inner_class_types = { parameters: Parameters } + end + + def self.field_remappings + @field_remappings = {} + end + end + end + end +end diff --git a/lib/stripe/resources/v2/reporting/report_run.rb b/lib/stripe/resources/v2/reporting/report_run.rb new file mode 100644 index 00000000..2327baf8 --- /dev/null +++ b/lib/stripe/resources/v2/reporting/report_run.rb @@ -0,0 +1,128 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module V2 + module Reporting + # The `ReportRun` object represents an instance of a `Report` generated with specific + # run parameters. Once the object is created, Stripe begins processing the report. When + # the report has finished running, it will give you a reference to the results. + class ReportRun < APIResource + OBJECT_NAME = "v2.reporting.report_run" + def self.object_name + "v2.reporting.report_run" + end + + class Result < ::Stripe::StripeObject + class File < ::Stripe::StripeObject + class DownloadUrl < ::Stripe::StripeObject + # The time that the URL expires. + attr_reader :expires_at + # The URL that can be used for accessing the file. + attr_reader :url + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end + # The content type of the file. + attr_reader :content_type + # A pre-signed URL that allows secure, time-limited access to download the file. + attr_reader :download_url + # The total size of the file in bytes. + attr_reader :size + + def self.inner_class_types + @inner_class_types = { download_url: DownloadUrl } + end + + def self.field_remappings + @field_remappings = {} + end + end + # Contains metadata about the file produced by the `ReportRun`, including + # its content type, size, and a URL to download its contents. + attr_reader :file + # The type of the `ReportRun` result. + attr_reader :type + + def self.inner_class_types + @inner_class_types = { file: File } + end + + def self.field_remappings + @field_remappings = {} + end + end + + class ResultOptions < ::Stripe::StripeObject + # If set, the generated report file will be compressed into a ZIP folder. + # This is useful for reducing file size and download time for large reports. + attr_reader :compress_file + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end + + class StatusDetails < ::Stripe::StripeObject + # Error code categorizing the reason the `ReportRun` failed. + attr_reader :error_code + # Error message with additional details about the failure. + attr_reader :error_message + + def self.inner_class_types + @inner_class_types = {} + end + + def self.field_remappings + @field_remappings = {} + end + end + # Time at which the object was created. + attr_reader :created + # The unique identifier of the `ReportRun` object. + attr_reader :id + # String representing the object's type. Objects of the same type share the same value of the object field. + attr_reader :object + # The unique identifier of the `Report` object which was run. + attr_reader :report + # The human-readable name of the `Report` which was run. + attr_reader :report_name + # The parameters used to customize the generation of the report. + attr_reader :report_parameters + # Details how to retrieve the results of a successfully completed `ReportRun`. + attr_reader :result + # The options specified for customizing the output file of the `ReportRun`. + attr_reader :result_options + # The current status of the `ReportRun`. + attr_reader :status + # Additional details about the current state of the `ReportRun`. The field is currently only populated when a `ReportRun` + # is in the `failed` state, providing more information about why the report failed to generate successfully. + attr_reader :status_details + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + attr_reader :livemode + + def self.inner_class_types + @inner_class_types = { + result: Result, + result_options: ResultOptions, + status_details: StatusDetails, + } + end + + def self.field_remappings + @field_remappings = {} + end + end + end + end +end diff --git a/lib/stripe/services.rb b/lib/stripe/services.rb index d41abf0e..86033860 100644 --- a/lib/stripe/services.rb +++ b/lib/stripe/services.rb @@ -259,6 +259,9 @@ require "stripe/services/v2/money_management/transaction_service" require "stripe/services/v2/money_management_service" require "stripe/services/v2/payment_service" require "stripe/services/v2/payments/off_session_payment_service" +require "stripe/services/v2/reporting/report_run_service" +require "stripe/services/v2/reporting/report_service" +require "stripe/services/v2/reporting_service" require "stripe/services/v2/tax/automatic_rule_service" require "stripe/services/v2/tax_service" require "stripe/services/v2/test_helper_service" diff --git a/lib/stripe/services/v2/reporting/report_run_service.rb b/lib/stripe/services/v2/reporting/report_run_service.rb new file mode 100644 index 00000000..4029a060 --- /dev/null +++ b/lib/stripe/services/v2/reporting/report_run_service.rb @@ -0,0 +1,38 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module V2 + module Reporting + class ReportRunService < StripeService + # Initiates the generation of a `ReportRun` based on the specified report template + # and user-provided parameters. It's the starting point for obtaining report data, + # and returns a `ReportRun` object which can be used to track the progress and retrieve + # the results of the report. + # + # ** raises RateLimitError + def create(params = {}, opts = {}) + request( + method: :post, + path: "/v2/reporting/report_runs", + params: params, + opts: opts, + base_address: :api + ) + end + + # Fetches the current state and details of a previously created `ReportRun`. If the `ReportRun` + # has succeeded, the endpoint will provide details for how to retrieve the results. + def retrieve(id, params = {}, opts = {}) + request( + method: :get, + path: format("/v2/reporting/report_runs/%s", { id: CGI.escape(id) }), + params: params, + opts: opts, + base_address: :api + ) + end + end + end + end +end diff --git a/lib/stripe/services/v2/reporting/report_service.rb b/lib/stripe/services/v2/reporting/report_service.rb new file mode 100644 index 00000000..4e2143c4 --- /dev/null +++ b/lib/stripe/services/v2/reporting/report_service.rb @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module V2 + module Reporting + class ReportService < StripeService + # Retrieves metadata about a specific `Report` template, including its name, description, + # and the parameters it accepts. It's useful for understanding the capabilities and + # requirements of a particular `Report` before requesting a `ReportRun`. + def retrieve(id, params = {}, opts = {}) + request( + method: :get, + path: format("/v2/reporting/reports/%s", { id: CGI.escape(id) }), + params: params, + opts: opts, + base_address: :api + ) + end + end + end + end +end diff --git a/lib/stripe/services/v2/reporting_service.rb b/lib/stripe/services/v2/reporting_service.rb new file mode 100644 index 00000000..43e3aecc --- /dev/null +++ b/lib/stripe/services/v2/reporting_service.rb @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +module Stripe + module V2 + class ReportingService < StripeService + attr_reader :reports, :report_runs + + def initialize(requestor) + super + @reports = Stripe::V2::Reporting::ReportService.new(@requestor) + @report_runs = Stripe::V2::Reporting::ReportRunService.new(@requestor) + end + end + end +end diff --git a/lib/stripe/services/v2_services.rb b/lib/stripe/services/v2_services.rb index b147fcbb..669b7f1b 100644 --- a/lib/stripe/services/v2_services.rb +++ b/lib/stripe/services/v2_services.rb @@ -3,7 +3,7 @@ module Stripe class V2Services < StripeService - attr_reader :billing, :core, :money_management, :payments, :tax, :test_helpers + attr_reader :billing, :core, :money_management, :payments, :reporting, :tax, :test_helpers def initialize(requestor) super @@ -11,6 +11,7 @@ module Stripe @core = Stripe::V2::CoreService.new(@requestor) @money_management = Stripe::V2::MoneyManagementService.new(@requestor) @payments = Stripe::V2::PaymentService.new(@requestor) + @reporting = Stripe::V2::ReportingService.new(@requestor) @tax = Stripe::V2::TaxService.new(@requestor) @test_helpers = Stripe::V2::TestHelperService.new(@requestor) end diff --git a/rbi/stripe.rbi b/rbi/stripe.rbi index cf3747ce..f117c292 100644 --- a/rbi/stripe.rbi +++ b/rbi/stripe.rbi @@ -69893,6 +69893,230 @@ module Stripe end end # typed: true +module Stripe + module V2 + module Reporting + # The `ReportRun` object represents an instance of a `Report` generated with specific + # run parameters. Once the object is created, Stripe begins processing the report. When + # the report has finished running, it will give you a reference to the results. + class ReportRun < APIResource + class Result < ::Stripe::StripeObject + class File < ::Stripe::StripeObject + class DownloadUrl < ::Stripe::StripeObject + # The time that the URL expires. + sig { returns(T.nilable(String)) } + def expires_at; end + # The URL that can be used for accessing the file. + sig { returns(String) } + def url; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # The content type of the file. + sig { returns(String) } + def content_type; end + # A pre-signed URL that allows secure, time-limited access to download the file. + sig { returns(DownloadUrl) } + def download_url; end + # The total size of the file in bytes. + sig { returns(Integer) } + def size; end + def self.inner_class_types + @inner_class_types = {download_url: DownloadUrl} + end + def self.field_remappings + @field_remappings = {} + end + end + # Contains metadata about the file produced by the `ReportRun`, including + # its content type, size, and a URL to download its contents. + sig { returns(File) } + def file; end + # The type of the `ReportRun` result. + sig { returns(String) } + def type; end + def self.inner_class_types + @inner_class_types = {file: File} + end + def self.field_remappings + @field_remappings = {} + end + end + class ResultOptions < ::Stripe::StripeObject + # If set, the generated report file will be compressed into a ZIP folder. + # This is useful for reducing file size and download time for large reports. + sig { returns(T.nilable(T::Boolean)) } + def compress_file; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + class StatusDetails < ::Stripe::StripeObject + # Error code categorizing the reason the `ReportRun` failed. + sig { returns(T.nilable(String)) } + def error_code; end + # Error message with additional details about the failure. + sig { returns(T.nilable(String)) } + def error_message; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # Time at which the object was created. + sig { returns(String) } + def created; end + # The unique identifier of the `ReportRun` object. + sig { returns(String) } + def id; end + # String representing the object's type. Objects of the same type share the same value of the object field. + sig { returns(String) } + def object; end + # The unique identifier of the `Report` object which was run. + sig { returns(String) } + def report; end + # The human-readable name of the `Report` which was run. + sig { returns(String) } + def report_name; end + # The parameters used to customize the generation of the report. + sig { returns(T::Hash[String, T.untyped]) } + def report_parameters; end + # Details how to retrieve the results of a successfully completed `ReportRun`. + sig { returns(T.nilable(Result)) } + def result; end + # The options specified for customizing the output file of the `ReportRun`. + sig { returns(T.nilable(ResultOptions)) } + def result_options; end + # The current status of the `ReportRun`. + sig { returns(String) } + def status; end + # Additional details about the current state of the `ReportRun`. The field is currently only populated when a `ReportRun` + # is in the `failed` state, providing more information about why the report failed to generate successfully. + sig { returns(T::Hash[String, StatusDetails]) } + def status_details; end + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + sig { returns(T::Boolean) } + def livemode; end + end + end + end +end +# typed: true +module Stripe + module V2 + module Reporting + # The Report resource represents a customizable report template that provides insights into various aspects of your Stripe integration. + class Report < APIResource + class Parameters < ::Stripe::StripeObject + class ArrayDetails < ::Stripe::StripeObject + class EnumDetails < ::Stripe::StripeObject + # Allowed values of the enum. + sig { returns(T::Array[String]) } + def allowed_values; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # Data type of the elements in the array. + sig { returns(String) } + def element_type; end + # Details about enum elements in the array. + sig { returns(T.nilable(EnumDetails)) } + def enum_details; end + def self.inner_class_types + @inner_class_types = {enum_details: EnumDetails} + end + def self.field_remappings + @field_remappings = {} + end + end + class EnumDetails < ::Stripe::StripeObject + # Allowed values of the enum. + sig { returns(T::Array[String]) } + def allowed_values; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + class TimestampDetails < ::Stripe::StripeObject + # Maximum permitted timestamp which can be requested. + sig { returns(String) } + def max; end + # Minimum permitted timestamp which can be requested. + sig { returns(String) } + def min; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # For array parameters, provides details about the array elements. + sig { returns(T.nilable(ArrayDetails)) } + def array_details; end + # Explains the purpose and usage of the parameter. + sig { returns(String) } + def description; end + # For enum parameters, provides the list of allowed values. + sig { returns(T.nilable(EnumDetails)) } + def enum_details; end + # Indicates whether the parameter must be provided. + sig { returns(T::Boolean) } + def required; end + # For timestamp parameters, specifies the allowed date range. + sig { returns(T.nilable(TimestampDetails)) } + def timestamp_details; end + # The data type of the parameter. + sig { returns(String) } + def type; end + def self.inner_class_types + @inner_class_types = { + array_details: ArrayDetails, + enum_details: EnumDetails, + timestamp_details: TimestampDetails, + } + end + def self.field_remappings + @field_remappings = {} + end + end + # The unique identifier of the `Report` object. + sig { returns(String) } + def id; end + # The human-readable name of the `Report`. + sig { returns(String) } + def name; end + # String representing the object's type. Objects of the same type share the same value of the object field. + sig { returns(String) } + def object; end + # Specification of the parameters that the `Report` accepts. It details each parameter's + # name, description, whether it is required, and any validations performed. + sig { returns(T::Hash[String, Parameters]) } + def parameters; end + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + sig { returns(T::Boolean) } + def livemode; end + end + end + end +end +# typed: true module Stripe module V2 module Tax @@ -75260,6 +75484,7 @@ module Stripe attr_reader :core attr_reader :money_management attr_reader :payments + attr_reader :reporting attr_reader :tax attr_reader :test_helpers end @@ -76895,6 +77120,57 @@ module Stripe end end # typed: true +module Stripe + module V2 + class ReportingService < StripeService + attr_reader :reports + attr_reader :report_runs + end + end +end +# typed: true +module Stripe + module V2 + module Reporting + class ReportService < StripeService + # Retrieves metadata about a specific `Report` template, including its name, description, + # and the parameters it accepts. It's useful for understanding the capabilities and + # requirements of a particular `Report` before requesting a `ReportRun`. + sig { + params(id: String, params: T.any(::Stripe::V2::Reporting::ReportRetrieveParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::V2::Reporting::Report) + } + def retrieve(id, params = {}, opts = {}); end + end + end + end +end +# typed: true +module Stripe + module V2 + module Reporting + class ReportRunService < StripeService + # Initiates the generation of a `ReportRun` based on the specified report template + # and user-provided parameters. It's the starting point for obtaining report data, + # and returns a `ReportRun` object which can be used to track the progress and retrieve + # the results of the report. + # + # ** raises RateLimitError + sig { + params(params: T.any(::Stripe::V2::Reporting::ReportRunCreateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::V2::Reporting::ReportRun) + } + def create(params = {}, opts = {}); end + + # Fetches the current state and details of a previously created `ReportRun`. If the `ReportRun` + # has succeeded, the endpoint will provide details for how to retrieve the results. + sig { + params(id: String, params: T.any(::Stripe::V2::Reporting::ReportRunRetrieveParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::V2::Reporting::ReportRun) + } + def retrieve(id, params = {}, opts = {}); end + end + end + end +end +# typed: true module Stripe module V2 class TaxService < StripeService @@ -211443,6 +211719,65 @@ module Stripe end end # typed: true +module Stripe + module V2 + module Reporting + class ReportRetrieveParams < ::Stripe::RequestParams; end + end + end +end +# typed: true +module Stripe + module V2 + module Reporting + class ReportRunCreateParams < ::Stripe::RequestParams + class ResultOptions < ::Stripe::RequestParams + # If set, the generated report file will be compressed into a ZIP folder. + # This is useful for reducing file size and download time for large reports. + sig { returns(T.nilable(T::Boolean)) } + def compress_file; end + sig { params(_compress_file: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def compress_file=(_compress_file); end + sig { params(compress_file: T.nilable(T::Boolean)).void } + def initialize(compress_file: nil); end + end + # The unique identifier of the `Report` being requested. + sig { returns(String) } + def report; end + sig { params(_report: String).returns(String) } + def report=(_report); end + # A map of parameter names to values, specifying how the report should be customized. + # The accepted parameters depend on the specific `Report` being run. + sig { returns(T::Hash[String, T.untyped]) } + def report_parameters; end + sig { + params(_report_parameters: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) + } + def report_parameters=(_report_parameters); end + # Optional settings to customize the results of the `ReportRun`. + sig { returns(T.nilable(V2::Reporting::ReportRunCreateParams::ResultOptions)) } + def result_options; end + sig { + params(_result_options: T.nilable(V2::Reporting::ReportRunCreateParams::ResultOptions)).returns(T.nilable(V2::Reporting::ReportRunCreateParams::ResultOptions)) + } + def result_options=(_result_options); end + sig { + params(report: String, report_parameters: T::Hash[String, T.untyped], result_options: T.nilable(V2::Reporting::ReportRunCreateParams::ResultOptions)).void + } + def initialize(report: nil, report_parameters: nil, result_options: nil); end + end + end + end +end +# typed: true +module Stripe + module V2 + module Reporting + class ReportRunRetrieveParams < ::Stripe::RequestParams; end + end + end +end +# typed: true module Stripe module V2 module Tax diff --git a/rbi/stripe/params/v2/reporting/report_retrieve_params.rbi b/rbi/stripe/params/v2/reporting/report_retrieve_params.rbi new file mode 100644 index 00000000..afc63e54 --- /dev/null +++ b/rbi/stripe/params/v2/reporting/report_retrieve_params.rbi @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module V2 + module Reporting + class ReportRetrieveParams < ::Stripe::RequestParams; end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/params/v2/reporting/report_run_create_params.rbi b/rbi/stripe/params/v2/reporting/report_run_create_params.rbi new file mode 100644 index 00000000..ce54edf1 --- /dev/null +++ b/rbi/stripe/params/v2/reporting/report_run_create_params.rbi @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module V2 + module Reporting + class ReportRunCreateParams < ::Stripe::RequestParams + class ResultOptions < ::Stripe::RequestParams + # If set, the generated report file will be compressed into a ZIP folder. + # This is useful for reducing file size and download time for large reports. + sig { returns(T.nilable(T::Boolean)) } + def compress_file; end + sig { params(_compress_file: T.nilable(T::Boolean)).returns(T.nilable(T::Boolean)) } + def compress_file=(_compress_file); end + sig { params(compress_file: T.nilable(T::Boolean)).void } + def initialize(compress_file: nil); end + end + # The unique identifier of the `Report` being requested. + sig { returns(String) } + def report; end + sig { params(_report: String).returns(String) } + def report=(_report); end + # A map of parameter names to values, specifying how the report should be customized. + # The accepted parameters depend on the specific `Report` being run. + sig { returns(T::Hash[String, T.untyped]) } + def report_parameters; end + sig { + params(_report_parameters: T::Hash[String, T.untyped]).returns(T::Hash[String, T.untyped]) + } + def report_parameters=(_report_parameters); end + # Optional settings to customize the results of the `ReportRun`. + sig { returns(T.nilable(V2::Reporting::ReportRunCreateParams::ResultOptions)) } + def result_options; end + sig { + params(_result_options: T.nilable(V2::Reporting::ReportRunCreateParams::ResultOptions)).returns(T.nilable(V2::Reporting::ReportRunCreateParams::ResultOptions)) + } + def result_options=(_result_options); end + sig { + params(report: String, report_parameters: T::Hash[String, T.untyped], result_options: T.nilable(V2::Reporting::ReportRunCreateParams::ResultOptions)).void + } + def initialize(report: nil, report_parameters: nil, result_options: nil); end + end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/params/v2/reporting/report_run_retrieve_params.rbi b/rbi/stripe/params/v2/reporting/report_run_retrieve_params.rbi new file mode 100644 index 00000000..44cea14f --- /dev/null +++ b/rbi/stripe/params/v2/reporting/report_run_retrieve_params.rbi @@ -0,0 +1,11 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module V2 + module Reporting + class ReportRunRetrieveParams < ::Stripe::RequestParams; end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/resources/v2/reporting/report.rbi b/rbi/stripe/resources/v2/reporting/report.rbi new file mode 100644 index 00000000..c72897d2 --- /dev/null +++ b/rbi/stripe/resources/v2/reporting/report.rbi @@ -0,0 +1,109 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module V2 + module Reporting + # The Report resource represents a customizable report template that provides insights into various aspects of your Stripe integration. + class Report < APIResource + class Parameters < ::Stripe::StripeObject + class ArrayDetails < ::Stripe::StripeObject + class EnumDetails < ::Stripe::StripeObject + # Allowed values of the enum. + sig { returns(T::Array[String]) } + def allowed_values; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # Data type of the elements in the array. + sig { returns(String) } + def element_type; end + # Details about enum elements in the array. + sig { returns(T.nilable(EnumDetails)) } + def enum_details; end + def self.inner_class_types + @inner_class_types = {enum_details: EnumDetails} + end + def self.field_remappings + @field_remappings = {} + end + end + class EnumDetails < ::Stripe::StripeObject + # Allowed values of the enum. + sig { returns(T::Array[String]) } + def allowed_values; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + class TimestampDetails < ::Stripe::StripeObject + # Maximum permitted timestamp which can be requested. + sig { returns(String) } + def max; end + # Minimum permitted timestamp which can be requested. + sig { returns(String) } + def min; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # For array parameters, provides details about the array elements. + sig { returns(T.nilable(ArrayDetails)) } + def array_details; end + # Explains the purpose and usage of the parameter. + sig { returns(String) } + def description; end + # For enum parameters, provides the list of allowed values. + sig { returns(T.nilable(EnumDetails)) } + def enum_details; end + # Indicates whether the parameter must be provided. + sig { returns(T::Boolean) } + def required; end + # For timestamp parameters, specifies the allowed date range. + sig { returns(T.nilable(TimestampDetails)) } + def timestamp_details; end + # The data type of the parameter. + sig { returns(String) } + def type; end + def self.inner_class_types + @inner_class_types = { + array_details: ArrayDetails, + enum_details: EnumDetails, + timestamp_details: TimestampDetails, + } + end + def self.field_remappings + @field_remappings = {} + end + end + # The unique identifier of the `Report` object. + sig { returns(String) } + def id; end + # The human-readable name of the `Report`. + sig { returns(String) } + def name; end + # String representing the object's type. Objects of the same type share the same value of the object field. + sig { returns(String) } + def object; end + # Specification of the parameters that the `Report` accepts. It details each parameter's + # name, description, whether it is required, and any validations performed. + sig { returns(T::Hash[String, Parameters]) } + def parameters; end + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + sig { returns(T::Boolean) } + def livemode; end + end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/resources/v2/reporting/report_run.rbi b/rbi/stripe/resources/v2/reporting/report_run.rbi new file mode 100644 index 00000000..834f4614 --- /dev/null +++ b/rbi/stripe/resources/v2/reporting/report_run.rbi @@ -0,0 +1,121 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module V2 + module Reporting + # The `ReportRun` object represents an instance of a `Report` generated with specific + # run parameters. Once the object is created, Stripe begins processing the report. When + # the report has finished running, it will give you a reference to the results. + class ReportRun < APIResource + class Result < ::Stripe::StripeObject + class File < ::Stripe::StripeObject + class DownloadUrl < ::Stripe::StripeObject + # The time that the URL expires. + sig { returns(T.nilable(String)) } + def expires_at; end + # The URL that can be used for accessing the file. + sig { returns(String) } + def url; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # The content type of the file. + sig { returns(String) } + def content_type; end + # A pre-signed URL that allows secure, time-limited access to download the file. + sig { returns(DownloadUrl) } + def download_url; end + # The total size of the file in bytes. + sig { returns(Integer) } + def size; end + def self.inner_class_types + @inner_class_types = {download_url: DownloadUrl} + end + def self.field_remappings + @field_remappings = {} + end + end + # Contains metadata about the file produced by the `ReportRun`, including + # its content type, size, and a URL to download its contents. + sig { returns(File) } + def file; end + # The type of the `ReportRun` result. + sig { returns(String) } + def type; end + def self.inner_class_types + @inner_class_types = {file: File} + end + def self.field_remappings + @field_remappings = {} + end + end + class ResultOptions < ::Stripe::StripeObject + # If set, the generated report file will be compressed into a ZIP folder. + # This is useful for reducing file size and download time for large reports. + sig { returns(T.nilable(T::Boolean)) } + def compress_file; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + class StatusDetails < ::Stripe::StripeObject + # Error code categorizing the reason the `ReportRun` failed. + sig { returns(T.nilable(String)) } + def error_code; end + # Error message with additional details about the failure. + sig { returns(T.nilable(String)) } + def error_message; end + def self.inner_class_types + @inner_class_types = {} + end + def self.field_remappings + @field_remappings = {} + end + end + # Time at which the object was created. + sig { returns(String) } + def created; end + # The unique identifier of the `ReportRun` object. + sig { returns(String) } + def id; end + # String representing the object's type. Objects of the same type share the same value of the object field. + sig { returns(String) } + def object; end + # The unique identifier of the `Report` object which was run. + sig { returns(String) } + def report; end + # The human-readable name of the `Report` which was run. + sig { returns(String) } + def report_name; end + # The parameters used to customize the generation of the report. + sig { returns(T::Hash[String, T.untyped]) } + def report_parameters; end + # Details how to retrieve the results of a successfully completed `ReportRun`. + sig { returns(T.nilable(Result)) } + def result; end + # The options specified for customizing the output file of the `ReportRun`. + sig { returns(T.nilable(ResultOptions)) } + def result_options; end + # The current status of the `ReportRun`. + sig { returns(String) } + def status; end + # Additional details about the current state of the `ReportRun`. The field is currently only populated when a `ReportRun` + # is in the `failed` state, providing more information about why the report failed to generate successfully. + sig { returns(T::Hash[String, StatusDetails]) } + def status_details; end + # Has the value `true` if the object exists in live mode or the value `false` if the object exists in test mode. + sig { returns(T::Boolean) } + def livemode; end + end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/services/v2/reporting/report_run_service.rbi b/rbi/stripe/services/v2/reporting/report_run_service.rbi new file mode 100644 index 00000000..e859d319 --- /dev/null +++ b/rbi/stripe/services/v2/reporting/report_run_service.rbi @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module V2 + module Reporting + class ReportRunService < StripeService + # Initiates the generation of a `ReportRun` based on the specified report template + # and user-provided parameters. It's the starting point for obtaining report data, + # and returns a `ReportRun` object which can be used to track the progress and retrieve + # the results of the report. + # + # ** raises RateLimitError + sig { + params(params: T.any(::Stripe::V2::Reporting::ReportRunCreateParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::V2::Reporting::ReportRun) + } + def create(params = {}, opts = {}); end + + # Fetches the current state and details of a previously created `ReportRun`. If the `ReportRun` + # has succeeded, the endpoint will provide details for how to retrieve the results. + sig { + params(id: String, params: T.any(::Stripe::V2::Reporting::ReportRunRetrieveParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::V2::Reporting::ReportRun) + } + def retrieve(id, params = {}, opts = {}); end + end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/services/v2/reporting/report_service.rbi b/rbi/stripe/services/v2/reporting/report_service.rbi new file mode 100644 index 00000000..4aad0331 --- /dev/null +++ b/rbi/stripe/services/v2/reporting/report_service.rbi @@ -0,0 +1,19 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module V2 + module Reporting + class ReportService < StripeService + # Retrieves metadata about a specific `Report` template, including its name, description, + # and the parameters it accepts. It's useful for understanding the capabilities and + # requirements of a particular `Report` before requesting a `ReportRun`. + sig { + params(id: String, params: T.any(::Stripe::V2::Reporting::ReportRetrieveParams, T::Hash[T.untyped, T.untyped]), opts: T.untyped).returns(::Stripe::V2::Reporting::Report) + } + def retrieve(id, params = {}, opts = {}); end + end + end + end +end \ No newline at end of file diff --git a/rbi/stripe/services/v2/reporting_service.rbi b/rbi/stripe/services/v2/reporting_service.rbi new file mode 100644 index 00000000..aa6b54ad --- /dev/null +++ b/rbi/stripe/services/v2/reporting_service.rbi @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec +# frozen_string_literal: true + +# typed: true +module Stripe + module V2 + class ReportingService < StripeService + attr_reader :reports + attr_reader :report_runs + end + end +end \ No newline at end of file diff --git a/rbi/stripe/services/v2_services.rbi b/rbi/stripe/services/v2_services.rbi index 04d8d14d..c2c32e6f 100644 --- a/rbi/stripe/services/v2_services.rbi +++ b/rbi/stripe/services/v2_services.rbi @@ -8,6 +8,7 @@ module Stripe attr_reader :core attr_reader :money_management attr_reader :payments + attr_reader :reporting attr_reader :tax attr_reader :test_helpers end diff --git a/test/stripe/generated_examples_test.rb b/test/stripe/generated_examples_test.rb index 05eb5c78..36b019e1 100644 --- a/test/stripe/generated_examples_test.rb +++ b/test/stripe/generated_examples_test.rb @@ -985,7 +985,7 @@ module Stripe end should "Test core events get (service)" do stub_request(:get, "#{Stripe::DEFAULT_API_BASE}/v2/core/events/ll_123").to_return( - body: '{"changes":{"key":{}},"context":"context","created":"1970-01-12T21:42:34.472Z","id":"obj_123","object":"v2.core.event","reason":{"type":"request","request":{"id":"obj_123","idempotency_key":"idempotency_key"}},"type":"type","v1_event_id":"v1_event_id","livemode":true}' + body: '{"changes":{"int_key":123,"string_key":"value","boolean_key":true,"object_key":{"object_int_key":123,"object_string_key":"value","object_boolean_key":true},"array_key":[1,2,3]},"context":"context","created":"1970-01-12T21:42:34.472Z","id":"obj_123","object":"v2.core.event","reason":{"type":"request","request":{"id":"obj_123","idempotency_key":"idempotency_key"}},"type":"type","v1_event_id":"v1_event_id","livemode":true}' ) client = Stripe::StripeClient.new("sk_test_123") @@ -9837,6 +9837,49 @@ module Stripe ) assert_requested :post, "#{Stripe::DEFAULT_API_BASE}/v2/payments/off_session_payments/id_123/capture" end + should "Test v2 reporting report get (service)" do + stub_request(:get, "#{Stripe::DEFAULT_API_BASE}/v2/reporting/reports/id_123").to_return( + body: '{"id":"obj_123","name":"name","object":"v2.reporting.report","parameters":{"key":{"description":"description","required":true,"type":"string"}},"livemode":true}', + status: 200 + ) + client = Stripe::StripeClient.new("sk_test_123") + + report = client.v2.reporting.reports.retrieve("id_123") + assert_requested :get, "#{Stripe::DEFAULT_API_BASE}/v2/reporting/reports/id_123" + end + should "Test v2 reporting report run post (service)" do + stub_request(:post, "#{Stripe::DEFAULT_API_BASE}/v2/reporting/report_runs").to_return( + body: '{"created":"1970-01-12T21:42:34.472Z","id":"obj_123","object":"v2.reporting.report_run","report":"report","report_name":"report_name","report_parameters":{"int_key":123,"string_key":"value","boolean_key":true,"object_key":{"object_int_key":123,"object_string_key":"value","object_boolean_key":true},"array_key":[1,2,3]},"status":"failed","status_details":{"key":{}},"livemode":true}', + status: 200 + ) + client = Stripe::StripeClient.new("sk_test_123") + + report_run = client.v2.reporting.report_runs.create({ + report: "report", + report_parameters: { + int_key: 123, + string_key: "value", + boolean_key: true, + object_key: { + object_int_key: 123, + object_string_key: "value", + object_boolean_key: true, + }, + array_key: [1, 2, 3], + }, + }) + assert_requested :post, "#{Stripe::DEFAULT_API_BASE}/v2/reporting/report_runs" + end + should "Test v2 reporting report run get (service)" do + stub_request(:get, "#{Stripe::DEFAULT_API_BASE}/v2/reporting/report_runs/id_123").to_return( + body: '{"created":"1970-01-12T21:42:34.472Z","id":"obj_123","object":"v2.reporting.report_run","report":"report","report_name":"report_name","report_parameters":{"int_key":123,"string_key":"value","boolean_key":true,"object_key":{"object_int_key":123,"object_string_key":"value","object_boolean_key":true},"array_key":[1,2,3]},"status":"failed","status_details":{"key":{}},"livemode":true}', + status: 200 + ) + client = Stripe::StripeClient.new("sk_test_123") + + report_run = client.v2.reporting.report_runs.retrieve("id_123") + assert_requested :get, "#{Stripe::DEFAULT_API_BASE}/v2/reporting/report_runs/id_123" + end should "Test v2 tax automatic rule post (service)" do stub_request(:post, "#{Stripe::DEFAULT_API_BASE}/v2/tax/automatic_rules").to_return( body: '{"billable_item":"billable_item","created":"1970-01-12T21:42:34.472Z","id":"obj_123","object":"v2.tax.automatic_rule","status":"active","tax_code":"tax_code","livemode":true}',