faxage 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/faxage.rb +25 -1
- data/lib/faxage/information_gathering.rb +0 -12
- data/lib/faxage/send_fax.rb +26 -1
- data/lib/faxage/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4b8bb8101b2ee151ff6dd04b9013e43b9c8c08e2c5b6df850e2daf6ec877e4f
|
4
|
+
data.tar.gz: 8720b2c3b0f7f544d1a9c227266e81533c6ccba388f1a4186c6ef965b2ec3cbe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a9ce2d548767ab2f9f36d44b2d25013ae7e273d8dc57fab11c490f9c00736aba98d7057135c89dc5fc766141b5c5ad575fcd3b6760aaeb982c08f3a6f392d5ed
|
7
|
+
data.tar.gz: 7c82e22e5c0e341cfc78bd7deeed0951828cdb3d2812c2892cea2dde3bb9405924626b1486e6b023edc1c667763c522a9030373aaf59bf3534bbb94b789ee94a
|
data/Gemfile.lock
CHANGED
data/lib/faxage.rb
CHANGED
@@ -1,3 +1,27 @@
|
|
1
1
|
require "faxage/version"
|
2
2
|
require "faxage/send_fax"
|
3
|
-
require "faxage/information_gathering"
|
3
|
+
require "faxage/information_gathering"
|
4
|
+
|
5
|
+
class LoginError < StandardError
|
6
|
+
end
|
7
|
+
|
8
|
+
class FaxageInternalError < StandardError
|
9
|
+
end
|
10
|
+
|
11
|
+
class UnknownOperationError < StandardError
|
12
|
+
end
|
13
|
+
|
14
|
+
class NoResponseError < StandardError
|
15
|
+
end
|
16
|
+
|
17
|
+
class InvalidJobIdError < StandardError
|
18
|
+
end
|
19
|
+
|
20
|
+
class InvalidFaxNoError < StandardError
|
21
|
+
end
|
22
|
+
|
23
|
+
class NoFilesError < StandardError
|
24
|
+
end
|
25
|
+
|
26
|
+
class BlockedNumberError < StandardError
|
27
|
+
end
|
@@ -1,18 +1,6 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
|
3
3
|
module Faxage
|
4
|
-
class LoginError < StandardError
|
5
|
-
end
|
6
|
-
|
7
|
-
class FaxageInternalError < StandardError
|
8
|
-
end
|
9
|
-
|
10
|
-
class UnknownOperationError < StandardError
|
11
|
-
end
|
12
|
-
|
13
|
-
class NoResponseError < StandardError
|
14
|
-
end
|
15
|
-
|
16
4
|
class InformationGathering
|
17
5
|
include HTTParty
|
18
6
|
base_uri "https://api.faxage.com"
|
data/lib/faxage/send_fax.rb
CHANGED
@@ -52,9 +52,34 @@ module Faxage
|
|
52
52
|
faxfiledata: faxfiledata
|
53
53
|
}.merge!(options)
|
54
54
|
|
55
|
-
self.class.post(subdirectory,
|
55
|
+
response = self.class.post(subdirectory,
|
56
56
|
body: body
|
57
57
|
)
|
58
|
+
|
59
|
+
if response.parsed_response.nil?
|
60
|
+
raise NoResponseError.new("An empty response was returned from Faxage.")
|
61
|
+
elsif response.parsed_response.include?("ERR01: Database connection failed")
|
62
|
+
raise FaxageInternalError.new("Internal FAXAGE error.")
|
63
|
+
elsif response.parsed_response.include?("ERR02: Login incorrect")
|
64
|
+
raise LoginError.new("One or more of username, company, password is incorrect or your account is disabled for some reason.")
|
65
|
+
elsif response.parsed_response.include?("ERR03: No files to fax")
|
66
|
+
raise NoFilesError.new("No valid files were found in faxfilenames[] and/or faxfiledata[].")
|
67
|
+
elsif response.parsed_response.include?("ERR04: Fax number")
|
68
|
+
raise InvalidFaxNoError.new("The faxno variable does not contain a 10-digit numeric only string.")
|
69
|
+
elsif response.parsed_response.include?("ERR05")
|
70
|
+
raise BlockedNumberError.new("The number you tried to fax to was blocked (outside of continental US, Canada and Hawaii or a 555, 911, or other invalid/blocked type of number).")
|
71
|
+
elsif response.parsed_response.include?("ERR08: Unknown operation")
|
72
|
+
raise UnknownOperationError.new("Either operation is not correctly hard coded or the POST was bad, the POST contents are returned for debugging purposes.")
|
73
|
+
elsif response.parsed_response.include?("ERR15: Invalid Job ID")
|
74
|
+
raise InvalidJobIdError.new("Internal FAXAGE error – the job was not properly inserted into our database.")
|
75
|
+
else
|
76
|
+
parsed_response = response.parsed_response.gsub("JOBID:", "").gsub(" ", "")
|
77
|
+
data = {
|
78
|
+
job_id: parsed_response.to_i
|
79
|
+
}
|
80
|
+
return data
|
81
|
+
end
|
82
|
+
return response.parsed_response
|
58
83
|
end
|
59
84
|
end
|
60
85
|
end
|
data/lib/faxage/version.rb
CHANGED