class InterFAX::Inbound

Public Class Methods

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

Public Instance Methods

all(params = {}) click to toggle source
# File lib/interfax/inbound.rb, line 6
def all params = {}
  valid_keys = [:unreadOnly, :limit, :lastId, :allUsers]
  @client.get('/inbound/faxes', params, valid_keys).map do |fax|
    fax[:client] = @client
    InterFAX::Inbound::Fax.new(fax)
  end
end
emails(fax_id) click to toggle source
# File lib/interfax/inbound.rb, line 39
def emails fax_id
  @client.get("/inbound/faxes/#{fax_id}/emails").map do |email|
    email[:client] = @client
    InterFAX::ForwardingEmail.new(email)
  end
end
find(id) click to toggle source
# File lib/interfax/inbound.rb, line 14
def find id
  fax = @client.get("/inbound/faxes/#{id}")
  fax[:client] = @client
  InterFAX::Inbound::Fax.new(fax)
end
image(fax_id) click to toggle source
# File lib/interfax/inbound.rb, line 20
def image fax_id
  data, mimeType = @client.get("/inbound/faxes/#{fax_id}/image")
  InterFAX::Image.new(data: data, client: @client, mimeType: mimeType)
end
mark(fax_id, options = {}) click to toggle source
# File lib/interfax/inbound.rb, line 25
def mark fax_id, options = {}
  read = options.fetch(:read, true)
  valid_keys = [:unread]
  @client.post("/inbound/faxes/#{fax_id}/mark", {unread: !read}, valid_keys)
  true
end
resend(fax_id, options = {}) click to toggle source
# File lib/interfax/inbound.rb, line 32
def resend fax_id, options = {}
  options = options.delete_if {|k,v| k != :email }
  valid_keys = [:email]
  @client.post("/inbound/faxes/#{fax_id}/resend", options, valid_keys)
  true
end