Class: Stripe::Reporting::ReportRun

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List
Defined in:
lib/stripe/resources/reporting/report_run.rb

Overview

The Report Run object represents an instance of a report type 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 a file where you can retrieve your results. For an overview, see [API Access to Reports](stripe.com/docs/reporting/statements/api).

Note that certain report types can only be run based on your live-mode data (not test-mode data), and will error when queried without a [live-mode API key](stripe.com/docs/keys#test-live-modes).

Defined Under Namespace

Classes: CreateParams, ListParams, Parameters

Constant Summary collapse

OBJECT_NAME =
"reporting.report_run"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



139
140
141
# File 'lib/stripe/resources/reporting/report_run.rb', line 139

def created
  @created
end

#errorObject (readonly)

If something should go wrong during the run, a message about the failure (populated when

`status=failed`).


142
143
144
# File 'lib/stripe/resources/reporting/report_run.rb', line 142

def error
  @error
end

#idObject (readonly)

Unique identifier for the object.



144
145
146
# File 'lib/stripe/resources/reporting/report_run.rb', line 144

def id
  @id
end

#livemodeObject (readonly)

‘true` if the report is run on live mode data and `false` if it is run on test mode data.



146
147
148
# File 'lib/stripe/resources/reporting/report_run.rb', line 146

def livemode
  @livemode
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



148
149
150
# File 'lib/stripe/resources/reporting/report_run.rb', line 148

def object
  @object
end

#parametersObject (readonly)

Attribute for field parameters



150
151
152
# File 'lib/stripe/resources/reporting/report_run.rb', line 150

def parameters
  @parameters
end

#report_typeObject (readonly)

The ID of the [report type](stripe.com/docs/reports/report-types) to run, such as ‘“balance.summary.1”`.



152
153
154
# File 'lib/stripe/resources/reporting/report_run.rb', line 152

def report_type
  @report_type
end

#resultObject (readonly)

The file object representing the result of the report run (populated when

`status=succeeded`).


155
156
157
# File 'lib/stripe/resources/reporting/report_run.rb', line 155

def result
  @result
end

#statusObject (readonly)

Status of this report run. This will be ‘pending` when the run is initially created.

When the run finishes, this will be set to `succeeded` and the `result` field will be populated.
Rarely, we may encounter an error, at which point this will be set to `failed` and the `error` field will be populated.


159
160
161
# File 'lib/stripe/resources/reporting/report_run.rb', line 159

def status
  @status
end

#succeeded_atObject (readonly)

Timestamp at which this run successfully finished (populated when

`status=succeeded`). Measured in seconds since the Unix epoch.


162
163
164
# File 'lib/stripe/resources/reporting/report_run.rb', line 162

def succeeded_at
  @succeeded_at
end

Class Method Details

.create(params = {}, opts = {}) ⇒ Object

Creates a new object and begin running the report. (Certain report types require a [live-mode API key](stripe.com/docs/keys#test-live-modes).)



165
166
167
168
169
170
171
172
# File 'lib/stripe/resources/reporting/report_run.rb', line 165

def self.create(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "/v1/reporting/report_runs",
    params: params,
    opts: opts
  )
end

.list(params = {}, opts = {}) ⇒ Object

Returns a list of Report Runs, with the most recent appearing first.



175
176
177
178
179
180
181
182
# File 'lib/stripe/resources/reporting/report_run.rb', line 175

def self.list(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/reporting/report_runs",
    params: params,
    opts: opts
  )
end

.object_nameObject



19
20
21
# File 'lib/stripe/resources/reporting/report_run.rb', line 19

def self.object_name
  "reporting.report_run"
end