Class: Phaxio::Resources::Fax

Inherits:
Phaxio::Resource show all
Defined in:
lib/phaxio/resources/fax.rb

Overview

Provides functionality for viewing and managing faxes.

Defined Under Namespace

Classes: Reference

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Phaxio::Resource

response_collection, response_record

Instance Attribute Details

#caller_idString


# File 'lib/phaxio/resources/fax.rb', line 27

#completed_atTime


71
# File 'lib/phaxio/resources/fax.rb', line 71

has_time_attributes %w[created_at completed_at]

#costInteger


# File 'lib/phaxio/resources/fax.rb', line 17

#created_atTime


# File 'lib/phaxio/resources/fax.rb', line 63

#direction"sent" | "received"


# File 'lib/phaxio/resources/fax.rb', line 11

#error_idInteger


# File 'lib/phaxio/resources/fax.rb', line 50

#error_messageString


# File 'lib/phaxio/resources/fax.rb', line 46

#error_typeString


# File 'lib/phaxio/resources/fax.rb', line 41

#from_numberString


# File 'lib/phaxio/resources/fax.rb', line 32

#idInteger


# File 'lib/phaxio/resources/fax.rb', line 8

#is_testtrue | false


# File 'lib/phaxio/resources/fax.rb', line 23

#num_pagesInteger


# File 'lib/phaxio/resources/fax.rb', line 14

#recipientsPhaxio::Resource::Collection<Phaxio::Resources::FaxRecipient>


77
# File 'lib/phaxio/resources/fax.rb', line 77

has_collection_attributes({recipients: FaxRecipient})

#statusString


# File 'lib/phaxio/resources/fax.rb', line 20

#tagsHash


58
59
60
61
# File 'lib/phaxio/resources/fax.rb', line 58

has_normal_attributes %w[
  id direction num_pages cost status is_test caller_id from_number
  to_number error_type error_message error_id tags
]

#to_numberString


# File 'lib/phaxio/resources/fax.rb', line 36

Class Method Details

.cancel(id, params = {}) ⇒ Phaxio::Resources::Fax::Reference

Cancel a fax.


195
196
197
198
# File 'lib/phaxio/resources/fax.rb', line 195

def cancel id, params = {}
  response = Client.request :post, cancel_fax_endpoint(id), params
  response_reference response
end

.create(params = {}) ⇒ Phaxio::Resources::Fax Also known as: send

Create and send a fax.


164
165
166
167
# File 'lib/phaxio/resources/fax.rb', line 164

def create params = {}
  response = Client.request :post, faxes_endpoint, params
  response_reference response
end

.delete(id, params = {}) ⇒ true

Delete a fax. May only be used with test API credentials.


225
226
227
228
# File 'lib/phaxio/resources/fax.rb', line 225

def delete id, params = {}
  Client.request :delete, fax_endpoint(id), params
  true
end

.delete_file(id, params = {}) ⇒ true

Delete fax files.


239
240
241
242
# File 'lib/phaxio/resources/fax.rb', line 239

def delete_file id, params = {}
  Client.request :delete, fax_file_endpoint(id), params
  true
end

.file(id, params = {}) ⇒ File

Get fax content file or thumbnail.


256
257
258
# File 'lib/phaxio/resources/fax.rb', line 256

def file id, params = {}
  Client.request :get, fax_file_endpoint(id), params
end

.get(id, params = {}) ⇒ Phaxio::Resource::Fax Also known as: retrieve, find

Get fax info.


178
179
180
181
# File 'lib/phaxio/resources/fax.rb', line 178

def get id, params = {}
  response = Client.request :get, fax_endpoint(id.to_i), params
  response_record response
end

.list(params = {}) ⇒ Phaxio::Resource::Collection<Phaxio::Resources::Fax>

Note:

This action accepts paging parameters:

  • per_page [Integer] - The maximum number of results to return per call (i.e. “page”). Max 1000.

  • page [Integer] - The page number to return for the request. 1-based.

List faxes in date range.


124
125
126
127
# File 'lib/phaxio/resources/fax.rb', line 124

def list params = {}
  response = Client.request :get, faxes_endpoint, params
  response_collection response
end

.resend(id, params = {}) ⇒ Phaxio::Resources::Fax::Reference

Resend a fax.


211
212
213
214
# File 'lib/phaxio/resources/fax.rb', line 211

def resend id, params = {}
  response = Client.request :post, resend_fax_endpoint(id), params
  response_reference response
end

.test_receive(params = {}) ⇒ true

Test receiving a fax. May only be used with test API credentials.


273
274
275
276
# File 'lib/phaxio/resources/fax.rb', line 273

def test_receive params = {}
  Client.request :post, faxes_endpoint, test_receive_params(params)
  true
end