Class: Telnyx::Resources::TermsOfService::Agreements

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

Overview

Accept and review the Branded Calling and Phone Number Reputation terms of service.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Agreements

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

Parameters:



73
74
75
# File 'lib/telnyx/resources/terms_of_service/agreements.rb', line 73

def initialize(client:)
  @client = client
end

Instance Method Details

#list(page_number: nil, page_size: nil, product_type: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::TermsOfService::AgreementListResponse>

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

Returns the Terms of Service agreements the authenticated user has on file. Each entry records the version agreed to and when. Most users only have one agreement per product, but if the ToS is updated and the user re-agrees a new entry is added.

Results are paginated with the standard ‘page` / `page` parameters; the response uses the standard `meta` JSON:API envelope.

By default this returns agreements for all products the user has agreed to. Pass the ‘product_type` query parameter to scope the result to a single product.

Parameters:

  • page_number (Integer)

    1-based page number. Out-of-range values return an empty page with correct meta.

  • page_size (Integer)

    Items per page. Maximum 250; values above are clamped to 250.

  • product_type (Symbol, Telnyx::Models::TermsOfService::AgreementListParams::ProductType)

    Optional filter. Omit to list the user’s agreements for every product (brand

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

Returns:

See Also:



57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/telnyx/resources/terms_of_service/agreements.rb', line 57

def list(params = {})
  parsed, options = Telnyx::TermsOfService::AgreementListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "terms_of_service/agreements",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Models::TermsOfService::AgreementListResponse,
    options: options
  )
end

#retrieve(agreement_id, request_options: {}) ⇒ Telnyx::Models::TermsOfService::AgreementRetrieveResponse

Retrieve a single ToS agreement record. Returns ‘404` if the agreement does not exist or does not belong to the authenticated user.

Parameters:

  • agreement_id (String)

    Unique identifier of the agreement.

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

Returns:

See Also:



21
22
23
24
25
26
27
28
# File 'lib/telnyx/resources/terms_of_service/agreements.rb', line 21

def retrieve(agreement_id, params = {})
  @client.request(
    method: :get,
    path: ["terms_of_service/agreements/%1$s", agreement_id],
    model: Telnyx::Models::TermsOfService::AgreementRetrieveResponse,
    options: params[:request_options]
  )
end