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.

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.

Defined Under Namespace

Classes: 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

#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #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.



50
51
52
# File 'lib/stripe/resources/reporting/report_run.rb', line 50

def created
  @created
end

#errorObject (readonly)

If something should go wrong during the run, a message about the failure (populated when status=failed).



53
54
55
# File 'lib/stripe/resources/reporting/report_run.rb', line 53

def error
  @error
end

#idObject (readonly)

Unique identifier for the object.



55
56
57
# File 'lib/stripe/resources/reporting/report_run.rb', line 55

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.



57
58
59
# File 'lib/stripe/resources/reporting/report_run.rb', line 57

def livemode
  @livemode
end

#objectObject (readonly)

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



59
60
61
# File 'lib/stripe/resources/reporting/report_run.rb', line 59

def object
  @object
end

#parametersObject (readonly)

Attribute for field parameters



61
62
63
# File 'lib/stripe/resources/reporting/report_run.rb', line 61

def parameters
  @parameters
end

#report_typeObject (readonly)

The ID of the report type to run, such as "balance.summary.1".



63
64
65
# File 'lib/stripe/resources/reporting/report_run.rb', line 63

def report_type
  @report_type
end

#resultObject (readonly)

The file object representing the result of the report run (populated when status=succeeded).



66
67
68
# File 'lib/stripe/resources/reporting/report_run.rb', line 66

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.



70
71
72
# File 'lib/stripe/resources/reporting/report_run.rb', line 70

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.



73
74
75
# File 'lib/stripe/resources/reporting/report_run.rb', line 73

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.)



76
77
78
79
80
81
82
83
# File 'lib/stripe/resources/reporting/report_run.rb', line 76

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

.field_remappingsObject



99
100
101
# File 'lib/stripe/resources/reporting/report_run.rb', line 99

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



95
96
97
# File 'lib/stripe/resources/reporting/report_run.rb', line 95

def self.inner_class_types
  @inner_class_types = { parameters: Parameters }
end

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

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



86
87
88
89
90
91
92
93
# File 'lib/stripe/resources/reporting/report_run.rb', line 86

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