Class: Telnyx::Resources::SubNumberOrdersReport

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/sub_number_orders_report.rb

Overview

Number orders

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SubNumberOrdersReport

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

Parameters:



85
86
87
# File 'lib/telnyx/resources/sub_number_orders_report.rb', line 85

def initialize(client:)
  @client = client
end

Instance Method Details

#create(country_code: nil, created_at_gt: nil, created_at_lt: nil, customer_reference: nil, order_request_id: nil, status: nil, request_options: {}) ⇒ Telnyx::Models::SubNumberOrdersReportCreateResponse

Create a CSV report for sub number orders. The report will be generated asynchronously and can be downloaded once complete.

Parameters:

  • country_code (String)

    Filter by country code

  • created_at_gt (Time)

    Filter for orders created after this date

  • created_at_lt (Time)

    Filter for orders created before this date

  • customer_reference (String)

    Filter by customer reference

  • order_request_id (String)

    Filter by specific order request ID

  • status (Symbol, Telnyx::Models::SubNumberOrdersReportCreateParams::Status)

    Filter by order status

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



29
30
31
32
33
34
35
36
37
38
# File 'lib/telnyx/resources/sub_number_orders_report.rb', line 29

def create(params = {})
  parsed, options = Telnyx::SubNumberOrdersReportCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "sub_number_orders_report",
    body: parsed,
    model: Telnyx::Models::SubNumberOrdersReportCreateResponse,
    options: options
  )
end

#download(report_id, request_options: {}) ⇒ StringIO

Download the CSV file for a completed sub number orders report. The report status must be ‘success’ before the file can be downloaded.

Parameters:

  • report_id (String)

    The unique identifier of the sub number orders report

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (StringIO)

See Also:



72
73
74
75
76
77
78
79
80
# File 'lib/telnyx/resources/sub_number_orders_report.rb', line 72

def download(report_id, params = {})
  @client.request(
    method: :get,
    path: ["sub_number_orders_report/%1$s/download", report_id],
    headers: {"accept" => "text/csv"},
    model: Telnyx::Internal::Type::FileInput,
    options: params[:request_options]
  )
end

#retrieve(report_id, request_options: {}) ⇒ Telnyx::Models::SubNumberOrdersReportRetrieveResponse

Get the status and details of a sub number orders report.

Parameters:

  • report_id (String)

    The unique identifier of the sub number orders report

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



51
52
53
54
55
56
57
58
# File 'lib/telnyx/resources/sub_number_orders_report.rb', line 51

def retrieve(report_id, params = {})
  @client.request(
    method: :get,
    path: ["sub_number_orders_report/%1$s", report_id],
    model: Telnyx::Models::SubNumberOrdersReportRetrieveResponse,
    options: params[:request_options]
  )
end