ruby-transmitsms 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +4 -0
  3. data/Gemfile.lock +49 -0
  4. data/LICENSE +22 -0
  5. data/README.md +62 -0
  6. data/Rakefile +7 -0
  7. data/fixtures/vcr_cassettes/account_api_get_balance.yml +49 -0
  8. data/fixtures/vcr_cassettes/email_sms_api_add_email.yml +49 -0
  9. data/fixtures/vcr_cassettes/email_sms_api_delete_email.yml +49 -0
  10. data/fixtures/vcr_cassettes/keywords_api_add_keyword.yml +49 -0
  11. data/fixtures/vcr_cassettes/keywords_api_edit_keyword.yml +49 -0
  12. data/fixtures/vcr_cassettes/keywords_api_get_keywords.yml +50 -0
  13. data/fixtures/vcr_cassettes/lists_api_add_list.yml +49 -0
  14. data/fixtures/vcr_cassettes/lists_api_add_to_list.yml +50 -0
  15. data/fixtures/vcr_cassettes/lists_api_delete_from_list.yml +49 -0
  16. data/fixtures/vcr_cassettes/lists_api_edit_list_member.yml +50 -0
  17. data/fixtures/vcr_cassettes/lists_api_get_list.yml +60 -0
  18. data/fixtures/vcr_cassettes/lists_api_get_lists.yml +61 -0
  19. data/fixtures/vcr_cassettes/lists_api_optout_list_member.yml +49 -0
  20. data/fixtures/vcr_cassettes/lists_api_remove_list.yml +49 -0
  21. data/fixtures/vcr_cassettes/numbers_api_get_number.yml +49 -0
  22. data/fixtures/vcr_cassettes/numbers_api_get_numbers.yml +49 -0
  23. data/fixtures/vcr_cassettes/numbers_api_lease_number.yml +50 -0
  24. data/fixtures/vcr_cassettes/resellers_api_add_client.yml +49 -0
  25. data/fixtures/vcr_cassettes/resellers_api_edit_client.yml +40 -0
  26. data/fixtures/vcr_cassettes/resellers_api_get_client.yml +50 -0
  27. data/fixtures/vcr_cassettes/resellers_api_get_clients.yml +59 -0
  28. data/fixtures/vcr_cassettes/resellers_api_get_transaction.yml +51 -0
  29. data/fixtures/vcr_cassettes/resellers_api_get_transactions.yml +61 -0
  30. data/fixtures/vcr_cassettes/sms_api_test_cancel_sms.yml +50 -0
  31. data/fixtures/vcr_cassettes/sms_api_test_format_number.yml +49 -0
  32. data/fixtures/vcr_cassettes/sms_api_test_format_number_fail_in_missing_msisdn.yml +50 -0
  33. data/fixtures/vcr_cassettes/sms_api_test_get_message_log.yml +50 -0
  34. data/fixtures/vcr_cassettes/sms_api_test_get_sms_info.yml +49 -0
  35. data/fixtures/vcr_cassettes/sms_api_test_get_sms_info_fail_for_not_existing_message_id.yml +50 -0
  36. data/fixtures/vcr_cassettes/sms_api_test_get_sms_responses.yml +53 -0
  37. data/fixtures/vcr_cassettes/sms_api_test_get_sms_sent.yml +50 -0
  38. data/fixtures/vcr_cassettes/sms_api_test_get_user_sms_responses.yml +49 -0
  39. data/fixtures/vcr_cassettes/sms_api_test_message_reply.yml +49 -0
  40. data/fixtures/vcr_cassettes/sms_api_test_send.yml +49 -0
  41. data/fixtures/vcr_cassettes/sms_api_test_send_missing_to_and_list_id.yml +50 -0
  42. data/fixtures/vcr_cassettes/sms_api_test_send_with_list_id.yml +50 -0
  43. data/geminstall.sh +1 -0
  44. data/lib/account_api.rb +80 -0
  45. data/lib/email_api.rb +137 -0
  46. data/lib/keywords_api.rb +224 -0
  47. data/lib/lists_api.rb +523 -0
  48. data/lib/monkey.rb +90 -0
  49. data/lib/numbers_api.rb +188 -0
  50. data/lib/resellers_api.rb +379 -0
  51. data/lib/ruby-transmitsms.rb +16 -0
  52. data/lib/sms_api.rb +550 -0
  53. data/lib/swagger.rb +84 -0
  54. data/lib/swagger/configuration.rb +22 -0
  55. data/lib/swagger/request.rb +212 -0
  56. data/lib/swagger/response.rb +70 -0
  57. data/lib/swagger/version.rb +4 -0
  58. data/ruby-transmitsms.gemspec +33 -0
  59. data/runtest.sh +8 -0
  60. data/setup.sh +1 -0
  61. data/spec/.resellers_api_spec.rb.swp +0 -0
  62. data/spec/account_api_spec.rb +30 -0
  63. data/spec/email_sms_api_spec.rb +40 -0
  64. data/spec/keywords_api_spec.rb +56 -0
  65. data/spec/lists_api_spec.rb +117 -0
  66. data/spec/numbers_api_spec.rb +53 -0
  67. data/spec/resellers_api_spec.rb +85 -0
  68. data/spec/sms_api_spec.rb +174 -0
  69. data/spec/spec.opts +4 -0
  70. metadata +219 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 46a57bb0ebf7930c2ac2fd718e3a3ccd572f2ff0
