Class: Telnyx::Resources::Faxes

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/faxes.rb,
lib/telnyx/resources/faxes/actions.rb

Overview

Programmable fax command operations

Defined Under Namespace

Classes: Actions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Faxes

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

Parameters:



148
149
150
151
# File 'lib/telnyx/resources/faxes.rb', line 148

def initialize(client:)
  @client = client
  @actions = Telnyx::Resources::Faxes::Actions.new(client: client)
end

Instance Attribute Details

#actionsTelnyx::Resources::Faxes::Actions (readonly)

Programmable fax command operations



9
10
11
# File 'lib/telnyx/resources/faxes.rb', line 9

def actions
  @actions
end

Instance Method Details

#create(connection_id:, from:, to:, black_threshold: nil, client_state: nil, from_display_name: nil, media_name: nil, media_url: nil, monochrome: nil, preview_format: nil, quality: nil, store_media: nil, store_preview: nil, t38_enabled: nil, webhook_url: nil, request_options: {}) ⇒ Telnyx::Models::FaxCreateResponse

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

Send a fax. Files have size limits and page count limit validations. If a file is bigger than 50MB or has more than 350 pages it will fail with ‘file_size_limit_exceeded` and `page_count_limit_exceeded` respectively.

**Expected Webhooks:**

  • ‘fax.queued`

  • ‘fax.media.processed`

  • ‘fax.sending.started`

  • ‘fax.delivered`

  • ‘fax.failed`

Parameters:

  • connection_id (String)

    The connection ID to send the fax with.

  • from (String)

    The phone number, in E.164 format, the fax will be sent from.

  • to (String)

    The phone number, in E.164 format, the fax will be sent to or SIP URI

  • black_threshold (Integer)

    The black threshold percentage for monochrome faxes. Only applicable if ‘monochr

  • client_state (String)

    Use this field to add state to every subsequent webhook. It must be a valid Base

  • from_display_name (String)

    The ‘from_display_name` string to be used as the caller id name (SIP From Displa

  • media_name (String)

    The media_name used for the fax’s media. Must point to a file previously uploade

  • media_url (String)

    The URL (or list of URLs) to the PDF used for the fax’s media. media_url and med

  • monochrome (Boolean)

    The flag to enable monochrome, true black and white fax results.

  • preview_format (Symbol, Telnyx::Models::FaxCreateParams::PreviewFormat)

    The format for the preview file in case the ‘store_preview` is `true`.

  • quality (Symbol, Telnyx::Models::FaxCreateParams::Quality)

    The quality of the fax. The ‘ultra` settings provides the highest quality availa

  • store_media (Boolean)

    Should fax media be stored on temporary URL. It does not support media_name, the

  • store_preview (Boolean)

    Should fax preview be stored on temporary URL.

  • t38_enabled (Boolean)

    The flag to disable the T.38 protocol.

  • webhook_url (String)

    Use this field to override the URL to which Telnyx will send subsequent webhooks

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

Returns:

See Also:



63
64
65
66
67
68
69
70
71
72
# File 'lib/telnyx/resources/faxes.rb', line 63

def create(params)
  parsed, options = Telnyx::FaxCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "faxes",
    body: parsed,
    model: Telnyx::Models::FaxCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ nil

Delete a fax

Parameters:

  • id (String)

    The unique identifier of a fax.

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

Returns:

  • (nil)

See Also:



136
137
138
139
140
141
142
143
# File 'lib/telnyx/resources/faxes.rb', line 136

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["faxes/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end

#list(filter: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::Fax>

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

View a list of faxes

Parameters:

Returns:

See Also:



112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/telnyx/resources/faxes.rb', line 112

def list(params = {})
  parsed, options = Telnyx::FaxListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "faxes",
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::Fax,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Telnyx::Models::FaxRetrieveResponse

View a fax

Parameters:

  • id (String)

    The unique identifier of a fax.

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

Returns:

See Also:



85
86
87
88
89
90
91
92
# File 'lib/telnyx/resources/faxes.rb', line 85

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