Class: Telnyx::Resources::Faxes

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

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:



160
161
162
163
# File 'lib/telnyx/resources/faxes.rb', line 160

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.

Supported file formats:

  • PDF (application/pdf)
  • TIFF (application/tiff, image/tiff)
  • JPEG (image/jpeg)
  • PNG (image/png)
  • Microsoft Word .doc (application/msword)
  • Microsoft Word .docx (application/vnd.openxmlformats-officedocument.wordprocessingml.document)
  • Rich Text Format .rtf (application/rtf)
  • Plain text .txt (text/plain)

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 fax document. Supported formats: PDF, TIFF, JPE

  • 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::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:



75
76
77
78
79
80
81
82
83
84
# File 'lib/telnyx/resources/faxes.rb', line 75

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)
  • request_options: (Telnyx::request_opts)

Returns:

  • (nil)

See Also:



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

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:



124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/telnyx/resources/faxes.rb', line 124

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:



97
98
99
100
101
102
103
104
# File 'lib/telnyx/resources/faxes.rb', line 97

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