Class: MethodRuby::Resources::Reports

Inherits:
Object
  • Object
show all
Defined in:
lib/method_ruby/resources/reports.rb,
lib/method_ruby/resources/reports/download.rb

Overview

Downloadable reports

Defined Under Namespace

Classes: Download

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Reports

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Reports.

Parameters:



76
77
78
79
# File 'lib/method_ruby/resources/reports.rb', line 76

def initialize(client:)
  @client = client
  @download = MethodRuby::Resources::Reports::Download.new(client: client)
end

Instance Attribute Details

#downloadMethodRuby::Resources::Reports::Download (readonly)

Downloadable reports



9
10
11
# File 'lib/method_ruby/resources/reports.rb', line 9

def download
  @download
end

Instance Method Details

#create(type:, method_version:, idempotency_key: nil, request_options: {}) ⇒ MethodRuby::Models::ReportCreateResponse

Some parameter documentations has been truncated, see Models::ReportCreateParams for more details.

Creates a new report of the specified type. The report will be generated asynchronously and can be downloaded once its status is ‘completed`.

Parameters:

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/method_ruby/resources/reports.rb', line 30

def create(params)
  parsed, options = MethodRuby::ReportCreateParams.dump_request(params)
  header_params = {method_version: "method-version", idempotency_key: "idempotency-key"}
  @client.request(
    method: :post,
    path: "reports",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: MethodRuby::Models::ReportCreateResponse,
    security: {secret_key: true},
    options: options
  )
end

#retrieve(report_id, method_version:, request_options: {}) ⇒ MethodRuby::Models::ReportRetrieveResponse

Some parameter documentations has been truncated, see Models::ReportRetrieveParams for more details.

Returns a single report by its identifier. Use this to check the status of a report before downloading.

Parameters:

Returns:

See Also:



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/method_ruby/resources/reports.rb', line 61

def retrieve(report_id, params)
  parsed, options = MethodRuby::ReportRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["reports/%1$s", report_id],
    headers: parsed.transform_keys(method_version: "method-version"),
    model: MethodRuby::Models::ReportRetrieveResponse,
    security: {secret_key: true},
    options: options
  )
end