4
+ data.tar.gz: a4c9a879eac1ba693eb96215c0a8902350c306e3
5
+ SHA512:
6
+ metadata.gz: cd01db9ee1fd885abd5ca591e5d396b662b8b84d1cf26f39585b716f52a7cea084e5b8bdb0d3546196dc05a35645ff70ef682e0b5c37c06d202c035f4b2e57c0
7
+ data.tar.gz: 4107f3a9ad7090c6ca9d7aebe188dacbf5d37de50b89def5e10b65293934f842b7ee5db3e7b27ea792ba3c85e80c6deb62413264c397386ab1f6d47817daa24f
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify dependencies in swagger.gemspec
4
+ gemspec
@@ -0,0 +1,49 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-transmitsms (0.0.1)
5
+ addressable (>= 2.2.4)
6
+ json (>= 1.4.6)
7
+ typhoeus (>= 0.2.1)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ addressable (2.3.8)
13
+ crack (0.4.2)
14
+ safe_yaml (~> 1.0.0)
15
+ diff-lcs (1.2.5)
16
+ ethon (0.7.3)
17
+ ffi (>= 1.3.0)
18
+ ffi (1.9.8)
19
+ json (1.8.2)
20
+ rspec (3.2.0)
21
+ rspec-core (~> 3.2.0)
22
+ rspec-expectations (~> 3.2.0)
23
+ rspec-mocks (~> 3.2.0)
24
+ rspec-core (3.2.3)
25
+ rspec-support (~> 3.2.0)
26
+ rspec-expectations (3.2.1)
27
+ diff-lcs (>= 1.2.0, < 2.0)
28
+ rspec-support (~> 3.2.0)
29
+ rspec-mocks (3.2.1)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.2.0)
32
+ rspec-support (3.2.2)
33
+ safe_yaml (1.0.4)
34
+ typhoeus (0.7.1)
35
+ ethon (>= 0.7.1)
36
+ vcr (2.9.3)
37
+ webmock (1.21.0)
38
+ addressable (>= 2.3.6)
39
+ crack (>= 0.3.2)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ rspec (>= 2.5.0)
46
+ rspec-mocks
47
+ ruby-transmitsms!
48
+ vcr (>= 2.9.3)
49
+ webmock (>= 1.21.0)
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Transmitsms
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,62 @@
1
+ ruby-transmitsms
2
+ ================
3
+
4
+ Ruby gem to easily access TransmitSMS RESTful APIs
5
+
6
+ ### Sample Usage
7
+ ```ruby
8
+ require 'ruby-transmitsms'
9
+
10
+ # Create new Sms instance
11
+ sms = Sms.new("15eg266c832fb23c4d90f01055aef355", "bluebird")
12
+
13
+ # Send a message
14
+ response = sms.send("Hello, world", "61455123456")
15
+
16
+ # Show the result
17
+ puts response.code
18
+ puts response.body
19
+ ```
20
+
21
+ ### Installation
22
+ ```sh
23
+ gem install ruby-transmitsms
24
+ ```
25
+
26
+ ### Installation with `bundler`'s Gemfile
27
+ gem "ruby-transmitsms"
28
+
29
+ ## Development
30
+
31
+ ### To install the required gems:
32
+ ```sh
33
+ $ ./setup.sh
34
+ ```
35
+
36
+ ### To run the tests:
37
+ ```sh
38
+ $ ./runtest.sh
39
+ ```
40
+ ## API
41
+
42
+ ### Sms
43
+
44
+ **initialize**(api_key, api_secret) - Sms object constructor.
45
+
46
+ params:
47
+ * `api_key`
48
+ * `api_secret`
49
+
50
+ **send**(message, to, from, send_at, list_id, dlr_callback, reply_callback, validity, replies_to_email, from_shared) - Send sms to the given `to` param or `list_id` param.
51
+
52
+ params:
53
+ * `message`
54
+ * `to`
55
+ * `from`
56
+ * `send_at`
57
+ * `list_id`
58
+ * `dlr_callback`
59
+ * `reply_callback`
60
+ * `validity`
61
+ * `replies_to_email`
62
+ * `from_shared`
@@ -0,0 +1,7 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ require 'swagger'
6
+
7
+ RSpec::Core::RakeTask.new('spec')
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.burst.dev.local/get-balance.json
6
+ body:
7
+ encoding: UTF-8
8
+ string: 'null'
9
+ headers:
10
+ User-Agent:
11
+ - ruby-swagger-4.06.08
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ Api-Key:
15
+ - ''
16
+ Authorization:
17
+ - |
18
+ Basic MTVhZDI2NmM1MzhmYjM2YzRkOTBmMDEwNTVhZWY0OTQ6bW9vc2U=
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Server:
25
+ - nginx/1.1.19
26
+ Date:
27
+ - Tue, 28 Apr 2015 06:58:09 GMT
28
+ Content-Type:
29
+ - application/json; charset=utf-8
30
+ Transfer-Encoding:
31
+ - chunked
32
+ Connection:
33
+ - keep-alive
34
+ X-Powered-By:
35
+ - PHP/5.4.39-1+deb.sury.org~precise+2
36
+ Expires:
37
+ - Thu, 19 Nov 1981 08:52:00 GMT
38
+ Cache-Control:
39
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
40
+ Pragma:
41
+ - no-cache
42
+ X-Mashape-Billing:
43
+ - Queries=1
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"balance":496227.614,"currency":"SGD","error":{"code":"SUCCESS","description":"OK"}}'
47
+ http_version:
48
+ recorded_at: Tue, 28 Apr 2015 06:58:09 GMT
49
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.burst.dev.local/add-email.json?email=test@email.com
6
+ body:
7
+ encoding: UTF-8
8
+ string: 'null'
9
+ headers:
10
+ User-Agent:
11
+ - ruby-swagger-4.06.08
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ Api-Key:
15
+ - ''
16
+ Authorization:
17
+ - |
18
+ Basic MTVhZDI2NmM1MzhmYjM2YzRkOTBmMDEwNTVhZWY0OTQ6bW9vc2U=
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Server:
25
+ - nginx/1.1.19
26
+ Date:
27
+ - Tue, 28 Apr 2015 05:52:05 GMT
28
+ Content-Type:
29
+ - application/json; charset=utf-8
30
+ Transfer-Encoding:
31
+ - chunked
32
+ Connection:
33
+ - keep-alive
34
+ X-Powered-By:
35
+ - PHP/5.4.39-1+deb.sury.org~precise+2
36
+ Expires:
37
+ - Thu, 19 Nov 1981 08:52:00 GMT
38
+ Cache-Control:
39
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
40
+ Pragma:
41
+ - no-cache
42
+ X-Mashape-Billing:
43
+ - Queries=1
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"success":true,"error":{"code":"SUCCESS","description":"OK"}}'
47
+ http_version:
48
+ recorded_at: Tue, 28 Apr 2015 05:52:05 GMT
49
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.burst.dev.local/delete-email.json?email=test@email.com
6
+ body:
7
+ encoding: UTF-8
8
+ string: 'null'
9
+ headers:
10
+ User-Agent:
11
+ - ruby-swagger-4.06.08
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ Api-Key:
15
+ - ''
16
+ Authorization:
17
+ - |
18
+ Basic MTVhZDI2NmM1MzhmYjM2YzRkOTBmMDEwNTVhZWY0OTQ6bW9vc2U=
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Server:
25
+ - nginx/1.1.19
26
+ Date:
27
+ - Tue, 28 Apr 2015 06:07:55 GMT
28
+ Content-Type:
29
+ - application/json; charset=utf-8
30
+ Transfer-Encoding:
31
+ - chunked
32
+ Connection:
33
+ - keep-alive
34
+ X-Powered-By:
35
+ - PHP/5.4.39-1+deb.sury.org~precise+2
36
+ Expires:
37
+ - Thu, 19 Nov 1981 08:52:00 GMT
38
+ Cache-Control:
39
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
40
+ Pragma:
41
+ - no-cache
42
+ X-Mashape-Billing:
43
+ - Queries=1
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"success":true,"error":{"code":"SUCCESS","description":"OK"}}'
47
+ http_version:
48
+ recorded_at: Tue, 28 Apr 2015 06:07:55 GMT
49
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.burst.dev.local/add-keyword.json?keyword=NEWS&number=61422222222
6
+ body:
7
+ encoding: UTF-8
8
+ string: 'null'
9
+ headers:
10
+ User-Agent:
11
+ - ruby-swagger-4.06.08
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ Api-Key:
15
+ - ''
16
+ Authorization:
17
+ - |
18
+ Basic MTVhZDI2NmM1MzhmYjM2YzRkOTBmMDEwNTVhZWY0OTQ6bW9vc2U=
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Server:
25
+ - nginx/1.1.19
26
+ Date:
27
+ - Tue, 28 Apr 2015 07:10:59 GMT
28
+ Content-Type:
29
+ - application/json; charset=utf-8
30
+ Transfer-Encoding:
31
+ - chunked
32
+ Connection:
33
+ - keep-alive
34
+ X-Powered-By:
35
+ - PHP/5.4.39-1+deb.sury.org~precise+2
36
+ Expires:
37
+ - Thu, 19 Nov 1981 08:52:00 GMT
38
+ Cache-Control:
39
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
40
+ Pragma:
41
+ - no-cache
42
+ X-Mashape-Billing:
43
+ - Queries=1
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"keyword":"NEWS","reference":"","number":61422222222,"list_id":0,"welcome_message":"","member_message":"","forward_url":"","forward_sms":"","forward_email":"","status":"open","billing_date":"2015-05-28","error":{"code":"SUCCESS","description":"OK"}}'
47
+ http_version:
48
+ recorded_at: Tue, 28 Apr 2015 07:10:59 GMT
49
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,49 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.burst.dev.local/edit-keyword.json?keyword=NEWS&number=61422222222
6
+ body:
7
+ encoding: UTF-8
8
+ string: 'null'
9
+ headers:
10
+ User-Agent:
11
+ - ruby-swagger-4.06.08
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ Api-Key:
15
+ - ''
16
+ Authorization:
17
+ - |
18
+ Basic MTVhZDI2NmM1MzhmYjM2YzRkOTBmMDEwNTVhZWY0OTQ6bW9vc2U=
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Server:
25
+ - nginx/1.1.19
26
+ Date:
27
+ - Tue, 28 Apr 2015 07:15:37 GMT
28
+ Content-Type:
29
+ - application/json; charset=utf-8
30
+ Transfer-Encoding:
31
+ - chunked
32
+ Connection:
33
+ - keep-alive
34
+ X-Powered-By:
35
+ - PHP/5.4.39-1+deb.sury.org~precise+2
36
+ Expires:
37
+ - Thu, 19 Nov 1981 08:52:00 GMT
38
+ Cache-Control:
39
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
40
+ Pragma:
41
+ - no-cache
42
+ X-Mashape-Billing:
43
+ - Queries=1
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"keyword":"NEWS","reference":"","number":61422222222,"list_id":0,"welcome_message":"","member_message":"","forward_url":"","forward_sms":"","forward_email":"","status":"open","billing_date":"2015-05-28","error":{"code":"SUCCESS","description":"OK"}}'
47
+ http_version:
48
+ recorded_at: Tue, 28 Apr 2015 07:15:37 GMT
49
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,50 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://api.burst.dev.local/get-keywords.json?number=61422222222
6
+ body:
7
+ encoding: UTF-8
8
+ string: 'null'
9
+ headers:
10
+ User-Agent:
11
+ - ruby-swagger-4.06.08
12
+ Content-Type:
13
+ - application/x-www-form-urlencoded
14
+ Api-Key:
15
+ - ''
16
+ Authorization:
17
+ - |
18
+ Basic MTVhZDI2NmM1MzhmYjM2YzRkOTBmMDEwNTVhZWY0OTQ6bW9vc2U=
19
+ response:
20
+ status:
21
+ code: 200
22
+ message: OK
23
+ headers:
24
+ Server:
25
+ - nginx/1.1.19
26
+ Date:
27
+ - Tue, 28 Apr 2015 07:18:06 GMT
28
+ Content-Type:
29
+ - application/json; charset=utf-8
30
+ Transfer-Encoding:
31
+ - chunked
32
+ Connection:
33
+ - keep-alive
34
+ X-Powered-By:
35
+ - PHP/5.4.39-1+deb.sury.org~precise+2
36
+ Expires:
37
+ - Thu, 19 Nov 1981 08:52:00 GMT
38
+ Cache-Control:
39
+ - no-store, no-cache, must-revalidate, post-check=0, pre-check=0
40
+ Pragma:
41
+ - no-cache
42
+ X-Mashape-Billing:
43
+ - Queries=1
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"page":{"count":1,"number":1},"keywords_total":6,"keywords":[{"keyword":"","reference":"wefwefwefwef","number":61422222222,"list_id":0,"welcome_message":"","member_message":"","forward_url":"","forward_sms":"","forward_email":"","status":"open","billing_date":"2014-12-19"},{"keyword":"","reference":"23r23r23r23r","number":61422222222,"list_id":0,"welcome_message":"","member_message":"","forward_url":"","forward_sms":"","forward_email":"","status":"open","billing_date":"2014-12-19"},{"keyword":"FWEFWEFWEF","reference":"wefwefwefwef","number":61422222222,"list_id":55214,"welcome_message":"wefwefwef","member_message":"wefwefwe","forward_url":"","forward_sms":"","forward_email":"","status":"open","billing_date":"2014-12-19"},{"keyword":"MOOSE","reference":"moosey3","number":61422222222,"list_id":0,"welcome_message":"","member_message":"","forward_url":"","forward_sms":"","forward_email":"","status":"open","billing_date":"2014-12-19"},{"keyword":"MOOSE
47
+ MOOSE","reference":"MOOSE","number":61422222222,"list_id":0,"welcome_message":"","member_message":"","forward_url":"","forward_sms":"","forward_email":"","status":"open","billing_date":"2014-12-19"},{"keyword":"NEWS","reference":"","number":61422222222,"list_id":0,"welcome_message":"","member_message":"","forward_url":"","forward_sms":"","forward_email":"","status":"open","billing_date":"2015-05-28"}],"error":{"code":"SUCCESS","description":"OK"}}'
48
+ http_version:
49
+ recorded_at: Tue, 28 Apr 2015 07:18:06 GMT
50
+ recorded_with: VCR 2.9.3