ige_isb_api 1.1.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 299873ceac662d947ddcceb491ef8923864d821b
4
- data.tar.gz: bbdc6d208261b855dd1c51bd031c006be3562e9c
3
+ metadata.gz: 2a0598200aa8da360e75d735127dd278f92d6c62
4
+ data.tar.gz: 4d1b31f6327eaddbd62a9433bb631641e94c4073
5
5
  SHA512:
6
- metadata.gz: a6686acbc0d83641cb2fa1a0ca7a5ba04a4006ee6cf38439050dcf09c7f9e2206f0cbf29c1817ed37c7c15af28d4ef136b41f2612796b976d28af517306e4439
7
- data.tar.gz: 0bf2535b3e823bee02c2398c96fa3e2a52288a7bd6549fca595f43a48ae3272c9b6aa08b8c3317a143a2f89537ecf59111b18963498c03f28487ee5e17e600ca
6
+ metadata.gz: 8e852c53bdd61b97086cf53b6a397a94f09bff002db832191a223ff4fe724096de58e1dbb975f98a9712e1488ec79fa6f45bcb23bcab86e9bbcc82a70441a175
7
+ data.tar.gz: 733667b0820942f85eb0c480c839138eec999cce842b80db8825697c5eccd1bea6d2a6fb9b464b4313b1ba7a03e55355ba392a684c5aad3dbfaab61ed56af364
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ige_isb_api (1.1.1)
4
+ ige_isb_api (1.1.2)
5
5
  nokogiri
6
6
  rfc-822
7
7
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  module IGE_ISB_API
5
5
  class Constants
6
- API_VERSION = '2.1'
6
+ API_VERSION = '2.2'
7
7
 
8
8
  LICENSEE_ID = ENV['ISB_LICENSEE_ID'].to_i # issued by ISB
9
9
  CASINO = ENV['ISB_CASINO_ID'] # issued by ISB
@@ -67,7 +67,7 @@ module IGE_ISB_API
67
67
  'email' => {:required => true, :type => 'string', :length => 32},
68
68
  'carte' => {:required => true, :type => 'string', :length => 32},
69
69
  'emailtemplate' => {:required => true, :type => 'string', :length => 32},
70
- 'emailparameters' => {:required => true, :type => 'string', :length => 32}
70
+ 'emailparameters' => {:required => true, :type => 'string'}
71
71
  },
72
72
  'limits' => {
73
73
  'limitationtype' => {:required => true, :type => 'limit'},
@@ -21,6 +21,42 @@ module IGE_ISB_API
21
21
  }.merge(opts)
22
22
  end
23
23
 
24
+ # the following options *must* be passed in.
25
+ # wallet: "the name of the payment processor being used",
26
+ # reference: "the original reference",
27
+ #
28
+ # The following may be passed in and are presented here with their defaults.
29
+ # cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE
30
+ def adapt_deposit_reference(opts = {})
31
+ # 'CAS'+wallet parameter +reference parameter+cur parameter
32
+ # see https://github.com/Interactive-Gaming-Entertainment/IGE-ISB-API/issues/18
33
+ raise ArgumentError, "Missing options." if opts.empty?
34
+ raise ArgumentError, "Missing wallet." if opts[:wallet].nil?
35
+ raise ArgumentError, "Missing original reference." if opts[:reference].nil?
36
+ params = {
37
+ cur: options[:cur]
38
+ }.merge(opts)
39
+ return "CAS#{params[:wallet]}#{params[:reference]}#{params[:cur]}"
40
+ end
41
+
42
+ # the following options *must* be passed in.
43
+ # wallet: "the name of the payment processor being used",
44
+ # reference: "the original reference",
45
+ #
46
+ # The following may be passed in and are presented here with their defaults.
47
+ # cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE
48
+ def adapt_withdrawal_reference(opts = {})
49
+ # 'CASWire:'+withdrawal id+cur parameter+reference parameter
50
+ # see https://github.com/Interactive-Gaming-Entertainment/IGE-ISB-API/issues/18
51
+ raise ArgumentError, "Missing options." if opts.empty?
52
+ raise ArgumentError, "Missing withdrawal id." if opts[:withdrawalid].nil?
53
+ raise ArgumentError, "Missing original reference." if opts[:reference].nil?
54
+ params = {
55
+ cur: options[:cur]
56
+ }.merge(opts)
57
+ return "CASWire:#{params[:withdrawalid]}#{params[:cur]}#{params[:reference]}"
58
+ end
59
+
24
60
  # Each command has a label which is used by the casino to tag a group of interactions with ISB
