Class: InterFAX::Inbound
- Inherits:
-
Object
- Object
- InterFAX::Inbound
- Defined in:
- lib/interfax/inbound.rb
Defined Under Namespace
Classes: Fax
Instance Method Summary collapse
- #all(params = {}) ⇒ Object
- #emails(fax_id) ⇒ Object
- #find(id) ⇒ Object
- #image(fax_id) ⇒ Object
-
#initialize(client) ⇒ Inbound
constructor
A new instance of Inbound.
- #mark(fax_id, options = {}) ⇒ Object
- #resend(fax_id, options = {}) ⇒ Object
Constructor Details
#initialize(client) ⇒ Inbound
Returns a new instance of Inbound.
2 3 4 |
# File 'lib/interfax/inbound.rb', line 2 def initialize client @client = client end |
Instance Method Details
#all(params = {}) ⇒ Object
6 7 8 9 10 11 12 |
# 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) ⇒ Object
39 40 41 42 43 44 |
# 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) ⇒ Object
14 15 16 17 18 |
# 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) ⇒ Object
20 21 22 23 |
# 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 = {}) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/interfax/inbound.rb', line 25 def mark fax_id, = {} read = .fetch(:read, true) valid_keys = [:unread] @client.post("/inbound/faxes/#{fax_id}/mark", {unread: !read}, valid_keys) true end |
#resend(fax_id, options = {}) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/interfax/inbound.rb', line 32 def resend fax_id, = {} = .delete_if {|k,v| k != :email } valid_keys = [:email] @client.post("/inbound/faxes/#{fax_id}/resend", , valid_keys) true end |