Class: IGE_ISB_API::UserAPI

Inherits:
Object
  • Object
show all
Defined in:
lib/ige_isb_api/user_api.rb

Instance Method Summary collapse

Constructor Details

#initialize(player_status = IGE_ISB_API::Constants::TEST, opts = {}) ⇒ UserAPI

the following options must be passed in.

username: "some_username specific to iSoftBet",
password: "should be specific to iSoftBet",

The following options may be passed in and are presented here with their defaults.

cur: IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE,
carte: IGE_ISB_API::Constants::CASINO,
lang: IGE_ISB_API::Constants::DEFAULT_LANGUAGE,

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
# File 'lib/ige_isb_api/user_api.rb', line 14

def initialize(player_status = IGE_ISB_API::Constants::TEST, opts = {})
  raise ArgumentError, "Missing options." if opts.empty?
  @options = {
    cur: IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE,
    carte: IGE_ISB_API::Constants::CASINO,
    lang: IGE_ISB_API::Constants::DEFAULT_LANGUAGE,
    status: player_status
  }.merge(opts)
end

Instance Method Details

#activate(label = '', txid = 0) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID.



255
256
257
258
259
260
261
262
263
264
265
# File 'lib/ige_isb_api/user_api.rb', line 255

def activate(label = '', txid = 0)
  validate_params!(label, txid)
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_ACTIVE })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#adapt_deposit_reference(opts = {}) ⇒ Object

the following options must be passed in.

wallet: "the name of the payment processor being used",
reference: "the original reference",

The following may be passed in and are presented here with their defaults.

cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE

Raises:

  • (ArgumentError)


30
31
32
33
34
35
36
37
38
39
40
# File 'lib/ige_isb_api/user_api.rb', line 30

def adapt_deposit_reference(opts = {})
  # 'CAS'+wallet parameter +reference parameter+cur parameter
  # see https://github.com/Interactive-Gaming-Entertainment/IGE-ISB-API/issues/18
  raise ArgumentError, "Missing options." if opts.empty?
  raise ArgumentError, "Missing wallet." if opts[:wallet].nil?
  raise ArgumentError, "Missing original reference." if opts[:reference].nil?
  params = {
    cur: options[:cur]
  }.merge(opts)
  return "CAS#{params[:wallet]}#{params[:reference]}#{params[:cur]}"
end

#adapt_withdrawal_reference(opts = {}) ⇒ Object

the following options must be passed in.

wallet: "the name of the payment processor being used",
reference: "the original reference",

The following may be passed in and are presented here with their defaults.

cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE

Raises:

  • (ArgumentError)


48
49
50
51
52
53
54
55
56
57
58
# File 'lib/ige_isb_api/user_api.rb', line 48

def adapt_withdrawal_reference(opts = {})
  # 'CASWire:'+withdrawal id+cur parameter+reference parameter
  # see https://github.com/Interactive-Gaming-Entertainment/IGE-ISB-API/issues/18
  raise ArgumentError, "Missing options." if opts.empty?
  raise ArgumentError, "Missing withdrawal id." if opts[:withdrawalid].nil?
  raise ArgumentError, "Missing original reference." if opts[:reference].nil?
  params = {
    cur: options[:cur]
  }.merge(opts)
  return "CASWire:#{params[:withdrawalid]}#{params[:cur]}#{params[:reference]}"
end

#ban(label = '', txid = 0) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID.



269
270
271
272
273
274
275
276
277
278
279
# File 'lib/ige_isb_api/user_api.rb', line 269

def ban(label = '', txid = 0)
  validate_params!(label, txid)
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_BANNED })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#cancel_withdrawal(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following options must be passed in.

withdrawalid: the txid of the withdrawal to be cancelled,

Raises:

  • (ArgumentError)


167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/ige_isb_api/user_api.rb', line 167

def cancel_withdrawal(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge(opts).merge({ command: 'cancel_withdrawal' })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#change_password(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following option must be passed in.

newpassword: 'some new password',

Raises:

  • (ArgumentError)


285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/ige_isb_api/user_api.rb', line 285

def change_password(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge(opts).merge({ command: 'pass'})
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#deactivate(label = '', txid = 0) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID.



241
242
243
244
245
246
247
248
249
250
251
# File 'lib/ige_isb_api/user_api.rb', line 241

def deactivate(label = '', txid = 0)
  validate_params!(label, txid)
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_INACTIVE })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#deposit(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following options must be passed in.

wallet: "the name of the payment processor being used",
amount: a positive floating point number,
reference: "for logging purposes",

The following may be passed in and are presented here with their defaults.

cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE

Raises:

  • (ArgumentError)


124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/ige_isb_api/user_api.rb', line 124

