ruby-transmitsms 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +49 -0
- data/LICENSE +22 -0
- data/README.md +62 -0
- data/Rakefile +7 -0
- data/fixtures/vcr_cassettes/account_api_get_balance.yml +49 -0
- data/fixtures/vcr_cassettes/email_sms_api_add_email.yml +49 -0
- data/fixtures/vcr_cassettes/email_sms_api_delete_email.yml +49 -0
- data/fixtures/vcr_cassettes/keywords_api_add_keyword.yml +49 -0
- data/fixtures/vcr_cassettes/keywords_api_edit_keyword.yml +49 -0
- data/fixtures/vcr_cassettes/keywords_api_get_keywords.yml +50 -0
- data/fixtures/vcr_cassettes/lists_api_add_list.yml +49 -0
- data/fixtures/vcr_cassettes/lists_api_add_to_list.yml +50 -0
- data/fixtures/vcr_cassettes/lists_api_delete_from_list.yml +49 -0
- data/fixtures/vcr_cassettes/lists_api_edit_list_member.yml +50 -0
- data/fixtures/vcr_cassettes/lists_api_get_list.yml +60 -0
- data/fixtures/vcr_cassettes/lists_api_get_lists.yml +61 -0
- data/fixtures/vcr_cassettes/lists_api_optout_list_member.yml +49 -0
- data/fixtures/vcr_cassettes/lists_api_remove_list.yml +49 -0
- data/fixtures/vcr_cassettes/numbers_api_get_number.yml +49 -0
- data/fixtures/vcr_cassettes/numbers_api_get_numbers.yml +49 -0
- data/fixtures/vcr_cassettes/numbers_api_lease_number.yml +50 -0
- data/fixtures/vcr_cassettes/resellers_api_add_client.yml +49 -0
- data/fixtures/vcr_cassettes/resellers_api_edit_client.yml +40 -0
- data/fixtures/vcr_cassettes/resellers_api_get_client.yml +50 -0
- data/fixtures/vcr_cassettes/resellers_api_get_clients.yml +59 -0
- data/fixtures/vcr_cassettes/resellers_api_get_transaction.yml +51 -0
- data/fixtures/vcr_cassettes/resellers_api_get_transactions.yml +61 -0
- data/fixtures/vcr_cassettes/sms_api_test_cancel_sms.yml +50 -0
- data/fixtures/vcr_cassettes/sms_api_test_format_number.yml +49 -0
- data/fixtures/vcr_cassettes/sms_api_test_format_number_fail_in_missing_msisdn.yml +50 -0
- data/fixtures/vcr_cassettes/sms_api_test_get_message_log.yml +50 -0
- data/fixtures/vcr_cassettes/sms_api_test_get_sms_info.yml +49 -0
- data/fixtures/vcr_cassettes/sms_api_test_get_sms_info_fail_for_not_existing_message_id.yml +50 -0
- data/fixtures/vcr_cassettes/sms_api_test_get_sms_responses.yml +53 -0
- data/fixtures/vcr_cassettes/sms_api_test_get_sms_sent.yml +50 -0
- data/fixtures/vcr_cassettes/sms_api_test_get_user_sms_responses.yml +49 -0
- data/fixtures/vcr_cassettes/sms_api_test_message_reply.yml +49 -0
- data/fixtures/vcr_cassettes/sms_api_test_send.yml +49 -0
- data/fixtures/vcr_cassettes/sms_api_test_send_missing_to_and_list_id.yml +50 -0
- data/fixtures/vcr_cassettes/sms_api_test_send_with_list_id.yml +50 -0
- data/geminstall.sh +1 -0
- data/lib/account_api.rb +80 -0
- data/lib/email_api.rb +137 -0
- data/lib/keywords_api.rb +224 -0
- data/lib/lists_api.rb +523 -0
- data/lib/monkey.rb +90 -0
- data/lib/numbers_api.rb +188 -0
- data/lib/resellers_api.rb +379 -0
- data/lib/ruby-transmitsms.rb +16 -0
- data/lib/sms_api.rb +550 -0
- data/lib/swagger.rb +84 -0
- data/lib/swagger/configuration.rb +22 -0
- data/lib/swagger/request.rb +212 -0
- data/lib/swagger/response.rb +70 -0
- data/lib/swagger/version.rb +4 -0
- data/ruby-transmitsms.gemspec +33 -0
- data/runtest.sh +8 -0
- data/setup.sh +1 -0
- data/spec/.resellers_api_spec.rb.swp +0 -0
- data/spec/account_api_spec.rb +30 -0
- data/spec/email_sms_api_spec.rb +40 -0
- data/spec/keywords_api_spec.rb +56 -0
- data/spec/lists_api_spec.rb +117 -0
- data/spec/numbers_api_spec.rb +53 -0
- data/spec/resellers_api_spec.rb +85 -0
- data/spec/sms_api_spec.rb +174 -0
- data/spec/spec.opts +4 -0
- metadata +219 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://api.burst.dev.local/send-sms.json?message=Testing%20API%20to%20field&to=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
|
+
- Mon, 14 Sep 2015 07:06:22 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.44-1+deb.sury.org~precise+1
|
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; Messages=1
|
44
|
+
body:
|
45
|
+
encoding: UTF-8
|
46
|
+
string: '{"message_id":50694,"send_at":"2015-09-14 07:06:21","recipients":1,"cost":0.054,"sms":1,"delivery_stats":{"delivered":0,"pending":0,"bounced":0,"responses":0,"optouts":0},"error":{"code":"SUCCESS","description":"OK"}}'
|
47
|
+
http_version:
|
48
|
+
recorded_at: Mon, 14 Sep 2015 07:06:22 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/send-sms.json?message=Test%20error%20sending
|
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: 400
|
22
|
+
message: Bad Request
|
23
|
+
headers:
|
24
|
+
Server:
|
25
|
+
- nginx/1.1.19
|
26
|
+
Date:
|
27
|
+
- Mon, 14 Sep 2015 07:25:23 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.44-1+deb.sury.org~precise+1
|
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: '{"error":{"code":"FIELD_INVALID","description":"You must provide either
|
47
|
+
''list_id'' or ''to''"}}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Mon, 14 Sep 2015 07:25:23 GMT
|
50
|
+
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/send-sms.json?list_id=55314&message=Testing%20API%20with%20list_id%20field
|
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
|
+
- Mon, 14 Sep 2015 07:23:03 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.44-1+deb.sury.org~precise+1
|
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; Messages=1075
|
44
|
+
body:
|
45
|
+
encoding: UTF-8
|
46
|
+
string: '{"message_id":50695,"send_at":"2015-09-14 07:23:03","recipients":1075,"cost":58.05,"sms":1075,"list":{"id":55314,"name":"untitled
|
47
|
+
list"},"delivery_stats":{"delivered":0,"pending":0,"bounced":0,"responses":0,"optouts":0},"error":{"code":"SUCCESS","description":"OK"}}'
|
48
|
+
http_version:
|
49
|
+
recorded_at: Mon, 14 Sep 2015 07:23:03 GMT
|
50
|
+
recorded_with: VCR 2.9.3
|
data/geminstall.sh
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
gem build ruby-transmitsms.gemspec && sudo gem install ruby-transmitsms--0.0.1.gem && rm ruby-transmitsms-0.0.1.gem
|
data/lib/account_api.rb
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
require "uri"
|
2
|
+
|
3
|
+
class AccountApi
|
4
|
+
basePath = "http://api.burst.dev.local/"
|
5
|
+
# apiInvoker = APIInvoker
|
6
|
+
|
7
|
+
def initialize(api_key, api_secret)
|
8
|
+
@api_key = api_key
|
9
|
+
@api_secret = api_secret
|
10
|
+
@sms_api = SmsApi
|
11
|
+
|
12
|
+
@api_key_secret = create_api_key_secret()
|
13
|
+
|
14
|
+
config_swagger()
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_api_key_secret()
|
18
|
+
api_key_secret = Base64.encode64("#{@api_key}:#{@api_secret}")
|
19
|
+
"Basic #{api_key_secret}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def config_swagger()
|
23
|
+
Swagger.configure do |config|
|
24
|
+
config.host = "http://api.burst.dev.local/".gsub("http://", "").gsub("/", "")
|
25
|
+
config.base_path = "/"
|
26
|
+
config.format = "x-www-form-urlencoded"
|
27
|
+
config.camelize_params = false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# Get a summary of your account balance.
|
33
|
+
#
|
34
|
+
# @return void
|
35
|
+
def get_balance (opts={})
|
36
|
+
query_param_keys = []
|
37
|
+
headerParams = {}
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
# set default values and merge with input
|
42
|
+
options = {
|
43
|
+
|
44
|
+
}.merge(opts)
|
45
|
+
|
46
|
+
#resource path
|
47
|
+
path = "/get-balance.json".sub('{format}','json')
|
48
|
+
|
49
|
+
# pull querystring keys from options
|
50
|
+
queryopts = options.select do |key,value|
|
51
|
+
query_param_keys.include? key
|
52
|
+
end
|
53
|
+
|
54
|
+
# header parameters
|
55
|
+
headers = {}
|
56
|
+
|
57
|
+
_header_accept = 'application/json'
|
58
|
+
if _header_accept != ''
|
59
|
+
headerParams['Accept'] = _header_accept
|
60
|
+
end
|
61
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
62
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
headers[:'Authorization'] = @api_key_secret
|
67
|
+
|
68
|
+
# http body (model)
|
69
|
+
post_body = nil
|
70
|
+
|
71
|
+
# form parameters
|
72
|
+
form_parameter_hash = {}
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
77
|
+
|
78
|
+
|
79
|
+
end
|
80
|
+
end
|
data/lib/email_api.rb
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
require "uri"
|
2
|
+
|
3
|
+
class EmailApi
|
4
|
+
basePath = "http://api.burst.dev.local/"
|
5
|
+
# apiInvoker = APIInvoker
|
6
|
+
|
7
|
+
def initialize(api_key, api_secret)
|
8
|
+
@api_key = api_key
|
9
|
+
@api_secret = api_secret
|
10
|
+
@sms_api = SmsApi
|
11
|
+
|
12
|
+
@api_key_secret = create_api_key_secret()
|
13
|
+
|
14
|
+
config_swagger()
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_api_key_secret()
|
18
|
+
api_key_secret = Base64.encode64("#{@api_key}:#{@api_secret}")
|
19
|
+
"Basic #{api_key_secret}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def config_swagger()
|
23
|
+
Swagger.configure do |config|
|
24
|
+
config.host = "http://api.burst.dev.local/".gsub("http://", "").gsub("/", "")
|
25
|
+
config.base_path = "/"
|
26
|
+
config.format = "x-www-form-urlencoded"
|
27
|
+
config.camelize_params = false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# Authorise an email address for sending Email to SMS
|
33
|
+
#
|
34
|
+
# @param email Email address to register. You may also register a wild-card email which allows any user on the same domain to use Email to SMS.
|
35
|
+
# @param max_sms The maximum number of SMS messages to send from one email message sent from this email address.
|
36
|
+
# @param number Optional dedicated virtual number virtual number
|
37
|
+
# @return void
|
38
|
+
def add_email (email = nil, max_sms = nil, number = nil, opts={})
|
39
|
+
query_param_keys = [:email,:max_sms,:number]
|
40
|
+
headerParams = {}
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
# set default values and merge with input
|
45
|
+
options = {
|
46
|
+
:'email' => email,
|
47
|
+
:'max_sms' => max_sms,
|
48
|
+
:'number' => number
|
49
|
+
|
50
|
+
}.merge(opts)
|
51
|
+
|
52
|
+
#resource path
|
53
|
+
path = "/add-email.json".sub('{format}','json')
|
54
|
+
|
55
|
+
# pull querystring keys from options
|
56
|
+
queryopts = options.select do |key,value|
|
57
|
+
query_param_keys.include? key
|
58
|
+
end
|
59
|
+
|
60
|
+
# header parameters
|
61
|
+
headers = {}
|
62
|
+
|
63
|
+
_header_accept = 'application/json'
|
64
|
+
if _header_accept != ''
|
65
|
+
headerParams['Accept'] = _header_accept
|
66
|
+
end
|
67
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
68
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
headers[:'Authorization'] = @api_key_secret
|
73
|
+
|
74
|
+
# http body (model)
|
75
|
+
post_body = nil
|
76
|
+
|
77
|
+
# form parameters
|
78
|
+
form_parameter_hash = {}
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
83
|
+
|
84
|
+
|
85
|
+
end
|
86
|
+
|
87
|
+
# Remove an email address from the Email to SMS authorised list.
|
88
|
+
#
|
89
|
+
# @param email Email address to remove. You may also use a wild-card email which removes all emails on that domain.
|
90
|
+
# @return void
|
91
|
+
def delete_email (email = nil, opts={})
|
92
|
+
query_param_keys = [:email]
|
93
|
+
headerParams = {}
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
# set default values and merge with input
|
98
|
+
options = {
|
99
|
+
:'email' => email
|
100
|
+
|
101
|
+
}.merge(opts)
|
102
|
+
|
103
|
+
#resource path
|
104
|
+
path = "/delete-email.json".sub('{format}','json')
|
105
|
+
|
106
|
+
# pull querystring keys from options
|
107
|
+
queryopts = options.select do |key,value|
|
108
|
+
query_param_keys.include? key
|
109
|
+
end
|
110
|
+
|
111
|
+
# header parameters
|
112
|
+
headers = {}
|
113
|
+
|
114
|
+
_header_accept = 'application/json'
|
115
|
+
if _header_accept != ''
|
116
|
+
headerParams['Accept'] = _header_accept
|
117
|
+
end
|
118
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
119
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
headers[:'Authorization'] = @api_key_secret
|
124
|
+
|
125
|
+
# http body (model)
|
126
|
+
post_body = nil
|
127
|
+
|
128
|
+
# form parameters
|
129
|
+
form_parameter_hash = {}
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
134
|
+
|
135
|
+
|
136
|
+
end
|
137
|
+
end
|
data/lib/keywords_api.rb
ADDED
@@ -0,0 +1,224 @@
|
|
1
|
+
require "uri"
|
2
|
+
|
3
|
+
class KeywordsApi
|
4
|
+
basePath = "http://api.burst.dev.local/"
|
5
|
+
# apiInvoker = APIInvoker
|
6
|
+
|
7
|
+
def initialize(api_key, api_secret)
|
8
|
+
@api_key = api_key
|
9
|
+
@api_secret = api_secret
|
10
|
+
@sms_api = SmsApi
|
11
|
+
|
12
|
+
@api_key_secret = create_api_key_secret()
|
13
|
+
|
14
|
+
config_swagger()
|
15
|
+
end
|
16
|
+
|
17
|
+
def create_api_key_secret()
|
18
|
+
api_key_secret = Base64.encode64("#{@api_key}:#{@api_secret}")
|
19
|
+
"Basic #{api_key_secret}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def config_swagger()
|
23
|
+
Swagger.configure do |config|
|
24
|
+
config.host = "http://api.burst.dev.local/".gsub("http://", "").gsub("/", "")
|
25
|
+
config.base_path = "/"
|
26
|
+
config.format = "x-www-form-urlencoded"
|
27
|
+
config.camelize_params = false
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
# Add a keyword to an existing virtual number
|
33
|
+
#
|
34
|
+
# @param keyword The first word of a text message
|
35
|
+
# @param number The dedicated virtual number that the keyword belongs to
|
36
|
+
# @param reference Your own reference (up to 100 characters)
|
37
|
+
# @param list_id ID of a list to add respondents to, list ID's can be found in the title of a list or in the list page URL
|
38
|
+
# @param welcome_message SMS message to send to new members
|
39
|
+
# @param members_message SMS message to existing members
|
40
|
+
# @param activate Whether to make the keyword active immediately.
|
41
|
+
# @param forward_url Forward messages to a URL
|
42
|
+
# @param forward_email Forward messages to a set of email addresses
|
43
|
+
# @param forward_sms Forward messages to a set of msisdns
|
44
|
+
# @return void
|
45
|
+
def add_keyword (keyword = nil, number = nil, reference = nil, list_id = nil, welcome_message = nil, members_message = nil, activate = nil, forward_url = nil, forward_email = nil, forward_sms = nil, opts={})
|
46
|
+
query_param_keys = [:keyword,:number,:reference,:list_id,:welcome_message,:members_message,:activate,:forward_url,:forward_email,:forward_sms]
|
47
|
+
headerParams = {}
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
# set default values and merge with input
|
52
|
+
options = {
|
53
|
+
:'keyword' => keyword,
|
54
|
+
:'number' => number,
|
55
|
+
:'reference' => reference,
|
56
|
+
:'list_id' => list_id,
|
57
|
+
:'welcome_message' => welcome_message,
|
58
|
+
:'members_message' => members_message,
|
59
|
+
:'activate' => activate,
|
60
|
+
:'forward_url' => forward_url,
|
61
|
+
:'forward_email' => forward_email,
|
62
|
+
:'forward_sms' => forward_sms
|
63
|
+
|
64
|
+
}.merge(opts)
|
65
|
+
|
66
|
+
#resource path
|
67
|
+
path = "/add-keyword.json".sub('{format}','json')
|
68
|
+
|
69
|
+
# pull querystring keys from options
|
70
|
+
queryopts = options.select do |key,value|
|
71
|
+
query_param_keys.include? key
|
72
|
+
end
|
73
|
+
|
74
|
+
# header parameters
|
75
|
+
headers = {}
|
76
|
+
|
77
|
+
_header_accept = 'application/json'
|
78
|
+
if _header_accept != ''
|
79
|
+
headerParams['Accept'] = _header_accept
|
80
|
+
end
|
81
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
82
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
headers[:'Authorization'] = @api_key_secret
|
87
|
+
|
88
|
+
# http body (model)
|
89
|
+
post_body = nil
|
90
|
+
|
91
|
+
# form parameters
|
92
|
+
form_parameter_hash = {}
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
97
|
+
|
98
|
+
|
99
|
+
end
|
100
|
+
|
101
|
+
# Add a keyword to an existing virtual number
|
102
|
+
#
|
103
|
+
# @param keyword The first word of a text message
|
104
|
+
# @param number The dedicated virtual number that the keyword belongs to
|
105
|
+
# @param reference Your own reference (up to 100 characters)
|
106
|
+
# @param list_id ID of a list to add respondents to, list ID's can be found in the title of a list or in the list page URL
|
107
|
+
# @param welcome_message SMS message to send to new members
|
108
|
+
# @param members_message SMS message to existing members
|
109
|
+
# @param activate Whether to make the keyword active immediately.
|
110
|
+
# @param forward_url Forward messages to a URL
|
111
|
+
# @param forward_email Forward messages to a set of email addresses
|
112
|
+
# @param forward_sms Forward messages to a set of msisdns
|
113
|
+
# @return void
|
114
|
+
def edit_keyword (keyword = nil, number = nil, reference = nil, list_id = nil, welcome_message = nil, members_message = nil, activate = nil, forward_url = nil, forward_email = nil, forward_sms = nil, opts={})
|
115
|
+
query_param_keys = [:keyword,:number,:reference,:list_id,:welcome_message,:members_message,:activate,:forward_url,:forward_email,:forward_sms]
|
116
|
+
headerParams = {}
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
# set default values and merge with input
|
121
|
+
options = {
|
122
|
+
:'keyword' => keyword,
|
123
|
+
:'number' => number,
|
124
|
+
:'reference' => reference,
|
125
|
+
:'list_id' => list_id,
|
126
|
+
:'welcome_message' => welcome_message,
|
127
|
+
:'members_message' => members_message,
|
128
|
+
:'activate' => activate,
|
129
|
+
:'forward_url' => forward_url,
|
130
|
+
:'forward_email' => forward_email,
|
131
|
+
:'forward_sms' => forward_sms
|
132
|
+
|
133
|
+
}.merge(opts)
|
134
|
+
|
135
|
+
#resource path
|
136
|
+
path = "/edit-keyword.json".sub('{format}','json')
|
137
|
+
|
138
|
+
# pull querystring keys from options
|
139
|
+
queryopts = options.select do |key,value|
|
140
|
+
query_param_keys.include? key
|
141
|
+
end
|
142
|
+
|
143
|
+
# header parameters
|
144
|
+
headers = {}
|
145
|
+
|
146
|
+
_header_accept = 'application/json'
|
147
|
+
if _header_accept != ''
|
148
|
+
headerParams['Accept'] = _header_accept
|
149
|
+
end
|
150
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
151
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
headers[:'Authorization'] = @api_key_secret
|
156
|
+
|
157
|
+
# http body (model)
|
158
|
+
post_body = nil
|
159
|
+
|
160
|
+
# form parameters
|
161
|
+
form_parameter_hash = {}
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
166
|
+
|
167
|
+
|
168
|
+
end
|
169
|
+
|
170
|
+
# Get a list of existing keywords.
|
171
|
+
#
|
172
|
+
# @param number Filter the list by virtual number
|
173
|
+
# @param page Page number, for pagination
|
174
|
+
# @param max Maximum results returned per page
|
175
|
+
# @return void
|
176
|
+
def get_keywords (number = nil, page = nil, max = nil, opts={})
|
177
|
+
query_param_keys = [:number,:page,:max]
|
178
|
+
headerParams = {}
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
# set default values and merge with input
|
183
|
+
options = {
|
184
|
+
:'number' => number,
|
185
|
+
:'page' => page,
|
186
|
+
:'max' => max
|
187
|
+
|
188
|
+
}.merge(opts)
|
189
|
+
|
190
|
+
#resource path
|
191
|
+
path = "/get-keywords.json".sub('{format}','json')
|
192
|
+
|
193
|
+
# pull querystring keys from options
|
194
|
+
queryopts = options.select do |key,value|
|
195
|
+
query_param_keys.include? key
|
196
|
+
end
|
197
|
+
|
198
|
+
# header parameters
|
199
|
+
headers = {}
|
200
|
+
|
201
|
+
_header_accept = 'application/json'
|
202
|
+
if _header_accept != ''
|
203
|
+
headerParams['Accept'] = _header_accept
|
204
|
+
end
|
205
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
206
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
headers[:'Authorization'] = @api_key_secret
|
211
|
+
|
212
|
+
# http body (model)
|
213
|
+
post_body = nil
|
214
|
+
|
215
|
+
# form parameters
|
216
|
+
form_parameter_hash = {}
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
221
|
+
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|