ige_isb_api 1.0.0
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 +33 -0
- data/LICENSE +20 -0
- data/README.md +237 -0
- data/ige_isb_api.gemspec +29 -0
- data/lib/ige_isb_api.rb +49 -0
- data/lib/ige_isb_api/api.rb +251 -0
- data/lib/ige_isb_api/bonus.rb +249 -0
- data/lib/ige_isb_api/bonus_api.rb +125 -0
- data/lib/ige_isb_api/callback.rb +83 -0
- data/lib/ige_isb_api/constants.rb +284 -0
- data/lib/ige_isb_api/games.rb +433 -0
- data/lib/ige_isb_api/request.rb +164 -0
- data/lib/ige_isb_api/user_api.rb +251 -0
- data/lib/ige_isb_api/validation.rb +130 -0
- data/lib/ige_isb_api/version.rb +6 -0
- metadata +130 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eedefc82170ca579c704dfdf1e57c7ee9c26f678
|
4
|
+
data.tar.gz: 2613b9f124480ec526c9bff89d767c2ac1a95bb8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3f272430acbef313ecf54b19121161f2d5af937477aece73f6dfa9e9111f627b53e469db6f74dc19ebc2e195e11b4b0582803b16b3f7bb40ff327e5761e2b46b
|
7
|
+
data.tar.gz: f3f7ad6149cdd39b2d584f2dc78d2213ada3c4a9c0b6b376beee0c271011a64682142c3cc422429b0d8ecd7414b45ddab58c0d05fb6930297dcec596e69f3bf9
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ige_isb_api (1.0.0)
|
5
|
+
nokogiri
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.2.5)
|
11
|
+
dotenv (0.9.0)
|
12
|
+
mini_portile (0.5.2)
|
13
|
+
nokogiri (1.6.0)
|
14
|
+
mini_portile (~> 0.5.0)
|
15
|
+
rake (10.1.0)
|
16
|
+
rspec (2.14.1)
|
17
|
+
rspec-core (~> 2.14.0)
|
18
|
+
rspec-expectations (~> 2.14.0)
|
19
|
+
rspec-mocks (~> 2.14.0)
|
20
|
+
rspec-core (2.14.7)
|
21
|
+
rspec-expectations (2.14.4)
|
22
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
23
|
+
rspec-mocks (2.14.4)
|
24
|
+
|
25
|
+
PLATFORMS
|
26
|
+
ruby
|
27
|
+
|
28
|
+
DEPENDENCIES
|
29
|
+
bundler (~> 1.3)
|
30
|
+
dotenv
|
31
|
+
ige_isb_api!
|
32
|
+
rake
|
33
|
+
rspec (~> 2.6)
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Interactive-Gaming-Entertainment
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
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, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,237 @@
|
|
1
|
+
IGE's Wrapper for ISB APIs
|
2
|
+
==========================
|
3
|
+
|
4
|
+
Ruby Wrapper for ISB's `User API Version 2.1`, as well as the documents
|
5
|
+
`Integrating ISB HTML5 Games_v1.3` and `Integrating ISB Flash Games_v1.4` (available from ISB), and ISB Bonus API version 1.5.
|
6
|
+
|
7
|
+
## Usage
|
8
|
+
|
9
|
+
1. Add `gem 'ige_isb_api'` to your `Gemfile` and `require 'ige_isb_api`
|
10
|
+
2. Ensure the environment variables (see below) have been configured, and your IP has been whitelisted by the people at [ISB](http://www.isoftbet.com).
|
11
|
+
3. do something like this:
|
12
|
+
|
13
|
+
```Ruby
|
14
|
+
api = IGE_ISB_API::UserAPI.new username: 'player-username', password: "notwhattheplayerusesforyourcasino"
|
15
|
+
txid = 12345 # must be unique
|
16
|
+
response = api.register "some label", txid, email: "username@test.tes",
|
17
|
+
name: "Surname",
|
18
|
+
firstname: "Firstname",
|
19
|
+
zip: "123456",
|
20
|
+
city: "Somewhere",
|
21
|
+
phone: "000000000",
|
22
|
+
dob: "2011-11-21",
|
23
|
+
country: "gb",
|
24
|
+
ip: '172.0.0.1'
|
25
|
+
response = api.login label, txid + 1
|
26
|
+
response = api.deposit label, txid + 2, wallet: 'test', amount: 5000, reference: 'test deposit'
|
27
|
+
response = api.withdrawal label, txid + 3, wallet: 'test', amount: 5000, reference: 'test withdrawal'
|
28
|
+
response = api.ban label, txid + 4
|
29
|
+
response = api.deactivate label, txid + 5
|
30
|
+
response = api.activate label, txid + 6
|
31
|
+
response = api.get_vip_points label, txid + 7
|
32
|
+
response = api.save_friend_email label, txid + 8, invitedname: "Bob Brown", invitedemail: 'bob@bro.wn'
|
33
|
+
response = api.limits label, txid + 9, limitationtype: "deposit", amount: 5000, frequency: 'weekly', until: "2015-11-21"
|
34
|
+
|
35
|
+
```
|
36
|
+
|
37
|
+
See the ISB User API docs (supplied by ISB) for details of the API commands and parameters.
|
38
|
+
|
39
|
+
### Loading Games
|
40
|
+
|
41
|
+
You can use this API to parse the games list XML file and associated Game Info XML files.
|
42
|
+
|
43
|
+
```Ruby
|
44
|
+
games_list = IGE_ISB_API::Games.new
|
45
|
+
games_list.load_from_xml("http://someserver/some_games_list.xml", some_language_code) # language will default to 'en'
|
46
|
+
games_list.categories.each do |category|
|
47
|
+
category.games.each do |game|
|
48
|
+
game.load_info(game.game_info_url)
|
49
|
+
if errors.size == error_count
|
50
|
+
# do whatever you wish to do with the game data
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
### Data Integrity
|
57
|
+
|
58
|
+
The data that comes from ISB can be inconsistent at times. The `load_info` method will return an array of errors if there are any. Games that return errors should be skipped on load.
|
59
|
+
|
60
|
+
You can also call the `game`'s `warnings` method to get a list of any specific non-fatal warnings about the data.
|
61
|
+
|
62
|
+
Expand upon the code above as follows to parse for errors and warnings.
|
63
|
+
|
64
|
+
```Ruby
|
65
|
+
games_list = IGE_ISB_API::Games.new
|
66
|
+
games_list.load_from_xml("http://someserver/some_games_list.xml", some_language_code) # language will default to 'en'
|
67
|
+
errors = []
|
68
|
+
warnings = []
|
69
|
+
games_list.categories.each do |category|
|
70
|
+
category.games.each do |game|
|
71
|
+
error_count = errors.size
|
72
|
+
errors = errors | game.load_info(game.game_info_url)
|
73
|
+
if errors.size == error_count
|
74
|
+
warnings = warnings | game.warnings
|
75
|
+
# do whatever else you wish to do with the game data
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
if !errors.empty?
|
80
|
+
errors.each {|e| puts "#{e[:game].name}: #{e[:message]}"}
|
81
|
+
end
|
82
|
+
if !warnings.empty?
|
83
|
+
warnings.each {|w| puts "#{w[:game].name}: #{w[:message]}"}
|
84
|
+
end
|
85
|
+
```
|
86
|
+
|
87
|
+
Your games loader code must loop through all of the langaues specified in `IGE_ISB_API::Cosntants::LANGUAGES` and
|
88
|
+
load game data for each language. Different language game data will have the same `identifier` and `skin_id` so your games database will need to know to save language specific versions of each game's name and description.
|
89
|
+
|
90
|
+
### Embedding a Flash game in 'fun' mode
|
91
|
+
|
92
|
+
```Ruby
|
93
|
+
embed = IGE_ISB_API::Game.embed_game_html host: g.get_info(:fun).host, currency: 'EUR',
|
94
|
+
colour: '#000000', name: g.name, game_swf_path: g.game_swf_path(:fun),
|
95
|
+
fun: true, coin_min: g.coin_min, casino: g.casino,
|
96
|
+
main_category: g.main_category, language: g.language, identifier: g.identifier,
|
97
|
+
game_swf_url: g.game_swf_url(:fun), wmode: g.wmode, gm_api: 0
|
98
|
+
```
|
99
|
+
|
100
|
+
### Embedding a Flash game in 'real' mode
|
101
|
+
|
102
|
+
```Ruby
|
103
|
+
embed = IGE_ISB_API::Game.embed_game_html host: g.get_info(:real).host, player_id: 'player_id', currency: 'EUR',
|
104
|
+
colour: '#000000', name: g.name, game_swf_path: g.game_swf_path(:real),
|
105
|
+
fun: false, coin_min: g.coin_min, casino: g.casino,
|
106
|
+
main_category: g.main_category, language: g.language, identifier: g.identifier,
|
107
|
+
game_swf_url: g.game_swf_url(:real), wmode: g.wmode, idrequest: 'somethingunique', gm_api: 0
|
108
|
+
```
|
109
|
+
|
110
|
+
### Using Google's [swfobject](http://code.google.com/p/swfobject/) Flash Embedder in 'fun' mode
|
111
|
+
|
112
|
+
```Ruby
|
113
|
+
embed = IGE_ISB_API::Game.embed_swfobject host: g.get_info(:fun).host, currency: 'EUR',
|
114
|
+
colour: '#000000', name: g.name, game_swf_path: g.game_swf_path(:fun),
|
115
|
+
fun: true, coin_min: g.coin_min, casino: g.casino,
|
116
|
+
main_category: g.main_category, language: g.language, identifier: g.identifier,
|
117
|
+
game_swf_url: g.game_swf_url(:fun), wmode: g.wmode, container: 'some-div-id', gm_api: 0
|
118
|
+
```
|
119
|
+
|
120
|
+
### Using Google's [swfobject](http://code.google.com/p/swfobject/) Flash Embedder in 'real' mode
|
121
|
+
|
122
|
+
```Ruby
|
123
|
+
embed = IGE_ISB_API::Game.embed_swfobject host: g.get_info(:real).host, player_id: 'player_id', currency: 'EUR',
|
124
|
+
colour: '#000000', name: g.name, game_swf_path: g.game_swf_path(:real),
|
125
|
+
fun: false, coin_min: g.coin_min, casino: g.casino,
|
126
|
+
main_category: g.main_category, language: g.language, identifier: g.identifier,
|
127
|
+
game_swf_url: g.game_swf_url(:real), wmode: g.wmode, container: 'some-div-id',
|
128
|
+
idrequest: 'somethingunique', gm_api: 0
|
129
|
+
```
|
130
|
+
|
131
|
+
### Launching an HTML5 game in 'fun' mode
|
132
|
+
|
133
|
+
```Ruby
|
134
|
+
url = IGE_ISB_API::Game.game_launcher_url currency: 'EUR', fun: true,
|
135
|
+
language: g.language, game_html5_url: g.game_html5_url(:fun)
|
136
|
+
```
|
137
|
+
|
138
|
+
### Launching an HTML5 game in 'real' mode
|
139
|
+
|
140
|
+
```Ruby
|
141
|
+
url = IGE_ISB_API::Game.game_launcher_url player_id: 'player_id', currency: 'EUR', fun: false,
|
142
|
+
language: g.language, game_html5_url: g.game_html5_url(:real),
|
143
|
+
idrequest: 'somethingunique'
|
144
|
+
```
|
145
|
+
|
146
|
+
## Parsing Callback Data
|
147
|
+
|
148
|
+
Once a player has finished their gameplay session, ISB will post session details back
|
149
|
+
to the casino server in the form of a JSON serialized blob of data.
|
150
|
+
You can easily parse that data into a standard Ruby Hash for your application to use as needed.
|
151
|
+
|
152
|
+
```Ruby
|
153
|
+
data = IGE_ISB_API::Callback.parse raw_data
|
154
|
+
player = data[:player] # player login as passed in via IGE_ISB_API.register
|
155
|
+
requestid = data[:requestid] # the request id passed in when the game is launched.
|
156
|
+
session_start = data[:session_start] # a Time object in UTC timezone
|
157
|
+
session_start = data[:session_end] # a Time object in UTC timezone
|
158
|
+
actions = data[:actions] # an array of actions
|
159
|
+
skinid = data[:skinid] # the unique 'skin' number of the game.
|
160
|
+
currency = data[:currency] # an ISO code
|
161
|
+
hostid = data[:hostid] # an Integer (see notes on hostID in environnent variables below)
|
162
|
+
data[:actions].each do |act|
|
163
|
+
action = act[:action] # :bet or :win
|
164
|
+
amount = act[:amount] # float
|
165
|
+
end
|
166
|
+
```
|
167
|
+
|
168
|
+
It will throw an `IGE_ISB_API::ValidationException` if the incoming data is bad.
|
169
|
+
|
170
|
+
## The Bonus API
|
171
|
+
|
172
|
+
```Ruby
|
173
|
+
b = IGE_ISB_API::BonusAPI.new
|
174
|
+
response = b.get_trigger_bonus login: 'someplayer', trigger: 'deposit'
|
175
|
+
```
|
176
|
+
|
177
|
+
See the ISB Bonus API document (version 1.4) for appropriate options:
|
178
|
+
|
179
|
+
* `get_trigger_bonus`
|
180
|
+
* `get_client_bonuses`
|
181
|
+
* `count_client_bonuses`
|
182
|
+
* `has_pending_offers`
|
183
|
+
* `accept_bonus`
|
184
|
+
* `decline_bonus`
|
185
|
+
* `get_remaining_playthrough`
|
186
|
+
* `remove_bonus_and_winnings_on_withdraw`
|
187
|
+
* `issue_bonus`
|
188
|
+
* `cancel_bonus`
|
189
|
+
* `reset_bonus`
|
190
|
+
* `update_active_balance_current_value`
|
191
|
+
* `assign_certificate_to_player`
|
192
|
+
* `bonus_vip_points`
|
193
|
+
* `generate_certificate`
|
194
|
+
* `generate_player_assigned_certificate`
|
195
|
+
* `get_template_id_by_name`
|
196
|
+
* `count_promo_codes`
|
197
|
+
* `sum_bonuses`
|
198
|
+
* `is_transaction_used`
|
199
|
+
* `get_player_assigned_certificates`
|
200
|
+
* `delete_player_assigned_certificate`
|
201
|
+
* `delete_generated_certificate`
|
202
|
+
* `certificate_exists`
|
203
|
+
|
204
|
+
## Building and Testing
|
205
|
+
|
206
|
+
### Installing Nokogiri
|
207
|
+
|
208
|
+
This GEM uses [Nokogiri](http://nokogiri.org) to parse XML files.
|
209
|
+
See [these instructions](http://nokogiri.org/tutorials/installing_nokogiri.html) for how best to install it on your local system.
|
210
|
+
|
211
|
+
### Environment Variables
|
212
|
+
|
213
|
+
You must set the following environment variables (provided by ISB) for this code to work.
|
214
|
+
|
215
|
+
You can put them into a `.env` file if you wish.
|
216
|
+
|
217
|
+
* `ISB_API_SERVER`
|
218
|
+
* `ISB_BONUS_API_SERVER`
|
219
|
+
* `ISB_FUN_URL` which must end in a `/`
|
220
|
+
* `ISB_LIVE_URL` which must end in a `/`
|
221
|
+
* `ISB_SECRET_KEY`
|
222
|
+
* `ISB_BONUS_API_KEY`
|
223
|
+
* `ISB_BONUS_SECRET_KEY`
|
224
|
+
* `ISB_LICENSEE_ID`
|
225
|
+
* `ISB_CASINO_ID`
|
226
|
+
* `ISB_CALLBACK_ID`
|
227
|
+
|
228
|
+
The `ISB_CALLBACK_ID` is an integer that relates to a specific callback URL registered with ISB. For ISB's server to be able to send callbacks to your system you must register your URLs with them, and use appropriate integer as provided by them. This allows you to develop and test your system, including callbacks, without compromising your live production system.
|
229
|
+
|
230
|
+
### To Test
|
231
|
+
|
232
|
+
To run the tests you must ensure that an appropriate environment variables have been configured
|
233
|
+
(in a `.env` file, or otherwise) and that the IP number you are testing from has been whitelisted
|
234
|
+
by ISB's people. Then simply run:
|
235
|
+
|
236
|
+
bundle exec rake
|
237
|
+
|
data/ige_isb_api.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ige_isb_api/version'
|
5
|
+
require 'ige_isb_api/constants'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "ige_isb_api"
|
9
|
+
spec.version = IGE_ISB_API::VERSION
|
10
|
+
spec.authors = ["Dave Sag"]
|
11
|
+
spec.email = ["davesag@gmail.com"]
|
12
|
+
spec.description = "Implements all of the features of the ISB API version #{IGE_ISB_API::Constants::API_VERSION}."
|
13
|
+
spec.summary = "A Ruby Wrapper for the ISB API version #{IGE_ISB_API::Constants::API_VERSION}"
|
14
|
+
spec.homepage = "https://github.com/Interactive-Gaming-Entertainment/IGE_ISB_API"
|
15
|
+
spec.license = "MIT"
|
16
|
+
spec.date = Time.now.utc.strftime("%Y-%m-%d")
|
17
|
+
|
18
|
+
spec.files = `git ls-files`.split($/) - %w(.rspec .gitignore Rakefile) - `git ls-files test_data`.split($/) - `git ls-files spec`.split($/)
|
19
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features|test_data)/})
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_dependency "nokogiri"
|
24
|
+
|
25
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
+
spec.add_development_dependency "rake"
|
27
|
+
spec.add_development_dependency "rspec", "~> 2.6"
|
28
|
+
spec.add_development_dependency "dotenv"
|
29
|
+
end
|
data/lib/ige_isb_api.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/user/bin/env ruby
|
2
|
+
#coding: utf-8
|
3
|
+
|
4
|
+
require "ige_isb_api/user_api"
|
5
|
+
require "ige_isb_api/bonus_api"
|
6
|
+
require "ige_isb_api/bonus"
|
7
|
+
require "ige_isb_api/callback"
|
8
|
+
require "ige_isb_api/constants"
|
9
|
+
require "ige_isb_api/games"
|
10
|
+
require "ige_isb_api/request"
|
11
|
+
require "ige_isb_api/validation"
|
12
|
+
require "ige_isb_api/version"
|
13
|
+
|
14
|
+
module IGE_ISB_API
|
15
|
+
|
16
|
+
# define errors and exceptions.
|
17
|
+
class IGE_ISB_API_Error < RuntimeError
|
18
|
+
end
|
19
|
+
class InternalException < IGE_ISB_API_Error
|
20
|
+
end
|
21
|
+
class ValidationException < IGE_ISB_API_Error
|
22
|
+
end
|
23
|
+
|
24
|
+
# module level method to get the redirection URL given some params.
|
25
|
+
def self.request(params = {})
|
26
|
+
result = nil
|
27
|
+
|
28
|
+
begin
|
29
|
+
request = IGE_ISB_API::Request.new(params)
|
30
|
+
return request
|
31
|
+
|
32
|
+
rescue InternalException => e
|
33
|
+
puts "Caught Internal Exception: #{e.message}"
|
34
|
+
puts e.backtrace
|
35
|
+
raise RuntimeError, "Internal server error. Please try again later."
|
36
|
+
|
37
|
+
rescue ValidationException => e
|
38
|
+
puts "Caught Validation Exception: #{e.message}"
|
39
|
+
puts e.backtrace
|
40
|
+
raise RuntimeError, "Validation error: #{e.message} Fix your data and retry."
|
41
|
+
|
42
|
+
rescue IGE_ISB_API_Error => e
|
43
|
+
puts "Caught General IGE_ISB_API Error: #{e.message}"
|
44
|
+
puts e.backtrace
|
45
|
+
raise RuntimeError, "Undocumented Internal error: #{e.message}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,251 @@
|
|
1
|
+
#!/user/bin/env ruby
|
2
|
+
#coding: utf-8
|
3
|
+
|
4
|
+
module IGE_ISB_API
|
5
|
+
class API
|
6
|
+
|
7
|
+
# the following options *must* be passed in.
|
8
|
+
# username: "some_username specific to iSoftBet",
|
9
|
+
# password: "should be specific to iSoftBet",
|
10
|
+
# The following options may be passed in and are presented here with their defaults.
|
11
|
+
# cur: IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE,
|
12
|
+
# carte: IGE_ISB_API::Constants::CASINO,
|
13
|
+
# lang: IGE_ISB_API::Constants::DEFAULT_LANGUAGE,
|
14
|
+
def initialize(player_status = IGE_ISB_API::Constants::TEST, opts = {})
|
15
|
+
raise ArgumentError, "Missing options." if opts.empty?
|
16
|
+
@options = {
|
17
|
+
cur: IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE,
|
18
|
+
carte: IGE_ISB_API::Constants::CASINO,
|
19
|
+
lang: IGE_ISB_API::Constants::DEFAULT_LANGUAGE,
|
20
|
+
status: player_status
|
21
|
+
}.merge(opts)
|
22
|
+
end
|
23
|
+
|
24
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
25
|
+
# Additionally each transaction must include a unique transaction ID.
|
26
|
+
# the following options *must* be passed in.
|
27
|
+
# email: "the user's email address",
|
28
|
+
# name: "the user's surname",
|
29
|
+
# firstname: "the user's first name",,
|
30
|
+
# zip: "the user's postcode",
|
31
|
+
# city: "the user's city",
|
32
|
+
# phone: "the user's phone number",
|
33
|
+
# dob: "in 2011-11-21 format",
|
34
|
+
# country: "the ISO country code for the user",
|
35
|
+
# ip: request.ip
|
36
|
+
#
|
37
|
+
# The following may be passed in and are presented here with their defaults.
|
38
|
+
# cur: IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE,
|
39
|
+
# status: IGE_ISB_API::Constants::TEST,
|
40
|
+
# carte: IGE_ISB_API::Constants::CASINO,
|
41
|
+
# lang: 'en',
|
42
|
+
# gender: IGE_ISB_API::Constants::MALE,
|
43
|
+
def register(label = '', txid = 0, opts = {})
|
44
|
+
validate_params!(label, txid)
|
45
|
+
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],
|
53
|
+
gender: IGE_ISB_API::Constants::MALE,
|
54
|
+
txid: txid}.merge(opts).merge({ command: 'registration', idaffiliation: IGE_ISB_API::Constants::LICENSEE_ID })
|
55
|
+
request = IGE_ISB_API.request(@params)
|
56
|
+
resp = request.send
|
57
|
+
response = JSON.parse(resp.body)
|
58
|
+
return response
|
59
|
+
end
|
60
|
+
|
61
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
62
|
+
# Additionally each transaction must include a unique transaction ID.
|
63
|
+
# The following may be passed in and is presented here with its default.
|
64
|
+
# carte: defaults to IGE_ISB_API::Constants::CASINO can can be overridden if user is logging in from
|
65
|
+
# a different casino under the control of the same licensee.
|
66
|
+
def login(label = '', txid = 0, opts = {})
|
67
|
+
validate_params!(label, txid)
|
68
|
+
@params = { idrequest: label,
|
69
|
+
username: @options[:username],
|
70
|
+
password: @options[:password],
|
71
|
+
carte: @options[:carte],
|
72
|
+
txid: txid}.merge(opts).merge({ command: 'login' })
|
73
|
+
request = IGE_ISB_API.request(@params)
|
74
|
+
resp = request.send
|
75
|
+
response = JSON.parse(resp.body)
|
76
|
+
return response
|
77
|
+
end
|
78
|
+
|
79
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
80
|
+
# Additionally each transaction must include a unique transaction ID.
|
81
|
+
# the following options *must* be passed in.
|
82
|
+
# wallet: "the name of the payment processor being used",
|
83
|
+
# amount: a positive floating point number,
|
84
|
+
# reference: "for logging purposes",
|
85
|
+
#
|
86
|
+
# The following may be passed in and are presented here with their defaults.
|
87
|
+
# cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE
|
88
|
+
def deposit(label = '', txid = 0, opts = {})
|
89
|
+
validate_params!(label, txid)
|
90
|
+
raise ArgumentError, "Missing options." if opts.empty?
|
91
|
+
@params = { idrequest: label,
|
92
|
+
username: @options[:username],
|
93
|
+
password: @options[:password],
|
94
|
+
cur: @options[:cur],
|
95
|
+
txid: txid}.merge(opts).merge({ command: 'deposit' })
|
96
|
+
reference = "#{@params[:wallet]}:#{@params[:reference]}#{@params[:cur]}"
|
97
|
+
@params.merge!(reference: reference)
|
98
|
+
request = IGE_ISB_API.request(@params)
|
99
|
+
resp = request.send
|
100
|
+
response = JSON.parse(resp.body)
|
101
|
+
return response
|
102
|
+
end
|
103
|
+
|
104
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
105
|
+
# Additionally each transaction must include a unique transaction ID.
|
106
|
+
# the following options *must* be passed in.
|
107
|
+
# wallet: "the name of the payment processor being used",
|
108
|
+
# amount: a positive floating point number,
|
109
|
+
# reference: "for logging purposes",
|
110
|
+
#
|
111
|
+
# The following may be passed in and are presented here with their defaults.
|
112
|
+
# cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE
|
113
|
+
def withdrawal(label = '', txid = 0, opts = {})
|
114
|
+
validate_params!(label, txid)
|
115
|
+
raise ArgumentError, "Missing options." if opts.empty?
|
116
|
+
@params = { idrequest: label,
|
117
|
+
username: @options[:username],
|
118
|
+
password: @options[:password],
|
119
|
+
cur: @options[:cur],
|
120
|
+
txid: txid}.merge(opts).merge({ command: 'withdrawal' })
|
121
|
+
reference = "#{@params[:reference]}#{@params[:cur]}"
|
122
|
+
@params.merge!(reference: reference)
|
123
|
+
request = IGE_ISB_API.request(@params)
|
124
|
+
resp = request.send
|
125
|
+
response = JSON.parse(resp.body)
|
126
|
+
return response
|
127
|
+
end
|
128
|
+
|
129
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
130
|
+
# Additionally each transaction must include a unique transaction ID.
|
131
|
+
# the following options *must* be passed in.
|
132
|
+
# limitationtype: 'DEPOSIT', 'DEPOSIT_EXTRA', 'BET', 'LOSS', 'TIME', 'EXCLUSION'
|
133
|
+
# amount: a positive floating point number,
|
134
|
+
# frequency: "WEEKLY", DAILY, MONTHLY, 1..n days - for exclusion
|
135
|
+
# until: "YYYY-MM-DD" or -1 for unlimited.
|
136
|
+
#
|
137
|
+
# The following may be passed in and are presented here with their defaults.
|
138
|
+
# cur: defaults to IGE_ISB_API::Constants::DEFAULT_CURRENCY_CODE
|
139
|
+
def limits(label = '', txid = 0, opts = {})
|
140
|
+
validate_params!(label, txid)
|
141
|
+
raise ArgumentError, "Missing options." if opts.empty?
|
142
|
+
@params = { idrequest: label,
|
143
|
+
username: @options[:username],
|
144
|
+
password: @options[:password],
|
145
|
+
txid: txid}.merge(opts).merge({ command: 'limits' })
|
146
|
+
request = IGE_ISB_API.request(@params)
|
147
|
+
resp = request.send
|
148
|
+
response = JSON.parse(resp.body)
|
149
|
+
return response
|
150
|
+
end
|
151
|
+
|
152
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
153
|
+
# Additionally each transaction must include a unique transaction ID.
|
154
|
+
def deactivate(label = '', txid = 0)
|
155
|
+
validate_params!(label, txid)
|
156
|
+
@params = { idrequest: label,
|
157
|
+
username: @options[:username],
|
158
|
+
password: @options[:password],
|
159
|
+
txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_INACTIVE })
|
160
|
+
request = IGE_ISB_API.request(@params)
|
161
|
+
resp = request.send
|
162
|
+
response = JSON.parse(resp.body)
|
163
|
+
return response
|
164
|
+
end
|
165
|
+
|
166
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
167
|
+
# Additionally each transaction must include a unique transaction ID.
|
168
|
+
def activate(label = '', txid = 0)
|
169
|
+
validate_params!(label, txid)
|
170
|
+
@params = { idrequest: label,
|
171
|
+
username: @options[:username],
|
172
|
+
password: @options[:password],
|
173
|
+
txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_ACTIVE })
|
174
|
+
request = IGE_ISB_API.request(@params)
|
175
|
+
resp = request.send
|
176
|
+
response = JSON.parse(resp.body)
|
177
|
+
return response
|
178
|
+
end
|
179
|
+
|
180
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
181
|
+
# Additionally each transaction must include a unique transaction ID.
|
182
|
+
def ban(label = '', txid = 0)
|
183
|
+
validate_params!(label, txid)
|
184
|
+
@params = { idrequest: label,
|
185
|
+
username: @options[:username],
|
186
|
+
password: @options[:password],
|
187
|
+
txid: txid}.merge({ command: 'userstatus', flag: IGE_ISB_API::Constants::USER_BANNED })
|
188
|
+
request = IGE_ISB_API.request(@params)
|
189
|
+
resp = request.send
|
190
|
+
response = JSON.parse(resp.body)
|
191
|
+
return response
|
192
|
+
end
|
193
|
+
|
194
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
195
|
+
# Additionally each transaction must include a unique transaction ID.
|
196
|
+
# the following option *must* be passed in.
|
197
|
+
# newpassword: 'some new password',
|
198
|
+
def change_password(label = '', txid = 0, opts = {})
|
199
|
+
validate_params!(label, txid)
|
200
|
+
raise ArgumentError, "Missing options." if opts.empty?
|
201
|
+
@params = { idrequest: label,
|
202
|
+
username: @options[:username],
|
203
|
+
password: @options[:password],
|
204
|
+
txid: txid}.merge(opts).merge({ command: 'pass'})
|
205
|
+
request = IGE_ISB_API.request(@params)
|
206
|
+
resp = request.send
|
207
|
+
response = JSON.parse(resp.body)
|
208
|
+
return response
|
209
|
+
end
|
210
|
+
|
211
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
212
|
+
# Additionally each transaction must include a unique transaction ID.
|
213
|
+
def get_vip_points(label = '', txid = 0)
|
214
|
+
validate_params!(label, txid)
|
215
|
+
@params = { idrequest: label,
|
216
|
+
username: @options[:username],
|
217
|
+
password: @options[:password],
|
218
|
+
txid: txid}.merge({ command: 'get_vip_points' })
|
219
|
+
request = IGE_ISB_API.request(@params)
|
220
|
+
resp = request.send
|
221
|
+
response = JSON.parse(resp.body)
|
222
|
+
return response
|
223
|
+
end
|
224
|
+
|
225
|
+
# Each command has a label which is used by the casino to tag a group of interactions with ISB
|
226
|
+
# Additionally each transaction must include a unique transaction ID.
|
227
|
+
# the following options *must* be passed in.
|
228
|
+
# invitedname: 'some new password',
|
229
|
+
# invitedemail: 'some new password',
|
230
|
+
def save_friend_email(label = '', txid = 0, opts = {})
|
231
|
+
validate_params!(label, txid)
|
232
|
+
raise ArgumentError, "Missing options." if opts.empty?
|
233
|
+
@params = { idrequest: label,
|
234
|
+
username: @options[:username],
|
235
|
+
password: @options[:password],
|
236
|
+
txid: txid}.merge(opts).merge({ command: 'save_friend_email'})
|
237
|
+
request = IGE_ISB_API.request(@params)
|
238
|
+
resp = request.send
|
239
|
+
response = JSON.parse(resp.body)
|
240
|
+
return response
|
241
|
+
end
|
242
|
+
|
243
|
+
private
|
244
|
+
|
245
|
+
def validate_params!(label, txid)
|
246
|
+
raise ArgumentError, "Missing a valid label." if label.empty?
|
247
|
+
raise ArgumentError, "Missing a valid transaction ID." if txid <= 0
|
248
|
+
end
|
249
|
+
|
250
|
+
end
|
251
|
+
end
|