class InterFAX::Outbound

Attributes

delivery[W]

Public Class Methods

new(client) click to toggle source
# File lib/interfax/outbound.rb, line 5
def initialize client
  @client = client
end

Public Instance Methods

all(params = {}) click to toggle source
# File lib/interfax/outbound.rb, line 17
def all params = {}
  valid_keys = [:limit, :lastId, :sortOrder, :userId]
  @client.get('/outbound/faxes', params, valid_keys).map do |fax|
    fax[:client] = @client
    InterFAX::Outbound::Fax.new(fax)
  end
end
cancel(fax_id) click to toggle source
# File lib/interfax/outbound.rb, line 45
def cancel fax_id
  @client.post("/outbound/faxes/#{fax_id}/cancel")
  true
end
completed(*ids) click to toggle source
# File lib/interfax/outbound.rb, line 25
def completed *ids
  params = { ids: [ids].flatten }
  valid_keys = [:ids]
  @client.get('/outbound/faxes/completed', params, valid_keys).map do |fax|
    fax[:client] = @client
    InterFAX::Outbound::Fax.new(fax)
  end
end
deliver(params = {}) click to toggle source
# File lib/interfax/outbound.rb, line 13
def deliver params = {}
  delivery.deliver(params)
end
delivery() click to toggle source
# File lib/interfax/outbound.rb, line 9
def delivery
  @delivery ||= InterFAX::Outbound::Delivery.new(@client)
end
find(id) click to toggle source
# File lib/interfax/outbound.rb, line 34
def find id
  fax = @client.get("/outbound/faxes/#{id}")
  fax[:client] = @client
  InterFAX::Outbound::Fax.new(fax)
end
image(fax_id) click to toggle source
# File lib/interfax/outbound.rb, line 40
def image fax_id
  data, mimeType = @client.get("/outbound/faxes/#{fax_id}/image")
  InterFAX::Image.new(data: data, client: @client, mimeType: mimeType)
end