voipfone_client 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/voipfone_client.rb +1 -0
- data/lib/voipfone_client/diverts.rb +2 -1
- data/lib/voipfone_client/sms.rb +25 -0
- data/lib/voipfone_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec00aae0364688ff1e2c3a8c5965b9d78b952571
|
4
|
+
data.tar.gz: 61bffd3ac3eb9f92b083256f2d7a8cf505ff6a1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c86c3a9856a801fe831df734b897fbdb7939a2240aeb2d1862b0cb03875254d2b21d3aff4a51740f380b9dc60d8fcb950ebae17232f324deb0232464a22392cd
|
7
|
+
data.tar.gz: e5d538c38fcdd211f40edce34ea412fea850b7f829565247c525702d8f504113053de7e1954a0340ce1cf4e5cf986c088020053ec37662bcf24ac559eb7e281a
|
data/lib/voipfone_client.rb
CHANGED
@@ -31,12 +31,13 @@ class VoipfoneClient::Client
|
|
31
31
|
end
|
32
32
|
|
33
33
|
|
34
|
-
# Divert calls for different circumstances
|
34
|
+
# Divert calls for different circumstances. There are 4 supported situations which can be
|
35
35
|
# diverted for, namely:
|
36
36
|
# - all calls (i.e. no calls will reach the pbx / phones - immediate divert)
|
37
37
|
# - when there is a failure in the phone system
|
38
38
|
# - when the phone(s) are busy
|
39
39
|
# - when there's no answer
|
40
|
+
# If no values are passed, all diverts are cleared.
|
40
41
|
# @param all [String] The number to which all calls will be diverted.
|
41
42
|
# @param fail [String] The number to which calls will be diverted in the event of a failure
|
42
43
|
# @param busy [String] The number to which calls will be diverted if the phones are busy
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class VoipfoneClient::Client
|
2
|
+
# Send an sms from your account.
|
3
|
+
# @param to [String] the phone number to send the SMS to, as a string. Spaces will be stripped; + symbol allowed.
|
4
|
+
# @param from [String] the phone number to send the SMS from, as a string. Spaces will be stripped; + symbol allowed.
|
5
|
+
# @param message [String] the message to send. The first 160 characters only will be sent.
|
6
|
+
def send_sms(to:to, from:from, message:message)
|
7
|
+
if to.nil? || from.nil? || message.nil?
|
8
|
+
raise ArgumentError, "You need to include 'to' and 'from' numbers and a message to send an SMS"
|
9
|
+
end
|
10
|
+
to = to.gsub(" ","")
|
11
|
+
from = from.gsub(" ","")
|
12
|
+
parameters = {
|
13
|
+
"sms-send-to" => to,
|
14
|
+
"sms-send-from" => from,
|
15
|
+
"sms-message" => message
|
16
|
+
}
|
17
|
+
request = @browser.post("#{VoipfoneClient::API_POST_URL}?smsSend", parameters)
|
18
|
+
response = parse_response(request)
|
19
|
+
if response == "ok"
|
20
|
+
return true
|
21
|
+
else
|
22
|
+
raise VoipfoneAPIError, response
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voipfone_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Error Creative Studio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- lib/voipfone_client/client.rb
|
88
88
|
- lib/voipfone_client/diverts.rb
|
89
89
|
- lib/voipfone_client/errors.rb
|
90
|
+
- lib/voipfone_client/sms.rb
|
90
91
|
- lib/voipfone_client/version.rb
|
91
92
|
- lib/voipfone_client/voicemail.rb
|
92
93
|
- voipfone_client.gemspec
|