ruby-transmitsms 0.0.1
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 +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
data/lib/monkey.rb
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
# module Swagger
|
2
|
+
class Object
|
3
|
+
|
4
|
+
unless Object.method_defined? :blank?
|
5
|
+
def blank?
|
6
|
+
respond_to?(:empty?) ? empty? : !self
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
unless Object.method_defined? :present?
|
11
|
+
def present?
|
12
|
+
!blank?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
class String
|
19
|
+
|
20
|
+
unless String.method_defined? :underscore
|
21
|
+
def underscore
|
22
|
+
self.gsub(/::/, '/').
|
23
|
+
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
|
24
|
+
gsub(/([a-z\d])([A-Z])/,'\1_\2').
|
25
|
+
tr("-", "_").
|
26
|
+
downcase
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
unless String.method_defined? :camelize
|
31
|
+
def camelize(first_letter_in_uppercase = true)
|
32
|
+
if first_letter_in_uppercase != :lower
|
33
|
+
self.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase }
|
34
|
+
else
|
35
|
+
self.to_s[0].chr.downcase + camelize(self)[1..-1]
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
class Hash
|
43
|
+
|
44
|
+
unless Hash.method_defined? :stringify_keys
|
45
|
+
def stringify_keys
|
46
|
+
inject({}) do |options, (key, value)|
|
47
|
+
options[key.to_s] = value
|
48
|
+
options
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
unless Hash.method_defined? :stringify_keys!
|
54
|
+
def stringify_keys!
|
55
|
+
self.replace(self.stringify_keys)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
unless Hash.method_defined? :symbolize_keys
|
60
|
+
def symbolize_keys
|
61
|
+
inject({}) do |options, (key, value)|
|
62
|
+
options[(key.to_sym rescue key) || key] = value
|
63
|
+
options
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
unless Hash.method_defined? :symbolize_keys!
|
69
|
+
def symbolize_keys!
|
70
|
+
self.replace(self.symbolize_keys)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
unless Hash.method_defined? :symbolize_and_underscore_keys
|
75
|
+
def symbolize_and_underscore_keys
|
76
|
+
inject({}) do |options, (key, value)|
|
77
|
+
options[(key.to_s.underscore.to_sym rescue key) || key] = value
|
78
|
+
options
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
unless Hash.method_defined? :symbolize_and_underscore_keys!
|
84
|
+
def symbolize_and_underscore_keys!
|
85
|
+
self.replace(self.symbolize_and_underscore_keys)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
end
|
90
|
+
# end
|
data/lib/numbers_api.rb
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
require "uri"
|
2
|
+
|
3
|
+
class NumbersApi
|
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 detailed information about a response number you have leased.
|
33
|
+
#
|
34
|
+
# @param number The virtual number to retrieve
|
35
|
+
# @return void
|
36
|
+
def get_number (number = nil, opts={})
|
37
|
+
query_param_keys = [:number]
|
38
|
+
headerParams = {}
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
# set default values and merge with input
|
43
|
+
options = {
|
44
|
+
:'number' => number
|
45
|
+
|
46
|
+
}.merge(opts)
|
47
|
+
|
48
|
+
#resource path
|
49
|
+
path = "/get-number.json".sub('{format}','json')
|
50
|
+
|
51
|
+
# pull querystring keys from options
|
52
|
+
queryopts = options.select do |key,value|
|
53
|
+
query_param_keys.include? key
|
54
|
+
end
|
55
|
+
|
56
|
+
# header parameters
|
57
|
+
headers = {}
|
58
|
+
|
59
|
+
_header_accept = 'application/json'
|
60
|
+
if _header_accept != ''
|
61
|
+
headerParams['Accept'] = _header_accept
|
62
|
+
end
|
63
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
64
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
headers[:'Authorization'] = @api_key_secret
|
69
|
+
|
70
|
+
# http body (model)
|
71
|
+
post_body = nil
|
72
|
+
|
73
|
+
# form parameters
|
74
|
+
form_parameter_hash = {}
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
79
|
+
|
80
|
+
|
81
|
+
end
|
82
|
+
|
83
|
+
# Get a list of numbers either leased by you or available to be leased.
|
84
|
+
#
|
85
|
+
# @param filter Possible values are owned and available
|
86
|
+
# @param page Page number, for pagination
|
87
|
+
# @param max Maximum results returned per page
|
88
|
+
# @return void
|
89
|
+
def get_numbers (filter = nil, page = nil, max = nil, opts={})
|
90
|
+
query_param_keys = [:filter,:page,:max]
|
91
|
+
headerParams = {}
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
# set default values and merge with input
|
96
|
+
options = {
|
97
|
+
:'filter' => filter,
|
98
|
+
:'page' => page,
|
99
|
+
:'max' => max
|
100
|
+
|
101
|
+
}.merge(opts)
|
102
|
+
|
103
|
+
#resource path
|
104
|
+
path = "/get-numbers.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
|
+
|
138
|
+
# Lease a dedicated virtual number
|
139
|
+
#
|
140
|
+
# @param number The virtual number to lease. Omit this field to be given a random number. Use get-numbers to find out which numbers are currently available.
|
141
|
+
# @return void
|
142
|
+
def lease_number (number = nil, opts={})
|
143
|
+
query_param_keys = [:number]
|
144
|
+
headerParams = {}
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
# set default values and merge with input
|
149
|
+
options = {
|
150
|
+
:'number' => number
|
151
|
+
|
152
|
+
}.merge(opts)
|
153
|
+
|
154
|
+
#resource path
|
155
|
+
path = "/lease-number.json".sub('{format}','json')
|
156
|
+
|
157
|
+
# pull querystring keys from options
|
158
|
+
queryopts = options.select do |key,value|
|
159
|
+
query_param_keys.include? key
|
160
|
+
end
|
161
|
+
|
162
|
+
# header parameters
|
163
|
+
headers = {}
|
164
|
+
|
165
|
+
_header_accept = 'application/json'
|
166
|
+
if _header_accept != ''
|
167
|
+
headerParams['Accept'] = _header_accept
|
168
|
+
end
|
169
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
170
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
headers[:'Authorization'] = @api_key_secret
|
175
|
+
|
176
|
+
# http body (model)
|
177
|
+
post_body = nil
|
178
|
+
|
179
|
+
# form parameters
|
180
|
+
form_parameter_hash = {}
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
185
|
+
|
186
|
+
|
187
|
+
end
|
188
|
+
end
|
@@ -0,0 +1,379 @@
|
|
1
|
+
require "uri"
|
2
|
+
|
3
|
+
class ResellersApi
|
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 new client.
|
33
|
+
#
|
34
|
+
# @param name Client company name
|
35
|
+
# @param contact Contact name
|
36
|
+
# @param email Client email address
|
37
|
+
# @param password Client password
|
38
|
+
# @param msisdn Client phone number
|
39
|
+
# @param timezone A valid timezone, Australia/Sydney. Defaults to your own
|
40
|
+
# @param client_pays Set to true if the client will pay (the default) or false if you will pay
|
41
|
+
# @param sms_margin The number of cents to add to the base SMS price. A decimal value
|
42
|
+
# @param number_margin The number of cents to add to the base Number price. A decimal value
|
43
|
+
# @return void
|
44
|
+
def add_client (name = nil, contact = nil, email = nil, password = nil, msisdn = nil, timezone = nil, client_pays = nil, sms_margin = nil, number_margin = nil, opts={})
|
45
|
+
query_param_keys = [:name,:contact,:email,:password,:msisdn,:timezone,:client_pays,:sms_margin,:number_margin]
|
46
|
+
headerParams = {}
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
# set default values and merge with input
|
51
|
+
options = {
|
52
|
+
:'name' => name,
|
53
|
+
:'contact' => contact,
|
54
|
+
:'email' => email,
|
55
|
+
:'password' => password,
|
56
|
+
:'msisdn' => msisdn,
|
57
|
+
:'timezone' => timezone,
|
58
|
+
:'client_pays' => client_pays,
|
59
|
+
:'sms_margin' => sms_margin,
|
60
|
+
:'number_margin' => number_margin
|
61
|
+
|
62
|
+
}.merge(opts)
|
63
|
+
|
64
|
+
#resource path
|
65
|
+
path = "/add-client.json".sub('{format}','json')
|
66
|
+
|
67
|
+
# pull querystring keys from options
|
68
|
+
queryopts = options.select do |key,value|
|
69
|
+
query_param_keys.include? key
|
70
|
+
end
|
71
|
+
|
72
|
+
# header parameters
|
73
|
+
headers = {}
|
74
|
+
|
75
|
+
_header_accept = 'application/json'
|
76
|
+
if _header_accept != ''
|
77
|
+
headerParams['Accept'] = _header_accept
|
78
|
+
end
|
79
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
80
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
headers[:'Authorization'] = @api_key_secret
|
85
|
+
|
86
|
+
# http body (model)
|
87
|
+
post_body = nil
|
88
|
+
|
89
|
+
# form parameters
|
90
|
+
form_parameter_hash = {}
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
95
|
+
|
96
|
+
|
97
|
+
end
|
98
|
+
|
99
|
+
# Edit an existing client
|
100
|
+
#
|
101
|
+
# @param client_id The ID of the client
|
102
|
+
# @param name Client company name
|
103
|
+
# @param contact Contact name
|
104
|
+
# @param email Client email address
|
105
|
+
# @param password Client password
|
106
|
+
# @param msisdn Client phone number
|
107
|
+
# @param timezone A valid timezone, Australia/Sydney. Defaults to your own
|
108
|
+
# @param client_pays Set to true if the client will pay (the default) or false if you will pay
|
109
|
+
# @param sms_margin The number of cents to add to the base SMS price. A decimal value
|
110
|
+
# @return void
|
111
|
+
def edit_client (client_id = nil, name = nil, contact = nil, email = nil, password = nil, msisdn = nil, timezone = nil, client_pays = nil, sms_margin = nil, opts={})
|
112
|
+
query_param_keys = [:client_id,:name,:contact,:email,:password,:msisdn,:timezone,:client_pays,:sms_margin]
|
113
|
+
headerParams = {}
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
# set default values and merge with input
|
118
|
+
options = {
|
119
|
+
:'client_id' => client_id,
|
120
|
+
:'name' => name,
|
121
|
+
:'contact' => contact,
|
122
|
+
:'email' => email,
|
123
|
+
:'password' => password,
|
124
|
+
:'msisdn' => msisdn,
|
125
|
+
:'timezone' => timezone,
|
126
|
+
:'client_pays' => client_pays,
|
127
|
+
:'sms_margin' => sms_margin
|
128
|
+
|
129
|
+
}.merge(opts)
|
130
|
+
|
131
|
+
#resource path
|
132
|
+
path = "/edit-client.json".sub('{format}','json')
|
133
|
+
|
134
|
+
# pull querystring keys from options
|
135
|
+
queryopts = options.select do |key,value|
|
136
|
+
query_param_keys.include? key
|
137
|
+
end
|
138
|
+
|
139
|
+
# header parameters
|
140
|
+
headers = {}
|
141
|
+
|
142
|
+
_header_accept = 'application/json'
|
143
|
+
if _header_accept != ''
|
144
|
+
headerParams['Accept'] = _header_accept
|
145
|
+
end
|
146
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
147
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
headers[:'Authorization'] = @api_key_secret
|
152
|
+
|
153
|
+
# http body (model)
|
154
|
+
post_body = nil
|
155
|
+
|
156
|
+
# form parameters
|
157
|
+
form_parameter_hash = {}
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
162
|
+
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
# Get detailed information about a client.
|
167
|
+
#
|
168
|
+
# @param client_id The ID of the client
|
169
|
+
# @return void
|
170
|
+
def get_client (client_id = nil, opts={})
|
171
|
+
query_param_keys = [:client_id]
|
172
|
+
headerParams = {}
|
173
|
+
|
174
|
+
|
175
|
+
|
176
|
+
# set default values and merge with input
|
177
|
+
options = {
|
178
|
+
:'client_id' => client_id
|
179
|
+
|
180
|
+
}.merge(opts)
|
181
|
+
|
182
|
+
#resource path
|
183
|
+
path = "/get-client.json".sub('{format}','json')
|
184
|
+
|
185
|
+
# pull querystring keys from options
|
186
|
+
queryopts = options.select do |key,value|
|
187
|
+
query_param_keys.include? key
|
188
|
+
end
|
189
|
+
|
190
|
+
# header parameters
|
191
|
+
headers = {}
|
192
|
+
|
193
|
+
_header_accept = 'application/json'
|
194
|
+
if _header_accept != ''
|
195
|
+
headerParams['Accept'] = _header_accept
|
196
|
+
end
|
197
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
198
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
199
|
+
|
200
|
+
|
201
|
+
|
202
|
+
headers[:'Authorization'] = @api_key_secret
|
203
|
+
|
204
|
+
# http body (model)
|
205
|
+
post_body = nil
|
206
|
+
|
207
|
+
# form parameters
|
208
|
+
form_parameter_hash = {}
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
213
|
+
|
214
|
+
|
215
|
+
end
|
216
|
+
|
217
|
+
# Get a list of all clients.
|
218
|
+
#
|
219
|
+
# @param page Page number, for pagination
|
220
|
+
# @param max Maximum results returned per page
|
221
|
+
# @return void
|
222
|
+
def get_clients (page = nil, max = nil, opts={})
|
223
|
+
query_param_keys = [:page,:max]
|
224
|
+
headerParams = {}
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
# set default values and merge with input
|
229
|
+
options = {
|
230
|
+
:'page' => page,
|
231
|
+
:'max' => max
|
232
|
+
|
233
|
+
}.merge(opts)
|
234
|
+
|
235
|
+
#resource path
|
236
|
+
path = "/get-clients.json".sub('{format}','json')
|
237
|
+
|
238
|
+
# pull querystring keys from options
|
239
|
+
queryopts = options.select do |key,value|
|
240
|
+
query_param_keys.include? key
|
241
|
+
end
|
242
|
+
|
243
|
+
# header parameters
|
244
|
+
headers = {}
|
245
|
+
|
246
|
+
_header_accept = 'application/json'
|
247
|
+
if _header_accept != ''
|
248
|
+
headerParams['Accept'] = _header_accept
|
249
|
+
end
|
250
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
251
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
headers[:'Authorization'] = @api_key_secret
|
256
|
+
|
257
|
+
# http body (model)
|
258
|
+
post_body = nil
|
259
|
+
|
260
|
+
# form parameters
|
261
|
+
form_parameter_hash = {}
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
266
|
+
|
267
|
+
|
268
|
+
end
|
269
|
+
|
270
|
+
# Get a list of transactions for a client.
|
271
|
+
#
|
272
|
+
# @param id Transaction ID
|
273
|
+
# @return void
|
274
|
+
def get_transaction (id = nil, opts={})
|
275
|
+
query_param_keys = [:id]
|
276
|
+
headerParams = {}
|
277
|
+
|
278
|
+
|
279
|
+
|
280
|
+
# set default values and merge with input
|
281
|
+
options = {
|
282
|
+
:'id' => id
|
283
|
+
|
284
|
+
}.merge(opts)
|
285
|
+
|
286
|
+
#resource path
|
287
|
+
path = "/get-transaction.json".sub('{format}','json')
|
288
|
+
|
289
|
+
# pull querystring keys from options
|
290
|
+
queryopts = options.select do |key,value|
|
291
|
+
query_param_keys.include? key
|
292
|
+
end
|
293
|
+
|
294
|
+
# header parameters
|
295
|
+
headers = {}
|
296
|
+
|
297
|
+
_header_accept = 'application/json'
|
298
|
+
if _header_accept != ''
|
299
|
+
headerParams['Accept'] = _header_accept
|
300
|
+
end
|
301
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
302
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
headers[:'Authorization'] = @api_key_secret
|
307
|
+
|
308
|
+
# http body (model)
|
309
|
+
post_body = nil
|
310
|
+
|
311
|
+
# form parameters
|
312
|
+
form_parameter_hash = {}
|
313
|
+
|
314
|
+
|
315
|
+
|
316
|
+
Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
317
|
+
|
318
|
+
|
319
|
+
end
|
320
|
+
|
321
|
+
# Get a list of transactions for an account.
|
322
|
+
#
|
323
|
+
# @param client_id Only retrieve records for a particular client
|
324
|
+
# @param start A timestamp to start the report from
|
325
|
+
# @param _end A timestamp to end the report at
|
326
|
+
# @param page Page number, for pagination
|
327
|
+
# @param max Maximum results returned per page
|
328
|
+
# @return void
|
329
|
+
def get_transactions (client_id = nil, start = nil, _end = nil, page = nil, max = nil, opts={})
|
330
|
+
query_param_keys = [:client_id,:start,:_end,:page,:max]
|
331
|
+
headerParams = {}
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
# set default values and merge with input
|
336
|
+
options = {
|
337
|
+
:'client_id' => client_id,
|
338
|
+
:'start' => start,
|
339
|
+
:'_end' => _end,
|
340
|
+
:'page' => page,
|
341
|
+
:'max' => max
|
342
|
+
|
343
|
+
}.merge(opts)
|
344
|
+
|
345
|
+
#resource path
|
346
|
+
path = "/get-transactions.json".sub('{format}','json')
|
347
|
+
|
348
|
+
# pull querystring keys from options
|
349
|
+
queryopts = options.select do |key,value|
|
350
|
+
query_param_keys.include? key
|
351
|
+
end
|
352
|
+
|
353
|
+
# header parameters
|
354
|
+
headers = {}
|
355
|
+
|
356
|
+
_header_accept = 'application/json'
|
357
|
+
if _header_accept != ''
|
358
|
+
headerParams['Accept'] = _header_accept
|
359
|
+
end
|
360
|
+
_header_content_type = ['application/x-www-form-urlencoded']
|
361
|
+
headerParams['Content-Type'] = _header_content_type.length > 0 ? _header_content_type[0] : 'application/json'
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
headers[:'Authorization'] = @api_key_secret
|
366
|
+
|
367
|
+
# http body (model)
|
368
|
+
post_body = nil
|
369
|
+
|
370
|
+
# form parameters
|
371
|
+
form_parameter_hash = {}
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body, :form_params => form_parameter_hash }).make
|
376
|
+
|
377
|
+
|
378
|
+
end
|
379
|
+
end
|