def deposit(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              cur: options[:cur],
              txid: txid}.merge(opts).merge({ command: 'deposit' })
  # reference = "#{@params[:wallet]}:#{@params[:reference]}#{@params[:cur]}"
  # @params[:reference] = reference
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#get_history(label = '', txid = 0, opts = {}) ⇒ Object Also known as: history

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID.



182
183
184
185
186
187
188
189
190
191
192
# File 'lib/ige_isb_api/user_api.rb', line 182

def get_history(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge(opts).merge({ command: 'get_history' })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#get_vip_points(label = '', txid = 0) ⇒ Object Also known as: vip_points

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID.



317
318
319
320
321
322
323
324
325
326
327
# File 'lib/ige_isb_api/user_api.rb', line 317

def get_vip_points(label = '', txid = 0)
  validate_params!(label, txid)
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge({ command: 'get_vip_points' })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#limits(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following options must be passed in.

limitationtype: 'DEPOSIT', 'DEPOSIT_EXTRA', 'BET', 'LOSS', 'TIME', 'EXCLUSION'
amount: a positive floating point number,
frequency: "WEEKLY", DAILY, MONTHLY, 1..n days - for exclusion
until: "YYYY-MM-DD" or -1 for unlimited.

The following may be passed in and are presented here with their defaults.

cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE

Raises:

  • (ArgumentError)


226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/ige_isb_api/user_api.rb', line 226

def limits(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge(opts).merge({ command: 'limits' })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#login(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. The following may be passed in and is presented here with its default.

carte: defaults to IGE_ISB_API::Constants::CASINO can can be overridden if user is logging in from
       a different casino under the control of the same licensee.


102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/ige_isb_api/user_api.rb', line 102

def (label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              carte: options[:carte],
              txid: txid}.merge(opts).merge({ command: 'login' })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#player_update(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following options must be passed in.

Raises:

  • (ArgumentError)


301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/ige_isb_api/user_api.rb', line 301

def player_update(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
             username: options[:username],
             password: options[:password],
             carte: options[:carte],
             txid: txid}.merge(opts).merge({ command: 'player_update'})
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#register(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following options must be passed in.

email: "the user's email address",
name: "the user's surname",
firstname: "the user's first name",,
zip: "the user's postcode",
city: "the user's city",
phone: "the user's phone number",
dob: "in 2011-11-21 format",
country: "the ISO country code for the user",
ip: request.ip

The following may be passed in and are presented here with their defaults.

cur: IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE,
status: IGE_ISB_API::Constants::TEST,
carte: IGE_ISB_API::Constants::CASINO,
lang: 'en',
gender: IGE_ISB_API::Constants::MALE,

Raises:

  • (ArgumentError)


79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/ige_isb_api/user_api.rb', line 79

def register(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              status: options[:status],
              cur: options[:cur],
              lang: options[:lang],
              carte: options[:carte],
              gender: IGE_ISB_API::Constants::MALE,
              txid: txid}.merge(opts).merge({ command: 'registration', idaffiliation: IGE_ISB_API::Constants::LICENSEE_ID })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#save_friend_email(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following options must be passed in.

invitedname: 'some new password',
invitedemail: 'some new password',

Raises:

  • (ArgumentError)


335
336
337
338
339
340
341
342
343
344
345
346
# File 'lib/ige_isb_api/user_api.rb', line 335

def save_friend_email(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              txid: txid}.merge(opts).merge({ command: 'save_friend_email'})
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#send_email(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following options must be passed in.

emailtemplate: the name of a template (configured within ISB's back-office),
emailparameters: a collection of email parameters.

the following may be passed in to override defaults

carte: the casino carte for the user,

Raises:

  • (ArgumentError)


202
203
204
205
206
207
208
209
210
211
212
213
214
# File 'lib/ige_isb_api/user_api.rb', line 202

def send_email(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              carte: options[:carte],
              txid: txid}.merge(opts).merge({ command: 'send_email' })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end

#withdrawal(label = '', txid = 0, opts = {}) ⇒ Object

Each command has a label which is used by the casino to tag a group of interactions with ISB Additionally each transaction must include a unique transaction ID. the following options must be passed in.

wallet: "the name of the payment processor being used",
amount: a positive floating point number,
reference: "for logging purposes",

The following may be passed in and are presented here with their defaults.

cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE

Raises:

  • (ArgumentError)


149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/ige_isb_api/user_api.rb', line 149

def withdrawal(label = '', txid = 0, opts = {})
  validate_params!(label, txid)
  raise ArgumentError, "Missing options." if opts.empty?
  params = { idrequest: label,
              username: options[:username],
              password: options[:password],
              cur: options[:cur],
              txid: txid}.merge(opts).merge({ command: 'withdrawal' })
  request = IGE_ISB_API.request(params)
  resp = request.send
  response = JSON.parse(resp.body)
  return response
end