hoiio 1.0.0

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.
@@ -0,0 +1,65 @@
1
+ #Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)
2
+ #
3
+ #Permission is hereby granted, free of charge, to any person
4
+ #obtaining a copy of this software and associated documentation
5
+ #files (the "Software"), to deal in the Software without
6
+ #restriction, including without limitation the rights to use,
7
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ #copies of the Software, and to permit persons to whom the
9
+ #Software is furnished to do so, subject to the following
10
+ #conditions:
11
+ #
12
+ #The above copyright notice and this permission notice shall be
13
+ #included in all copies or substantial portions of the Software.
14
+ #
15
+ #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ #OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ module Hoiio
25
+ module RequestUtil
26
+
27
+ # Utility methods
28
+
29
+ # Check if any required parameter is missing in params hash
30
+ #
31
+ # @param required_param_names array of names of required parameters that need to be checked
32
+ # @param params hash of params that will be used to check the presence of each required_param_name
33
+ #
34
+ # @return Hoiio::InputError if a required param is missing
35
+ def check_nil_or_empty(required_param_names=[], params)
36
+ required_param_names.each { |p|
37
+ if params[p].nil? || params[p].empty?
38
+ raise Hoiio::RequestError.new "Param " << p << " is missing"
39
+ end
40
+ }
41
+ end
42
+
43
+ # Check that only 1 required parameter is needed for specific API calls
44
+ #
45
+ # @param required_param_names array of names of required parameters that need to be checked
46
+ # @param params hash of params that will be used to check the presence of each required_param_name
47
+ #
48
+ # @return Hoiio::InputError if a required param is missing or if all required params are present
49
+ def check_for_mutual_exclusivity(required_param_names=[], params)
50
+ i = 0
51
+ required_param_names.each { |p|
52
+ if !params[p].nil? && !params[p].empty?
53
+ i += 1
54
+ end
55
+ }
56
+
57
+ if i == 0
58
+ raise Hoiio::RequestError.new "All required params are missing"
59
+ elsif i > 1
60
+ raise Hoiio::RequestError.new "More than 1 required, mutually exclusive param are present."
61
+ end
62
+ end
63
+
64
+ end
65
+ end
@@ -0,0 +1,59 @@
1
+ #Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)
2
+ #
3
+ #Permission is hereby granted, free of charge, to any person
4
+ #obtaining a copy of this software and associated documentation
5
+ #files (the "Software"), to deal in the Software without
6
+ #restriction, including without limitation the rights to use,
7
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ #copies of the Software, and to permit persons to whom the
9
+ #Software is furnished to do so, subject to the following
10
+ #conditions:
11
+ #
12
+ #The above copyright notice and this permission notice shall be
13
+ #included in all copies or substantial portions of the Software.
14
+ #
15
+ #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ #OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ module Hoiio
25
+ module ResponseUtil
26
+
27
+ # Process response returned by Hoiio API
28
+ # @param response response of Hoiio API
29
+ # @return response parsed as a Hash
30
+ #
31
+ # @raise ServerError if status is not present
32
+ # @raise ResponseError if status is not success_ok
33
+ def process_response(response)
34
+ response = create_hash response
35
+ if response['status'].nil?
36
+ raise Hoiio::ServerError
37
+ elsif STATUS_SUCCESS != response['status']
38
+ raise Hoiio::ResponseError.new response['status'], response['status']
39
+ end
40
+ response
41
+ end
42
+
43
+ private
44
+
45
+ # Create a Hash from a JSON response
46
+ # @param response response of Hoiio API
47
+ # @return response parsed as a Hash
48
+ def create_hash(response)
49
+ begin
50
+ JSON.parse response
51
+ rescue JSON::ParserError
52
+ response
53
+ rescue StandardError
54
+ response
55
+ end
56
+ end
57
+
58
+ end
59
+ end
@@ -0,0 +1,26 @@
1
+ #Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)
2
+ #
3
+ #Permission is hereby granted, free of charge, to any person
4
+ #obtaining a copy of this software and associated documentation
5
+ #files (the "Software"), to deal in the Software without
6
+ #restriction, including without limitation the rights to use,
7
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ #copies of the Software, and to permit persons to whom the
9
+ #Software is furnished to do so, subject to the following
10
+ #conditions:
11
+ #
12
+ #The above copyright notice and this permission notice shall be
13
+ #included in all copies or substantial portions of the Software.
14
+ #
15
+ #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ #OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ module Hoiio
25
+ VERSION = '1.0.0'
26
+ end
@@ -0,0 +1,65 @@
1
+ #Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)
2
+ #
3
+ #Permission is hereby granted, free of charge, to any person
4
+ #obtaining a copy of this software and associated documentation
5
+ #files (the "Software"), to deal in the Software without
6
+ #restriction, including without limitation the rights to use,
7
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ #copies of the Software, and to permit persons to whom the
9
+ #Software is furnished to do so, subject to the following
10
+ #conditions:
11
+ #
12
+ #The above copyright notice and this permission notice shall be
13
+ #included in all copies or substantial portions of the Software.
14
+ #
15
+ #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ #OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ require 'spec_helper'
25
+
26
+ FAX_SEND_RESPONSE = {:status => SUCCESS, :txn_ref => "test-1"}
27
+ FAX_GET_HISTORY_RESPONSE = {:status => SUCCESS, :entries_count => "1"}
28
+ FAX_GET_RATE_RESPONSE = {:status => SUCCESS, :rate => "0.03", :currency => "SGD"}
29
+ FAX_QUERY_STATUS_RESPONSE = {:status => SUCCESS, :fax_status => "answered", :currency => "USD"}
30
+
31
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/fax/send"), :body => FAX_SEND_RESPONSE.to_json
32
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/fax/get_history"), :body => FAX_GET_HISTORY_RESPONSE.to_json
33
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/fax/get_rate"), :body => FAX_GET_RATE_RESPONSE.to_json
34
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/fax/query_status"), :body => FAX_QUERY_STATUS_RESPONSE.to_json
35
+
36
+
37
+ describe Hoiio::Fax do
38
+
39
+ it 'should send a fax and return txn ref' do
40
+ response = CLIENT.fax.send({:dest => TEST_PHONE, :file => "test"})
41
+ check_status response
42
+ check_txn_ref response
43
+ end
44
+
45
+ it 'should return history' do
46
+ response = CLIENT.fax.get_history
47
+ check_status response
48
+ response['entries_count'].should == "1"
49
+ end
50
+
51
+ it 'should return fax rate' do
52
+ response = CLIENT.fax.get_rate({:dest => "+1231231"})
53
+ check_status response
54
+ response["currency"].should == "SGD"
55
+ response["rate"].should == "0.03"
56
+ end
57
+
58
+ it 'should query fax status' do
59
+ response = CLIENT.fax.query_status({:txn_ref => "test"})
60
+ check_status response
61
+ response["currency"].should == "USD"
62
+ response["fax_status"].should == "answered"
63
+ end
64
+
65
+ end
@@ -0,0 +1,82 @@
1
+ #Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)
2
+ #
3
+ #Permission is hereby granted, free of charge, to any person
4
+ #obtaining a copy of this software and associated documentation
5
+ #files (the "Software"), to deal in the Software without
6
+ #restriction, including without limitation the rights to use,
7
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ #copies of the Software, and to permit persons to whom the
9
+ #Software is furnished to do so, subject to the following
10
+ #conditions:
11
+ #
12
+ #The above copyright notice and this permission notice shall be
13
+ #included in all copies or substantial portions of the Software.
14
+ #
15
+ #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ #OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ require 'spec_helper'
25
+
26
+ IVR_START_DIAL_RESPONSE = {:status => SUCCESS, :txn_ref => "test-1", :session => "S-1"}
27
+ IVR_MIDDLE_PLAY_RESPONSE = {:status => SUCCESS}
28
+ IVR_MIDDLE_GATHER_RESPONSE = {:status => SUCCESS}
29
+ IVR_MIDDLE_RECORD_RESPONSE = {:status => SUCCESS}
30
+ IVR_MIDDLE_MONITOR_RESPONSE = {:status => SUCCESS}
31
+ IVR_END_TRANSFER_RESPONSE = {:status => SUCCESS, :room => "R-1"}
32
+ IVR_END_HANGUP_RESPONSE = {:status => SUCCESS, :room => "R-1"}
33
+
34
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/ivr/start/dial"), :body => IVR_START_DIAL_RESPONSE.to_json
35
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/ivr/middle/play"), :body => IVR_MIDDLE_PLAY_RESPONSE.to_json
36
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/ivr/middle/gather"), :body => IVR_MIDDLE_GATHER_RESPONSE.to_json
37
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/ivr/middle/record"), :body => IVR_MIDDLE_RECORD_RESPONSE.to_json
38
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/ivr/middle/monitor"), :body => IVR_MIDDLE_MONITOR_RESPONSE.to_json
39
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/ivr/end/transfer"), :body => IVR_END_TRANSFER_RESPONSE.to_json
40
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/ivr/end/hangup"), :body => IVR_END_HANGUP_RESPONSE.to_json
41
+
42
+ describe Hoiio::IVR do
43
+
44
+ it 'should make a dial-out to a destination number' do
45
+ response = CLIENT.ivr.start.dial({:dest => TEST_PHONE})
46
+ check_status response
47
+ check_txn_ref response
48
+ response["session"].should == "S-1"
49
+ end
50
+
51
+ it 'should want to play a voice message' do
52
+ response = CLIENT.ivr.middle.play({:session => "S-1"})
53
+ check_status response
54
+ end
55
+
56
+ it 'should get user input via the telephone keypad' do
57
+ response = CLIENT.ivr.middle.gather({:session => "S-1", :notify_url => "http://dev.example.com/hoiio/record"})
58
+ check_status response
59
+ end
60
+
61
+ it 'should record voice messages from the user over the phone' do
62
+ response = CLIENT.ivr.middle.gather({:session => "S-1", :notify_url => "http://dev.example.com/hoiio/record"})
63
+ check_status response
64
+ end
65
+
66
+ it 'should record the call conversation, including any voice messages' do
67
+ response = CLIENT.ivr.middle.monitor({:session => "S-1", :notify_url => "http://dev.example.com/hoiio/record"})
68
+ check_status response
69
+ end
70
+
71
+ it 'should transfer the call to destination number' do
72
+ response = CLIENT.ivr.end.transfer({:session => "S-1", :dest => "+6591112222"})
73
+ check_status response
74
+ response["room"].should == "R-1"
75
+ end
76
+
77
+ it 'should hang up a specific call' do
78
+ response = CLIENT.ivr.end.hangup({:session => "S-1"})
79
+ check_status response
80
+ end
81
+
82
+ end
@@ -0,0 +1,80 @@
1
+ #Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)
2
+ #
3
+ #Permission is hereby granted, free of charge, to any person
4
+ #obtaining a copy of this software and associated documentation
5
+ #files (the "Software"), to deal in the Software without
6
+ #restriction, including without limitation the rights to use,
7
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ #copies of the Software, and to permit persons to whom the
9
+ #Software is furnished to do so, subject to the following
10
+ #conditions:
11
+ #
12
+ #The above copyright notice and this permission notice shall be
13
+ #included in all copies or substantial portions of the Software.
14
+ #
15
+ #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ #OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ require 'spec_helper'
25
+
26
+ NUMBER_GET_COUNTRIES_RESPONSE = {:status => SUCCESS, :entries_count => "10"}
27
+ NUMBER_GET_CHOICES_RESPONSE = {:status => SUCCESS, :total_entries_count => "30"}
28
+ NUMBER_GET_RATES_RESPONSE = {:status => SUCCESS, :currency => "SGD", :entries_count => "50"}
29
+ NUMBER_SUBSCRIBE_RESPONSE = {:status => SUCCESS, :debit => "9.99", :currency => "SGD"}
30
+ NUMBER_UPDATE_FORWARDING_RESPONSE = {:status => SUCCESS}
31
+ NUMBER_GET_ACTIVE_RESPONSE = {:status => SUCCESS, :entries_count => "3"}
32
+
33
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/number/get_countries"), :body => NUMBER_GET_COUNTRIES_RESPONSE.to_json
34
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/number/get_choices"), :body => NUMBER_GET_CHOICES_RESPONSE.to_json
35
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/number/get_rates"), :body => NUMBER_GET_RATES_RESPONSE.to_json
36
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/number/subscribe"), :body => NUMBER_SUBSCRIBE_RESPONSE.to_json
37
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/number/update_forwarding"), :body => NUMBER_UPDATE_FORWARDING_RESPONSE.to_json
38
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/number/get_active"), :body => NUMBER_GET_ACTIVE_RESPONSE.to_json
39
+
40
+
41
+ describe Hoiio::Number do
42
+
43
+ it 'should get a list of countries for Hoiio Numbers' do
44
+ response = CLIENT.number.get_countries
45
+ check_status response
46
+ response['entries_count'].should == "10"
47
+ end
48
+
49
+ it 'should get a list of available Hoiio Numbers for subscription in a given country' do
50
+ response = CLIENT.number.get_choices({:country => "SG"})
51
+ check_status response
52
+ response['total_entries_count'].should == "30"
53
+ end
54
+
55
+ it 'should retrieve the billable rate that will be charged for subscribing to a Hoiio Number' do
56
+ response = CLIENT.number.get_rates({:country => "SG"})
57
+ check_status response
58
+ response['entries_count'].should == "50"
59
+ response['currency'].should == "SGD"
60
+ end
61
+
62
+ it 'should subscribe for a new Hoiio Number or extend an existing subscription of a Hoiio Number' do
63
+ response = CLIENT.number.subscribe({:number => "+6581111111", :duration => "1"})
64
+ check_status response
65
+ response['debit'].should == "9.99"
66
+ response['currency'].should == "SGD"
67
+ end
68
+
69
+ it 'should configure the URL that the incoming call notification and incoming SMS notification for Hoiio Number' do
70
+ response = CLIENT.number.update_forwarding({:number => "+6581111111"})
71
+ check_status response
72
+ end
73
+
74
+ it 'should retrieve the list of Hoiio Numbers and their current configurations' do
75
+ response = CLIENT.number.get_active({:number => "+6581111111"})
76
+ check_status response
77
+ response['entries_count'].should == "3"
78
+ end
79
+
80
+ end
@@ -0,0 +1,73 @@
1
+ #Copyright (C) 2012 Hoiio Pte Ltd (http://www.hoiio.com)
2
+ #
3
+ #Permission is hereby granted, free of charge, to any person
4
+ #obtaining a copy of this software and associated documentation
5
+ #files (the "Software"), to deal in the Software without
6
+ #restriction, including without limitation the rights to use,
7
+ # copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ #copies of the Software, and to permit persons to whom the
9
+ #Software is furnished to do so, subject to the following
10
+ #conditions:
11
+ #
12
+ #The above copyright notice and this permission notice shall be
13
+ #included in all copies or substantial portions of the Software.
14
+ #
15
+ #THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ #EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
17
+ #OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ #NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
19
+ #HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
20
+ #WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
+ #FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22
+ #OTHER DEALINGS IN THE SOFTWARE.
23
+
24
+ require 'spec_helper'
25
+
26
+ SMS_SEND_RESPONSE = {:status => SUCCESS, :txn_ref => "test-1"}
27
+ SMS_BULK_SEND_RESPONSE = {:status => SUCCESS, :bulk_txn_ref => "test-2"}
28
+ SMS_GET_HISTORY_RESPONSE = {:status => SUCCESS, :entries_count => "1"}
29
+ SMS_GET_RATE_RESPONSE = {:status => SUCCESS, :rate => "0.03", :currency => "SGD"}
30
+ SMS_QUERY_STATUS_RESPONSE = {:status => SUCCESS, :sms_status => "delivered", :currency => "USD"}
31
+
32
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/sms/send"), :body => SMS_SEND_RESPONSE.to_json
33
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/sms/bulk_send"), :body => SMS_BULK_SEND_RESPONSE.to_json
34
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/sms/get_history"), :body => SMS_GET_HISTORY_RESPONSE.to_json
35
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/sms/get_rate"), :body => SMS_GET_RATE_RESPONSE.to_json
36
+ FakeWeb.register_uri :post, construct_fakeweb_uri("/sms/query_status"), :body => SMS_QUERY_STATUS_RESPONSE.to_json
37
+
38
+
39
+ describe Hoiio::SMS do
40
+
41
+ it 'should send an SMS and return txn ref' do
42
+ response = CLIENT.sms.send({:dest => TEST_PHONE, :msg => "test"})
43
+ check_status response
44
+ check_txn_ref response
45
+ end
46
+
47
+ it 'should send multiple SMSes and return txn ref' do
48
+ response = CLIENT.sms.bulk_send({:dest => "+651234567,+6512352138", :msg => "test"})
49
+ check_status response
50
+ response['bulk_txn_ref'].should_not be_nil
51
+ end
52
+
53
+ it 'should return history' do
54
+ response = CLIENT.sms.get_history
55
+ check_status response
56
+ response['entries_count'].should == "1"
57
+ end
58
+
59
+ it 'should return SMS rate' do
60
+ response = CLIENT.sms.get_rate({:dest => "+1231231"})
61
+ check_status response
62
+ response['currency'].should == "SGD"
63
+ response['rate'].should == "0.03"
64
+ end
65
+
66
+ it 'should query SMS status' do
67
+ response = CLIENT.sms.query_status({:txn_ref => "test"})
68
+ check_status response
69
+ response['currency'].should == "USD"
70
+ response['sms_status'].should == "delivered"
71
+ end
72
+
73
+ end