voipfone_client 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a80fbbc197d700cc57e5b9e3cdd6a5aa7bc26e8b
4
- data.tar.gz: 2a43848c3dd0a881e7594e77217eb93b851f4ec8
3
+ metadata.gz: ec00aae0364688ff1e2c3a8c5965b9d78b952571
4
+ data.tar.gz: 61bffd3ac3eb9f92b083256f2d7a8cf505ff6a1c
5
5
  SHA512:
6
- metadata.gz: 9629390a383c7d49eebf55d33def7806240372dc1ef433666da3c7b4166d76a515ffd2098a9740615259496eafa22c4bfed5cd97d1d081aad755ae8bb76fa7da
7
- data.tar.gz: d8c2770f668a0a09b710636d89bc69212d4e7e06b195e80f23581146e0ec3a20fc3b542174efe6e8c0c19639be87cee5c1c3db2c0ecd982e748e11b51e44055a
6
+ metadata.gz: c86c3a9856a801fe831df734b897fbdb7939a2240aeb2d1862b0cb03875254d2b21d3aff4a51740f380b9dc60d8fcb950ebae17232f324deb0232464a22392cd
7
+ data.tar.gz: e5d538c38fcdd211f40edce34ea412fea850b7f829565247c525702d8f504113053de7e1954a0340ce1cf4e5cf986c088020053ec37662bcf24ac559eb7e281a
@@ -6,6 +6,7 @@ require 'voipfone_client/account_balance'
6
6
  require 'voipfone_client/account_details'
7
7
  require 'voipfone_client/diverts'
8
8
  require 'voipfone_client/voicemail'
9
+ require 'voipfone_client/sms'
9
10
 
10
11
  module VoipfoneClient
11
12
  BASE_URL = "https://www.voipfone.co.uk"
@@ -31,12 +31,13 @@ class VoipfoneClient::Client
31
31
  end
32
32
 
33
33
 
34
- # Divert calls for different circumstances - at least one option is required. There are 4 supported situations which can be
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
@@ -1,3 +1,3 @@
1
1
  module VoipfoneClient
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  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
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-08 00:00:00.000000000 Z
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