alphaSDK 0.2.7 → 0.2.8
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 +4 -4
- data/CODE_OF_CONDUCT.md +1 -1
- data/Gemfile.lock +1 -1
- data/LICENSE.txt +1 -1
- data/README.md +77 -20
- data/examples.rb +46 -12
- data/gameball.gemspec +3 -3
- data/lib/gameball/version.rb +1 -1
- data/lib/testFile.rb +2 -2
- metadata +5 -5
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/CODE_OF_CONDUCT.md
CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
|
|
55
55
|
## Enforcement
|
56
56
|
|
57
57
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at
|
58
|
+
reported by contacting the project team at https://www.gameball.co/. All
|
59
59
|
complaints will be reviewed and investigated and will result in a response that
|
60
60
|
is deemed necessary and appropriate to the circumstances. The project team is
|
61
61
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
data/Gemfile.lock
CHANGED
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
# Gameball Ruby SDK
|
2
|
+
|
2
3
|
The Gameball Ruby SDK provides convenient access to the Gameball API from applications written in the Ruby language.
|
3
4
|
|
4
5
|
## Documentation
|
5
6
|
|
6
|
-
Please refer to the
|
7
|
+
Please refer to the [Gameball API docs](https://docs.gameball.co).
|
7
8
|
|
8
9
|
## Installation
|
9
10
|
|
@@ -16,7 +17,7 @@ gem install gameballSDK
|
|
16
17
|
|
17
18
|
### Requirements
|
18
19
|
|
19
|
-
-
|
20
|
+
- Ruby 2.3+ and Gem 3.0+
|
20
21
|
|
21
22
|
## Usage
|
22
23
|
|
@@ -25,9 +26,9 @@ The SDK needs to be configured with your account's API & Transaction keys availa
|
|
25
26
|
```ruby
|
26
27
|
require 'gameball'
|
27
28
|
|
28
|
-
Gameball.api_key="api_key"
|
29
|
+
Gameball.api_key="api_key"
|
29
30
|
Gameball.api_version="v2.0" # Or latest
|
30
|
-
Gameball.transaction_key="transaction_key"
|
31
|
+
Gameball.transaction_key="transaction_key"
|
31
32
|
```
|
32
33
|
|
33
34
|
### Example
|
@@ -35,7 +36,7 @@ Gameball.transaction_key="transaction_key"
|
|
35
36
|
#### Sending an Event
|
36
37
|
|
37
38
|
```ruby
|
38
|
-
# Example 1
|
39
|
+
# Example 1
|
39
40
|
Gameball::Event.send_event({
|
40
41
|
events:{
|
41
42
|
place_order:{
|
@@ -87,7 +88,9 @@ Gameball::Event.send_event({
|
|
87
88
|
|
88
89
|
|
89
90
|
```
|
91
|
+
|
90
92
|
#### Create a new Referral
|
93
|
+
|
91
94
|
```ruby
|
92
95
|
Gameball::Referral.create_referral({
|
93
96
|
playerCode:"CODE11",
|
@@ -117,13 +120,13 @@ Gameball::Referral.create_referral({
|
|
117
120
|
```
|
118
121
|
|
119
122
|
#### Reward Examples
|
123
|
+
|
120
124
|
```ruby
|
121
125
|
# Example 1
|
122
126
|
Gameball::Transaction.reward_points({
|
123
127
|
playerUniqueId:"player123",
|
124
128
|
amount:99.98,
|
125
|
-
transactionId:"tra_123456789"
|
126
|
-
transactionTime:"2019-09-19T16:14:09.895Z"
|
129
|
+
transactionId:"tra_123456789"
|
127
130
|
})
|
128
131
|
# Example 2
|
129
132
|
Gameball::Transaction.reward_points({
|
@@ -143,60 +146,114 @@ Gameball::Transaction.reward_points({
|
|
143
146
|
graduationDate:"2018-07-04T21:06:29.158Z",
|
144
147
|
isMarried:false
|
145
148
|
}
|
146
|
-
}
|
147
|
-
transactionTime:"2019-09-19T16:14:09.895Z"
|
149
|
+
}
|
148
150
|
}
|
149
151
|
)
|
150
152
|
```
|
153
|
+
|
151
154
|
#### Get Player Balance Example
|
155
|
+
|
152
156
|
```ruby
|
153
157
|
Gameball::Transaction.get_player_balance("player456")
|
154
158
|
```
|
159
|
+
|
155
160
|
#### Hold Points Example
|
161
|
+
|
156
162
|
```ruby
|
157
163
|
Gameball::Transaction.hold_points({
|
158
164
|
playerUniqueId:"player456",
|
159
|
-
amount:98.89
|
160
|
-
transactionTime:"2019-09-21T16:53:28.190Z"
|
165
|
+
amount:98.89
|
161
166
|
}
|
162
167
|
)
|
163
168
|
```
|
169
|
+
|
164
170
|
#### Redeem Example
|
165
|
-
|
171
|
+
|
172
|
+
```ruby
|
166
173
|
Gameball::Transaction.redeem_points({
|
167
174
|
playerUniqueId:"player456",
|
168
175
|
amount:10,
|
169
176
|
transactionId:"tra_123456789",
|
170
177
|
holdReference:"2342452352435234",
|
171
|
-
transactionTime:"2019-09-19T16:14:09.895Z"
|
172
178
|
})
|
173
179
|
```
|
180
|
+
|
174
181
|
#### Reverse Transaction Example
|
182
|
+
|
175
183
|
```ruby
|
176
184
|
Gameball::Transaction.reverse_transaction({
|
177
185
|
playerUniqueId:"player456",
|
178
186
|
transactionId:"1234567890",
|
179
|
-
reversedTransactionId:"234567891"
|
180
|
-
transactionTime:"2019-09-19T11:14:09.895Z"
|
187
|
+
reversedTransactionId:"234567891"
|
181
188
|
}
|
182
189
|
)
|
183
190
|
```
|
184
|
-
|
191
|
+
|
192
|
+
#### Reverse Hold Example
|
193
|
+
|
185
194
|
```ruby
|
186
195
|
Gameball::Transaction.reverse_hold({
|
187
196
|
playerUniqueId:" player456",
|
188
|
-
holdReference:"9245fe4a-d402-451c-b9ed-9c1a04247482"
|
189
|
-
|
190
|
-
}
|
197
|
+
holdReference:"9245fe4a-d402-451c-b9ed-9c1a04247482"
|
198
|
+
}
|
191
199
|
)
|
192
200
|
```
|
193
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
|
+
|
194
249
|
### Handling exceptions
|
195
250
|
|
196
|
-
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
|
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).
|
197
252
|
|
198
253
|
## Contribution
|
254
|
+
|
199
255
|
The master branch of this repository contains the latest stable release of the SDK.
|
200
256
|
|
201
257
|
## Contact
|
258
|
+
|
202
259
|
For usage questions\suggestions drop us an email at support[ at ]gameball.co. Please report any bugs as issues.
|
data/examples.rb
CHANGED
@@ -83,8 +83,7 @@ Gameball::Referral.create_referral({
|
|
83
83
|
Gameball::Transaction.reward_points({
|
84
84
|
playerUniqueId: "player123",
|
85
85
|
amount: 99.98,
|
86
|
-
transactionId: "tra_123456789"
|
87
|
-
transactionTime: "2019-09-19T16:14:09.895Z",
|
86
|
+
transactionId: "tra_123456789"
|
88
87
|
})
|
89
88
|
# Example 2
|
90
89
|
Gameball::Transaction.reward_points({
|
@@ -104,8 +103,7 @@ Gameball::Transaction.reward_points({
|
|
104
103
|
graduationDate: "2018-07-04T21:06:29.158Z",
|
105
104
|
isMarried: false,
|
106
105
|
},
|
107
|
-
}
|
108
|
-
transactionTime: "2019-09-19T16:14:09.895Z",
|
106
|
+
}
|
109
107
|
})
|
110
108
|
# Get Player Balance
|
111
109
|
Gameball::Transaction.get_player_balance("player456")
|
@@ -113,8 +111,7 @@ Gameball::Transaction.get_player_balance("player456")
|
|
113
111
|
# Example 1
|
114
112
|
Gameball::Transaction.hold_points({
|
115
113
|
playerUniqueId: "player456",
|
116
|
-
amount: 98.89
|
117
|
-
transactionTime: "2019-09-21T16:53:28.190Z",
|
114
|
+
amount: 98.89
|
118
115
|
})
|
119
116
|
# Redeem
|
120
117
|
# Example 1
|
@@ -122,19 +119,56 @@ Gameball::Transaction.redeem_points({
|
|
122
119
|
playerUniqueId: "player456",
|
123
120
|
amount: 10,
|
124
121
|
transactionId: "tra_123456789",
|
125
|
-
holdReference: "2342452352435234"
|
126
|
-
transactionTime: "2019-09-19T16:14:09.895Z",
|
122
|
+
holdReference: "2342452352435234"
|
127
123
|
})
|
128
124
|
# Reverse Transaction
|
129
125
|
# Example 1
|
130
126
|
Gameball::Transaction.reverse_transaction({
|
131
127
|
playerUniqueId: "player456",
|
132
128
|
transactionId: "1234567890",
|
133
|
-
reversedTransactionId: "234567891"
|
134
|
-
transactionTime: "2019-09-19T11:14:09.895Z",
|
129
|
+
reversedTransactionId: "234567891"
|
135
130
|
})
|
136
131
|
Gameball::Transaction.reverse_hold({
|
137
132
|
playerUniqueId: " player456",
|
138
|
-
holdReference: "9245fe4a-d402-451c-b9ed-9c1a04247482"
|
139
|
-
|
133
|
+
holdReference: "9245fe4a-d402-451c-b9ed-9c1a04247482"
|
134
|
+
})
|
135
|
+
|
136
|
+
# Action
|
137
|
+
# Example 1
|
138
|
+
Gameball::Action.send_action({
|
139
|
+
playerUniqueId: "your_player_unique_id",
|
140
|
+
events: {
|
141
|
+
review: {},
|
142
|
+
reserve: {
|
143
|
+
rooms: 2
|
144
|
+
}
|
145
|
+
}
|
140
146
|
})
|
147
|
+
# Example 2
|
148
|
+
Gameball::Action.send_action({
|
149
|
+
playerUniqueId: "your_player_unique_id",
|
150
|
+
events: {
|
151
|
+
review: {},
|
152
|
+
reserve: {
|
153
|
+
rooms: 2
|
154
|
+
}
|
155
|
+
},
|
156
|
+
pointsTransaction: {
|
157
|
+
rewardAmount: 2,
|
158
|
+
transactionId: "234567890"
|
159
|
+
}
|
160
|
+
})
|
161
|
+
# Example 3
|
162
|
+
Gameball::Action.send_action({
|
163
|
+
playerUniqueId: "your_player_unique_id",
|
164
|
+
events: {
|
165
|
+
review: {},
|
166
|
+
reserve: {
|
167
|
+
rooms: 2
|
168
|
+
}
|
169
|
+
},
|
170
|
+
pointsTransaction: {
|
171
|
+
rewardAmount: 2,
|
172
|
+
holdReference: "2342452352435234",
|
173
|
+
transactionId: "234567890"
|
174
|
+
}
|
data/gameball.gemspec
CHANGED
@@ -2,12 +2,12 @@ require_relative 'lib/gameball/version'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "alphaSDK"
|
5
|
-
spec.version = Gameball::VERSION
|
5
|
+
spec.version = Gameball::VERSION
|
6
6
|
spec.authors = ["Alsouidan"]
|
7
7
|
spec.email = ["alsouidan@gmail.com"]
|
8
8
|
|
9
|
-
spec.summary = "Ruby
|
10
|
-
spec.homepage = "
|
9
|
+
spec.summary = "Ruby SDK for Gameball's API"
|
10
|
+
spec.homepage = "https://www.gameball.co/"
|
11
11
|
spec.license = "MIT"
|
12
12
|
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
13
|
spec.add_dependency 'rake','>= 12.0'
|
data/lib/gameball/version.rb
CHANGED
data/lib/testFile.rb
CHANGED
@@ -3,7 +3,7 @@ Gameball::api_key = "7c7636658209418c9a82306a421f76a5"
|
|
3
3
|
Gameball::api_version = "v2.0"
|
4
4
|
Gameball::transaction_key = "26e1967d89114388bdd1772587c336c8"
|
5
5
|
# res=Gameball::Transaction.get_player_balance("uniqueKey00")
|
6
|
-
# res = Gameball::Player.initialize_player({ playerUniqueId: "uniquekeys120", playerAttributes: { displayName: "
|
6
|
+
# res = Gameball::Player.initialize_player({ playerUniqueId: "uniquekeys120", playerAttributes: { displayName: "player", firstName: "player1", lastName: "player2", email: "aliplayer@gmail.com",
|
7
7
|
# gender: "Male", mobileNumber: "+201002580909",
|
8
8
|
# dateOfBirth: Date.parse("10/10/2010"), joinDate: Time.now.utc } })
|
9
9
|
res= Gameball::Action.send_action({ playerUniqueId: "player123",events:{
|
@@ -79,7 +79,7 @@ reserve:{rooms:2}
|
|
79
79
|
# res=Gameball::Event.sendEvent({
|
80
80
|
# events:{view_product_page:{customer_id:"123",product_id:"123",product_title:"title",product_vendor:"vendor",shop_name:"shop"}},
|
81
81
|
# playerUniqueId:"uniquekeys120",
|
82
|
-
# playerAttributes:{displayName:"
|
82
|
+
# playerAttributes:{displayName:"player",firstName:"player1",lastName:"player2",email:"aliplayer1@gmail.com",gender:"Male",mobileNumber:"+201002580909",dateOfBirth:"0123",joinDate:Time.now.utc}
|
83
83
|
# })
|
84
84
|
p res.body
|
85
85
|
# p res
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alphaSDK
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alsouidan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -71,11 +71,11 @@ files:
|
|
71
71
|
- lib/gameball/utils/validation.rb
|
72
72
|
- lib/gameball/version.rb
|
73
73
|
- lib/testFile.rb
|
74
|
-
homepage:
|
74
|
+
homepage: https://www.gameball.co/
|
75
75
|
licenses:
|
76
76
|
- MIT
|
77
77
|
metadata:
|
78
|
-
homepage_uri:
|
78
|
+
homepage_uri: https://www.gameball.co/
|
79
79
|
source_code_uri: http://mygemserver.com
|
80
80
|
changelog_uri: http://mygemserver.com
|
81
81
|
post_install_message:
|
@@ -96,5 +96,5 @@ requirements: []
|
|
96
96
|
rubygems_version: 3.0.3
|
97
97
|
signing_key:
|
98
98
|
specification_version: 4
|
99
|
-
summary: Ruby
|
99
|
+
summary: Ruby SDK for Gameball's API
|
100
100
|
test_files: []
|