25
61
  # Additionally each transaction must include a unique transaction ID.
26
62
  # the following options *must* be passed in.
@@ -43,16 +79,16 @@ module IGE_ISB_API
43
79
  def register(label = '', txid = 0, opts = {})
44
80
  validate_params!(label, txid)
45
81
  raise ArgumentError, "Missing options." if opts.empty?
46
- @params = { idrequest: label,
47
- username: @options[:username],
48
- password: @options[:password],
49
- status: @options[:status],
50
- cur: @options[:cur],
51
- lang: @options[:lang],
52
- carte: @options[:carte],
82
+ params = { idrequest: label,
83
+ username: options[:username],
84
+ password: options[:password],
85
+ status: options[:status],
86
+ cur: options[:cur],
87
+ lang: options[:lang],
88
+ carte: options[:carte],
53
89
  gender: IGE_ISB_API::Constants::MALE,
54
90
  txid: txid}.merge(opts).merge({ command: 'registration', idaffiliation: IGE_ISB_API::Constants::LICENSEE_ID })
55
- request = IGE_ISB_API.request(@params)
91
+ request = IGE_ISB_API.request(params)
56
92
  resp = request.send
57
93
  response = JSON.parse(resp.body)
58
94
  return response
@@ -65,12 +101,12 @@ module IGE_ISB_API
65
101
  # a different casino under the control of the same licensee.
66
102
  def login(label = '', txid = 0, opts = {})
67
103
  validate_params!(label, txid)
68
- @params = { idrequest: label,
69
- username: @options[:username],
70
- password: @options[:password],
71
- carte: @options[:carte],
104
+ params = { idrequest: label,
105
+ username: options[:username],
106
+ password: options[:password],
107
+ carte: options[:carte],
72
108
  txid: txid}.merge(opts).merge({ command: 'login' })
73
- request = IGE_ISB_API.request(@params)
109
+ request = IGE_ISB_API.request(params)
74
110
  resp = request.send
75
111
  response = JSON.parse(resp.body)
76
112
  return response
@@ -88,14 +124,14 @@ module IGE_ISB_API
88
124
  def deposit(label = '', txid = 0, opts = {})
89
125
  validate_params!(label, txid)
90
126
  raise ArgumentError, "Missing options." if opts.empty?
91
- @params = { idrequest: label,
92
- username: @options[:username],
93
- password: @options[:password],
94
- cur: @options[:cur],
127
+ params = { idrequest: label,
128
+ username: options[:username],
129
+ password: options[:password],
130
+ cur: options[:cur],
95
131
  txid: txid}.merge(opts).merge({ command: 'deposit' })
96
132
  # reference = "#{@params[:wallet]}:#{@params[:reference]}#{@params[:cur]}"
97
133
  # @params[:reference] = reference
98
- request = IGE_ISB_API.request(@params)
134
+ request = IGE_ISB_API.request(params)
99
135
  resp = request.send
100
136
  response = JSON.parse(resp.body)
101
137
  return response
@@ -113,13 +149,12 @@ module IGE_ISB_API
113
149
  def withdrawal(label = '', txid = 0, opts = {})
114
150
  validate_params!(label, txid)
115
151
  raise ArgumentError, "Missing options." if opts.empty?
116
- @params = { idrequest: label,
117
- username: @options[:username],
118
- password: @options[:password],
119
- cur: @options[:cur],
152
+ params = { idrequest: label,
153
+ username: options[:username],
154
+ password: options[:password],
155
+ cur: options[:cur],
120
156
  txid: txid}.merge(opts).merge({ command: 'withdrawal' })
121
- @params[:reference] = "#{@params[:reference]}#{@params[:cur]}" unless @params[:reference][-3,3] == @params[:cur]
122
- request = IGE_ISB_API.request(@params)
157
+ request = IGE_ISB_API.request(params)
123
158
  resp = request.send
124
159
  response = JSON.parse(resp.body)
125
160
  return response
@@ -132,11 +167,11 @@ module IGE_ISB_API
132
167
  def cancel_withdrawal(label = '', txid = 0, opts = {})
133
168
  validate_params!(label, txid)
134
169
  raise ArgumentError, "Missing options." if opts.empty?
135
- @params = { idrequest: label,
136
- username: @options[:username],
137
- password: @options[:password],
170
+ params = { idrequest: label,
171
+ username: options[:username],
172
+ password: options[:password],
138
173
  txid: txid}.merge(opts).merge({ command: 'cancel_withdrawal' })
139
- request = IGE_ISB_API.request(@params)
174
+ request = IGE_ISB_API.request(params)
140
175
  resp = request.send
141
176
  response = JSON.parse(resp.body)
142
177
  return response
@@ -146,11 +181,11 @@ module IGE_ISB_API
146
181
  # Additionally each transaction must include a unique transaction ID.
147
182
  def get_history(label = '', txid = 0, opts = {})
148
183
  validate_params!(label, txid)
149
- @params = { idrequest: label,
150
- username: @options[:username],
151
- password: @options[:password],
184
+ params = { idrequest: label,
185
+ username: options[:username],
186
+ password: options[:password],
152
187
  txid: txid}.merge(opts).merge({ command: 'get_history' })
153
- request = IGE_ISB_API.request(@params)
188
+ request = IGE_ISB_API.request(params)
154
189
  resp = request.send
155
190
  response = JSON.parse(resp.body)
156
191
  return response
@@ -167,12 +202,12 @@ module IGE_ISB_API
167
202
  def send_email(label = '', txid = 0, opts = {})
168
203
  validate_params!(label, txid)
169
204
  raise ArgumentError, "Missing options." if opts.empty?
170
- @params = { idrequest: label,
171
- username: @options[:username],
172
- password: @options[:password],
173
- carte: @options[:carte],
205
+ params = { idrequest: label,
206
+ username: options[:username],
207
+ password: options[:password],
208
+ carte: options[:carte],
174
209
  txid: txid}.merge(opts).merge({ command: 'send_email' })
175
- request = IGE_ISB_API.request(@params)
210
+ request = IGE_ISB_API.request(params)
176
211
  resp = request.send
177
212
  response = JSON.parse(resp.body)
178
213
  return response
@@ -191,11 +226,11 @@ module IGE_ISB_API
191
226
  def limits(label = '', txid = 0, opts = {})
192
227
  validate_params!(label, txid)
193
228
  raise ArgumentError, "Missing options." if opts.empty?
194
- @params = { idrequest: label,
195
- username: @options[:username],
196
- password: @options[:password],
229
+ params = { idrequest: label,
230
+ username: options[:username],
231
+ password: options[:password],
197
232
  txid: txid}.merge(opts).merge({ command: 'limits' })
198
- request = IGE_ISB_API.request(@params)
233
+ request = IGE_ISB_API.request(params)
199
234
  resp = request.send
200
235
  response = JSON.parse(resp.body)
201
236
  return response
@@ -205,11 +240,11 @@ module IGE_ISB_API
205
240
  # Additionally each transaction must include a unique transaction ID.
206
241
  def deactivate(label = '', txid = 0)
207
242
  validate_params!(label, txid)
208
- @params = { idrequest: label,
209
- username: @options[:username],
210
- password: @options[:password],
243
+ params = { idrequest: label,
244
+ username: options[:username],
245
+ password: options[:password],
211
246
  txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_INACTIVE })
212
- request = IGE_ISB_API.request(@params)
247
+ request = IGE_ISB_API.request(params)
213
248
  resp = request.send
214
249
  response = JSON.parse(resp.body)
215
250
  return response
@@ -219,11 +254,11 @@ module IGE_ISB_API
219
254
  # Additionally each transaction must include a unique transaction ID.
220
255
  def activate(label = '', txid = 0)
221
256
  validate_params!(label, txid)
222
- @params = { idrequest: label,
223
- username: @options[:username],
224
- password: @options[:password],
257
+ params = { idrequest: label,
258
+ username: options[:username],
259
+ password: options[:password],
225
260
  txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_ACTIVE })
226
- request = IGE_ISB_API.request(@params)
261
+ request = IGE_ISB_API.request(params)
227
262
  resp = request.send
228
263
  response = JSON.parse(resp.body)
229
264
  return response
@@ -233,11 +268,11 @@ module IGE_ISB_API
233
268
  # Additionally each transaction must include a unique transaction ID.
234
269
  def ban(label = '', txid = 0)
235
270
  validate_params!(label, txid)
236
- @params = { idrequest: label,
237
- username: @options[:username],
238
- password: @options[:password],
271
+ params = { idrequest: label,
272
+ username: options[:username],
273
+ password: options[:password],
239
274
  txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_BANNED })
240
- request = IGE_ISB_API.request(@params)
275
+ request = IGE_ISB_API.request(params)
241
276
  resp = request.send
242
277
  response = JSON.parse(resp.body)
243
278
  return response
@@ -250,11 +285,11 @@ module IGE_ISB_API
250
285
  def change_password(label = '', txid = 0, opts = {})
251
286
  validate_params!(label, txid)
252
287
  raise ArgumentError, "Missing options." if opts.empty?
253
- @params = { idrequest: label,
254
- username: @options[:username],
255
- password: @options[:password],
288
+ params = { idrequest: label,
289
+ username: options[:username],
290
+ password: options[:password],
256
291
  txid: txid}.merge(opts).merge({ command: 'pass'})
257
- request = IGE_ISB_API.request(@params)
292
+ request = IGE_ISB_API.request(params)
258
293
  resp = request.send
259
294
  response = JSON.parse(resp.body)
260
295
  return response
@@ -264,11 +299,11 @@ module IGE_ISB_API
264
299
  # Additionally each transaction must include a unique transaction ID.
265
300
  def get_vip_points(label = '', txid = 0)
266
301
  validate_params!(label, txid)
267
- @params = { idrequest: label,
268
- username: @options[:username],
269
- password: @options[:password],
302
+ params = { idrequest: label,
303
+ username: options[:username],
304
+ password: options[:password],
270
305
  txid: txid}.merge({ command: 'get_vip_points' })
271
- request = IGE_ISB_API.request(@params)
306
+ request = IGE_ISB_API.request(params)
272
307
  resp = request.send
273
308
  response = JSON.parse(resp.body)
274
309
  return response
@@ -283,11 +318,11 @@ module IGE_ISB_API
283
318
  def save_friend_email(label = '', txid = 0, opts = {})
284
319
  validate_params!(label, txid)
285
320
  raise ArgumentError, "Missing options." if opts.empty?
286
- @params = { idrequest: label,
287
- username: @options[:username],
288
- password: @options[:password],
321
+ params = { idrequest: label,
322
+ username: options[:username],
323
+ password: options[:password],
289
324
  txid: txid}.merge(opts).merge({ command: 'save_friend_email'})
290
- request = IGE_ISB_API.request(@params)
325
+ request = IGE_ISB_API.request(params)
291
326
  resp = request.send
292
327
  response = JSON.parse(resp.body)
293
328
  return response
@@ -295,6 +330,8 @@ module IGE_ISB_API
295
330
 
296
331
  private
297
332
 
333
+ attr_reader :options
334
+
298
335
  def validate_params!(label, txid)
299
336
  raise ArgumentError, "Missing a valid label." if label.empty?
300
337
  raise ArgumentError, "Missing a valid transaction ID." if txid <= 0
@@ -2,5 +2,5 @@
2
2
  #coding: utf-8
3
3
 
4
4
  module IGE_ISB_API
5
- VERSION = "1.1.1"
5
+ VERSION = "1.1.2"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ige_isb_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Sag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-11 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -94,7 +94,7 @@ dependencies:
94
94
  - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: Implements all of the features of the ISB API version 2.1.
97
+ description: Implements all of the features of the ISB API version 2.2.
98
98
  email:
99
99
  - davesag@gmail.com
100
100
  executables: []
@@ -139,5 +139,5 @@ rubyforge_project:
139
139
  rubygems_version: 2.1.11
140
140
  signing_key:
141
141
  specification_version: 4
142
- summary: A Ruby Wrapper for the ISB API version 2.1
142
+ summary: A Ruby Wrapper for the ISB API version 2.2
143
143
  test_files: []