Class: Telnyx::Resources::Legacy::Reporting::UsageReports::Messaging

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/legacy/reporting/usage_reports/messaging.rb

Overview

Messaging usage reports

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Messaging

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

Parameters:



110
111
112
# File 'lib/telnyx/resources/legacy/reporting/usage_reports/messaging.rb', line 110

def initialize(client:)
  @client = client
end

Instance Method Details

#create(aggregation_type:, end_time: nil, managed_accounts: nil, profiles: nil, select_all_managed_accounts: nil, start_time: nil, request_options: {}) ⇒ Telnyx::Models::Legacy::Reporting::UsageReports::MessagingCreateResponse

Creates a new legacy usage V2 MDR report request with the specified filters

Parameters:

  • aggregation_type (Integer)

    Aggregation type: No aggregation = 0, By Messaging Profile = 1, By Tags = 2

  • end_time (Time)
  • managed_accounts (Array<String>)

    List of managed accounts to include

  • profiles (Array<String>)

    List of messaging profile IDs to filter by

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

Returns:

See Also:



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/telnyx/resources/legacy/reporting/usage_reports/messaging.rb', line 31

def create(params)
  parsed, options = Telnyx::Legacy::Reporting::UsageReports::MessagingCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "legacy/reporting/usage_reports/messaging",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: Telnyx::Models::Legacy::Reporting::UsageReports::MessagingCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Telnyx::Models::Legacy::Reporting::UsageReports::MessagingDeleteResponse

Deletes a specific V2 legacy usage MDR report request by ID



98
99
100
101
102
103
104
105
# File 'lib/telnyx/resources/legacy/reporting/usage_reports/messaging.rb', line 98

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["legacy/reporting/usage_reports/messaging/%1$s", id],
    model: Telnyx::Models::Legacy::Reporting::UsageReports::MessagingDeleteResponse,
    options: params[:request_options]
  )
end

#list(page: nil, per_page: nil, request_options: {}) ⇒ Telnyx::Internal::PerPagePagination<Telnyx::Models::Legacy::Reporting::UsageReports::MdrUsageReportResponseLegacy>

Fetch all previous requests for MDR usage reports.

Parameters:

  • page (Integer)

    Page number

  • per_page (Integer)

    Size of the page

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

Returns:

See Also:



75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/telnyx/resources/legacy/reporting/usage_reports/messaging.rb', line 75

def list(params = {})
  parsed, options = Telnyx::Legacy::Reporting::UsageReports::MessagingListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "legacy/reporting/usage_reports/messaging",
    query: query,
    page: Telnyx::Internal::PerPagePagination,
    model: Telnyx::Legacy::Reporting::UsageReports::MdrUsageReportResponseLegacy,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::Legacy::Reporting::UsageReports::MessagingRetrieveResponse

Fetch single MDR usage report by id.



53
54
55
56
57
58
59
60
# File 'lib/telnyx/resources/legacy/reporting/usage_reports/messaging.rb', line 53

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["legacy/reporting/usage_reports/messaging/%1$s", id],
    model: Telnyx::Models::Legacy::Reporting::UsageReports::MessagingRetrieveResponse,
    options: params[:request_options]
  )
end