alphaSDK 0.2.0 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +21 -0
- data/README.md +259 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/examples.rb +174 -0
- data/gameball.gemspec +29 -0
- data/lib/gameball.rb +21 -20
- data/lib/gameball/exceptions/gameballException.rb +5 -5
- data/lib/gameball/models/action.rb +28 -10
- data/lib/gameball/models/coupon.rb +50 -29
- data/lib/gameball/models/event.rb +30 -25
- data/lib/gameball/models/player.rb +37 -28
- data/lib/gameball/models/referral.rb +24 -20
- data/lib/gameball/models/transaction.rb +90 -64
- data/lib/gameball/utils/helper.rb +30 -34
- data/lib/gameball/utils/request.rb +65 -91
- data/lib/gameball/utils/validation.rb +13 -11
- data/lib/gameball/version.rb +3 -0
- data/lib/testFile.rb +24 -16
- metadata +57 -12
- data/lib/gameball/models/gameballResponse.rb +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a58084e08bbeb2bd44b9507ec02e4e8248e7dba5e00b5eaead336082f61a22ca
|
4
|
+
data.tar.gz: c4a5fd11b2ae6c9d50187052d69900feeb7874af864840f90351ed7fd93bbac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75f9000714aeee8e75b55b62b5cf7f03385063f787f9edc6adb894b98802463d0135f20a06a2a1920d55489c42db4cf2a7af0eae456c83225572df330d2f5196
|
7
|
+
data.tar.gz: 8f5ad9bd32f3a6f6e34c13c89479c9e5fc849f3a1ba0b863d3b5d61b7b588048b7c37c9102f7c9a672602b23e4f3652da3873a58a3721f1d11c30f0563f3d27b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at https://www.gameball.co/. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
alphaSDK (0.2.7)
|
5
|
+
rake (>= 12.0)
|
6
|
+
rspec (>= 3.0)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
diff-lcs (1.4.4)
|
12
|
+
rake (12.0.0)
|
13
|
+
rspec (3.9.0)
|
14
|
+
rspec-core (~> 3.9.0)
|
15
|
+
rspec-expectations (~> 3.9.0)
|
16
|
+
rspec-mocks (~> 3.9.0)
|
17
|
+
rspec-core (3.9.2)
|
18
|
+
rspec-support (~> 3.9.3)
|
19
|
+
rspec-expectations (3.9.2)
|
20
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
21
|
+
rspec-support (~> 3.9.0)
|
22
|
+
rspec-mocks (3.9.1)
|
23
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
24
|
+
rspec-support (~> 3.9.0)
|
25
|
+
rspec-support (3.9.3)
|
26
|
+
|
27
|
+
PLATFORMS
|
28
|
+
x64-mingw32
|
29
|
+
|
30
|
+
DEPENDENCIES
|
31
|
+
alphaSDK!
|
32
|
+
rake (>= 12.0)
|
33
|
+
rspec (>= 3.0)
|
34
|
+
|
35
|
+
BUNDLED WITH
|
36
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 Alplayer
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all 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,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,259 @@
|
|
1
|
+
# Gameball Ruby SDK
|
2
|
+
|
3
|
+
The Gameball Ruby SDK provides convenient access to the Gameball API from applications written in the Ruby language.
|
4
|
+
|
5
|
+
## Documentation
|
6
|
+
|
7
|
+
Please refer to the [Gameball API docs](https://docs.gameball.co).
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
You don't need this source code unless you want to modify the SDK. If you just
|
12
|
+
want to use the SDK, just run:
|
13
|
+
|
14
|
+
```sh
|
15
|
+
gem install gameballSDK
|
16
|
+
```
|
17
|
+
|
18
|
+
### Requirements
|
19
|
+
|
20
|
+
- Ruby 2.3+ and Gem 3.0+
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
The SDK needs to be configured with your account's API & Transaction keys available in your [Gameball Dashboard](https://help.gameball.co/en/articles/3467114-get-your-account-integration-details-api-key-and-transaction-key)
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
require 'gameball'
|
28
|
+
|
29
|
+
Gameball.api_key="api_key"
|
30
|
+
Gameball.api_version="v2.0" # Or latest
|
31
|
+
Gameball.transaction_key="transaction_key"
|
32
|
+
```
|
33
|
+
|
34
|
+
### Example
|
35
|
+
|
36
|
+
#### Sending an Event
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
# Example 1
|
40
|
+
Gameball::Event.send_event({
|
41
|
+
events:{
|
42
|
+
place_order:{
|
43
|
+
total_amount:"100",
|
44
|
+
category:[
|
45
|
+
"electronics",
|
46
|
+
"cosmetics"
|
47
|
+
]
|
48
|
+
},
|
49
|
+
review:{}
|
50
|
+
},
|
51
|
+
playerUniqueId:"player123"
|
52
|
+
})
|
53
|
+
# Example 2
|
54
|
+
Gameball::Event.send_event({
|
55
|
+
events:{
|
56
|
+
reserve:{
|
57
|
+
rooms:2
|
58
|
+
}
|
59
|
+
},
|
60
|
+
playerUniqueId:" player123",
|
61
|
+
playerAttributes:{
|
62
|
+
displayName:" Jon Snow",
|
63
|
+
email:"jon.snow@example.com",
|
64
|
+
dateOfBirth:"1980-09-19T00:00:00.000Z",
|
65
|
+
joinDate:"2019-09-19T21:06:29.158Z"
|
66
|
+
}
|
67
|
+
})
|
68
|
+
# Example 3
|
69
|
+
Gameball::Event.send_event({
|
70
|
+
events:{
|
71
|
+
reserve:{
|
72
|
+
rooms:2
|
73
|
+
}
|
74
|
+
},
|
75
|
+
playerUniqueId:" player123",
|
76
|
+
playerAttributes:{
|
77
|
+
displayName:" Jon Snow",
|
78
|
+
email:"jon.snow@example.com",
|
79
|
+
dateOfBirth:"1980-09-19T00:00:00.000Z",
|
80
|
+
joinDate:"2019-09-19T21:06:29.158Z",
|
81
|
+
custom:{
|
82
|
+
location:"Miami",
|
83
|
+
graduationDate:"2018-07-04T21:06:29.158Z",
|
84
|
+
isMarried:false
|
85
|
+
}
|
86
|
+
}
|
87
|
+
})
|
88
|
+
|
89
|
+
|
90
|
+
```
|
91
|
+
|
92
|
+
#### Create a new Referral
|
93
|
+
|
94
|
+
```ruby
|
95
|
+
Gameball::Referral.create_referral({
|
96
|
+
playerCode:"CODE11",
|
97
|
+
playerUniqueId:"player456"
|
98
|
+
}
|
99
|
+
)
|
100
|
+
# Example 2
|
101
|
+
Gameball::Referral.create_referral({
|
102
|
+
playerCode:"CODE11",
|
103
|
+
playerUniqueId:"player456",
|
104
|
+
playerAttributes:{
|
105
|
+
displayName:" Tyrion Lannister",
|
106
|
+
firstName:"Tyrion",
|
107
|
+
lastName:"Lannister",
|
108
|
+
email:"tyrion@example.com",
|
109
|
+
gender:"M",
|
110
|
+
dateOfBirth:"1978-01-11T00:00:00.000Z",
|
111
|
+
joinDate:"2019-09-19T21:06:29.158Z",
|
112
|
+
custom:{
|
113
|
+
location:"Miami",
|
114
|
+
graduationDate:"2018-07-04T21:06:29.158Z",
|
115
|
+
isMarried:false
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
)
|
120
|
+
```
|
121
|
+
|
122
|
+
#### Reward Examples
|
123
|
+
|
124
|
+
```ruby
|
125
|
+
# Example 1
|
126
|
+
Gameball::Transaction.reward_points({
|
127
|
+
playerUniqueId:"player123",
|
128
|
+
amount:99.98,
|
129
|
+
transactionId:"tra_123456789"
|
130
|
+
})
|
131
|
+
# Example 2
|
132
|
+
Gameball::Transaction.reward_points({
|
133
|
+
playerUniqueId:"player456",
|
134
|
+
amount:2500,
|
135
|
+
transactionId:"tra_123456789",
|
136
|
+
playerAttributes:{
|
137
|
+
displayName:" Tyrion Lannister",
|
138
|
+
firstName:"Tyrion",
|
139
|
+
lastName:"Lannister",
|
140
|
+
email:"tyrion@example.com",
|
141
|
+
gender:"M",
|
142
|
+
dateOfBirth:"1978-01-11T00:00:00.000Z",
|
143
|
+
joinDate:"2019-09-19T21:06:29.158Z",
|
144
|
+
custom:{
|
145
|
+
location:"Miami",
|
146
|
+
graduationDate:"2018-07-04T21:06:29.158Z",
|
147
|
+
isMarried:false
|
148
|
+
}
|
149
|
+
}
|
150
|
+
}
|
151
|
+
)
|
152
|
+
```
|
153
|
+
|
154
|
+
#### Get Player Balance Example
|
155
|
+
|
156
|
+
```ruby
|
157
|
+
Gameball::Transaction.get_player_balance("player456")
|
158
|
+
```
|
159
|
+
|
160
|
+
#### Hold Points Example
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
Gameball::Transaction.hold_points({
|
164
|
+
playerUniqueId:"player456",
|
165
|
+
amount:98.89
|
166
|
+
}
|
167
|
+
)
|
168
|
+
```
|
169
|
+
|
170
|
+
#### Redeem Example
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
Gameball::Transaction.redeem_points({
|
174
|
+
playerUniqueId:"player456",
|
175
|
+
amount:10,
|
176
|
+
transactionId:"tra_123456789",
|
177
|
+
holdReference:"2342452352435234",
|
178
|
+
})
|
179
|
+
```
|
180
|
+
|
181
|
+
#### Reverse Transaction Example
|
182
|
+
|
183
|
+
```ruby
|
184
|
+
Gameball::Transaction.reverse_transaction({
|
185
|
+
playerUniqueId:"player456",
|
186
|
+
transactionId:"1234567890",
|
187
|
+
reversedTransactionId:"234567891"
|
188
|
+
}
|
189
|
+
)
|
190
|
+
```
|
191
|
+
|
192
|
+
#### Reverse Hold Example
|
193
|
+
|
194
|
+
```ruby
|
195
|
+
Gameball::Transaction.reverse_hold({
|
196
|
+
playerUniqueId:" player456",
|
197
|
+
holdReference:"9245fe4a-d402-451c-b9ed-9c1a04247482"
|
198
|
+
}
|
199
|
+
)
|
200
|
+
```
|
201
|
+
|
202
|
+
### Actions
|
203
|
+
|
204
|
+
```ruby
|
205
|
+
# Example 1
|
206
|
+
Gameball::Action.send_action({
|
207
|
+
playerUniqueId: "your_player_unique_id",
|
208
|
+
events: {
|
209
|
+
review: {},
|
210
|
+
reserve: {
|
211
|
+
rooms: 2
|
212
|
+
}
|
213
|
+
}
|
214
|
+
})
|
215
|
+
# Example 2
|
216
|
+
Gameball::Action.send_action({
|
217
|
+
playerUniqueId: "your_player_unique_id",
|
218
|
+
events: {
|
219
|
+
review: {},
|
220
|
+
reserve: {
|
221
|
+
rooms: 2
|
222
|
+
}
|
223
|
+
},
|
224
|
+
pointsTransaction: {
|
225
|
+
rewardAmount: 2,
|
226
|
+
transactionId: "234567890"
|
227
|
+
}
|
228
|
+
})
|
229
|
+
# Example 3
|
230
|
+
Gameball::Action.send_action({
|
231
|
+
playerUniqueId: "your_player_unique_id",
|
232
|
+
events: {
|
233
|
+
review: {},
|
234
|
+
reserve: {
|
235
|
+
rooms: 2
|
236
|
+
}
|
237
|
+
},
|
238
|
+
pointsTransaction: {
|
239
|
+
rewardAmount: 2,
|
240
|
+
holdReference: "2342452352435234",
|
241
|
+
transactionId: "234567890"
|
242
|
+
}
|
243
|
+
```
|
244
|
+
|
245
|
+
### Testing
|
246
|
+
|
247
|
+
To test run in the terminal `bundle`
|
248
|
+
|
249
|
+
### Handling exceptions
|
250
|
+
|
251
|
+
Unsuccessful requests raise exceptions. The raised exception will reflect the sort of error that occurred with appropriate message and error code . Please refer to the [Gameball API docs](https://docs.gameball.co).
|
252
|
+
|
253
|
+
## Contribution
|
254
|
+
|
255
|
+
The master branch of this repository contains the latest stable release of the SDK.
|
256
|
+
|
257
|
+
## Contact
|
258
|
+
|
259
|
+
For usage questions\suggestions drop us an email at support[ at ]gameball.co. Please report any bugs as issues.
|