Class: MethodRuby::Resources::Reports::Download

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

Overview

Downloadable reports

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Download

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

Parameters:



39
40
41
# File 'lib/method_ruby/resources/reports/download.rb', line 39

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(report_id, method_version:, request_options: {}) ⇒ StringIO

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

Returns the completed report as a CSV file attachment.

Parameters:

Returns:

  • (StringIO)

See Also:



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/method_ruby/resources/reports/download.rb', line 24

def retrieve(report_id, params)
  parsed, options = MethodRuby::Reports::DownloadRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["reports/%1$s/download", report_id],
    headers: {"accept" => "text/csv", **parsed}.transform_keys(method_version: "method-version"),
    model: MethodRuby::Internal::Type::FileInput,
    security: {secret_key: true},
    options: options
  )
end