faxage 0.1.2 → 0.1.3
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/send_fax.rb +7 -2
- 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: dd31e18b35891cb250ccb07aae95a8ed770cafb932a416b5098791d6e6bd6745
|
4
|
+
data.tar.gz: 411dda5041bdec000fc53c0874338fb227b84669b449f955b9c83c67c4497acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72ca783e4cae038b68443b62fc8f92909b63f0f76cb2dac08f51d756c9a8a6c1bc853563fe9479b4ca3a1fc28a50f038c44fc89b552f771b4325b722fb63a119
|
7
|
+
data.tar.gz: b6a79eeaf114f00137fa837f8b623cb42624991babc5b23ada98f93f08bc89ebbf641cf4b698525dadeef02ed5eb21f0c8db8d398f910c041236f66b83a719f8
|
data/Gemfile.lock
CHANGED
data/lib/faxage/send_fax.rb
CHANGED
@@ -4,6 +4,7 @@ module Faxage
|
|
4
4
|
class SendFax
|
5
5
|
include HTTParty
|
6
6
|
base_uri "https://api.faxage.com"
|
7
|
+
JOB_ID_REGEX = /(?<=JOBID:)\s+\d+/
|
7
8
|
|
8
9
|
attr_reader :username, # Assigned FAXAGE username
|
9
10
|
:company, # Assigned FAXAGE company credential
|
@@ -55,7 +56,7 @@ module Faxage
|
|
55
56
|
response = self.class.post(subdirectory,
|
56
57
|
body: body
|
57
58
|
)
|
58
|
-
|
59
|
+
|
59
60
|
if response.parsed_response.nil?
|
60
61
|
raise NoResponseError.new("An empty response was returned from Faxage.")
|
61
62
|
elsif response.parsed_response.include?("ERR01: Database connection failed")
|
@@ -73,7 +74,11 @@ module Faxage
|
|
73
74
|
elsif response.parsed_response.include?("ERR15: Invalid Job ID")
|
74
75
|
raise InvalidJobIdError.new("Internal FAXAGE error – the job was not properly inserted into our database.")
|
75
76
|
else
|
76
|
-
|
77
|
+
job_id = response.parsed_response.scan(JOB_ID_REGEX)[0].strip.to_i
|
78
|
+
data = {
|
79
|
+
job_id: job_id
|
80
|
+
}
|
81
|
+
return data
|
77
82
|
end
|
78
83
|
end
|
79
84
|
end
|
data/lib/faxage/version.rb
CHANGED