alphaSDK 0.1.0 → 0.2.7

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
  SHA256:
3
- metadata.gz: 308f9e81f59e64e557f81db86a025439b2640c95c81ea39b10a02c850d6ba93f
4
- data.tar.gz: 41385ef3b306d58452a42247c13bed04cac8e65b8647f2ec02334cc97da1f71f
3
+ metadata.gz: 88ef178f4bd2c5c3f18a78e7c36c3bdf6e9f8a0f02aef00e0afe504a10e5a4b3
4
+ data.tar.gz: '05138f7347397ea0cd927cdb7a61bd614a075d60a66708d859122a65395b0064'
5
5
  SHA512:
6
- metadata.gz: bc07f1568cdf93f77ce69eb3280faa6709a7295b4d3f721b3b60ef4dd5db56fb38ad33d1328efc51a1863c73b540d0edcaf0a6e7def2fdf7254fb76d1f0d5286
7
- data.tar.gz: 10073fc6c998201b8493a9288108f1d82011eab00269c22b0a4c3059d6d0b4cd99f33740a514eb053faa1e38e316bbf4038a5b365bb1635f0ec3ffae2a337a29
6
+ metadata.gz: b4e5be9b8c39c2fe1a46c5277d47ad79014d20a58590a7938398649ec05380c3038c89403db404689fd37f272d61bea747be84a838b63eac2432a767f6be76d4
7
+ data.tar.gz: 8bfc3c8cb91c3a046037d530b62cf0303793afc8bbaa1c8ef72e513ae65437cc73336ff44e3166da6dd2638ad889458ef6083b05b66ed42809e01d87af165a55
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
@@ -0,0 +1,6 @@
1
+ ---
2
+ language: ruby
3
+ cache: bundler
4
+ rvm:
5
+ - 2.6.6
6
+ before_install: gem install bundler -v 2.1.4
@@ -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 alsouidan@gmail.com. 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
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in gameball.gemspec
4
+ gemspec
5
+
6
+ gem "rake", ">= 12.0"
7
+ gem "rspec", ">= 3.0"
@@ -0,0 +1,36 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ alphaSDK (0.2.6)
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
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Alsouidan
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.
@@ -0,0 +1,202 @@
1
+ # Gameball Ruby SDK
2
+ The Gameball Ruby SDK provides convenient access to the Gameball API from applications written in the Ruby language.
3
+
4
+ ## Documentation
5
+
6
+ Please refer to the [Gameball API docs](https://docs.gameball.co).
7
+
8
+ ## Installation
9
+
10
+ You don't need this source code unless you want to modify the SDK. If you just
11
+ want to use the SDK, just run:
12
+
13
+ ```sh
14
+ gem install gameballSDK
15
+ ```
16
+
17
+ ### Requirements
18
+
19
+ - Ruby 2.6+ and Gem 3.0+
20
+
21
+ ## Usage
22
+
23
+ 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)
24
+
25
+ ```ruby
26
+ require 'gameball'
27
+
28
+ Gameball.api_key="api_key"
29
+ Gameball.api_version="v2.0" # Or latest
30
+ Gameball.transaction_key="transaction_key"
31
+ ```
32
+
33
+ ### Example
34
+
35
+ #### Sending an Event
36
+
37
+ ```ruby
38
+ # Example 1
39
+ Gameball::Event.send_event({
40
+ events:{
41
+ place_order:{
42
+ total_amount:"100",
43
+ category:[
44
+ "electronics",
45
+ "cosmetics"
46
+ ]
47
+ },
48
+ review:{}
49
+ },
50
+ playerUniqueId:"player123"
51
+ })
52
+ # Example 2
53
+ Gameball::Event.send_event({
54
+ events:{
55
+ reserve:{
56
+ rooms:2
57
+ }
58
+ },
59
+ playerUniqueId:" player123",
60
+ playerAttributes:{
61
+ displayName:" Jon Snow",
62
+ email:"jon.snow@example.com",
63
+ dateOfBirth:"1980-09-19T00:00:00.000Z",
64
+ joinDate:"2019-09-19T21:06:29.158Z"
65
+ }
66
+ })
67
+ # Example 3
68
+ Gameball::Event.send_event({
69
+ events:{
70
+ reserve:{
71
+ rooms:2
72
+ }
73
+ },
74
+ playerUniqueId:" player123",
75
+ playerAttributes:{
76
+ displayName:" Jon Snow",
77
+ email:"jon.snow@example.com",
78
+ dateOfBirth:"1980-09-19T00:00:00.000Z",
79
+ joinDate:"2019-09-19T21:06:29.158Z",
80
+ custom:{
81
+ location:"Miami",
82
+ graduationDate:"2018-07-04T21:06:29.158Z",
83
+ isMarried:false
84
+ }
85
+ }
86
+ })
87
+
88
+
89
+ ```
90
+ #### Create a new Referral
91
+ ```ruby
92
+ Gameball::Referral.create_referral({
93
+ playerCode:"CODE11",
94
+ playerUniqueId:"player456"
95
+ }
96
+ )
97
+ # Example 2
98
+ Gameball::Referral.create_referral({
99
+ playerCode:"CODE11",
100
+ playerUniqueId:"player456",
101
+ playerAttributes:{
102
+ displayName:" Tyrion Lannister",
103
+ firstName:"Tyrion",
104
+ lastName:"Lannister",
105
+ email:"tyrion@example.com",
106
+ gender:"M",
107
+ dateOfBirth:"1978-01-11T00:00:00.000Z",
108
+ joinDate:"2019-09-19T21:06:29.158Z",
109
+ custom:{
110
+ location:"Miami",
111
+ graduationDate:"2018-07-04T21:06:29.158Z",
112
+ isMarried:false
113
+ }
114
+ }
115
+ }
116
+ )
117
+ ```
118
+
119
+ #### Reward Examples
120
+ ```ruby
121
+ # Example 1
122
+ Gameball::Transaction.reward_points({
123
+ playerUniqueId:"player123",
124
+ amount:99.98,
125
+ transactionId:"tra_123456789",
126
+ transactionTime:"2019-09-19T16:14:09.895Z"
127
+ })
128
+ # Example 2
129
+ Gameball::Transaction.reward_points({
130
+ playerUniqueId:"player456",
131
+ amount:2500,
132
+ transactionId:"tra_123456789",
133
+ playerAttributes:{
134
+ displayName:" Tyrion Lannister",
135
+ firstName:"Tyrion",
136
+ lastName:"Lannister",
137
+ email:"tyrion@example.com",
138
+ gender:"M",
139
+ dateOfBirth:"1978-01-11T00:00:00.000Z",
140
+ joinDate:"2019-09-19T21:06:29.158Z",
141
+ custom:{
142
+ location:"Miami",
143
+ graduationDate:"2018-07-04T21:06:29.158Z",
144
+ isMarried:false
145
+ }
146
+ },
147
+ transactionTime:"2019-09-19T16:14:09.895Z"
148
+ }
149
+ )
150
+ ```
151
+ #### Get Player Balance Example
152
+ ```ruby
153
+ Gameball::Transaction.get_player_balance("player456")
154
+ ```
155
+ #### Hold Points Example
156
+ ```ruby
157
+ Gameball::Transaction.hold_points({
158
+ playerUniqueId:"player456",
159
+ amount:98.89,
160
+ transactionTime:"2019-09-21T16:53:28.190Z"
161
+ }
162
+ )
163
+ ```
164
+ #### Redeem Example
165
+ ```ruby
166
+ Gameball::Transaction.redeem_points({
167
+ playerUniqueId:"player456",
168
+ amount:10,
169
+ transactionId:"tra_123456789",
170
+ holdReference:"2342452352435234",
171
+ transactionTime:"2019-09-19T16:14:09.895Z"
172
+ })
173
+ ```
174
+ #### Reverse Transaction Example
175
+ ```ruby
176
+ Gameball::Transaction.reverse_transaction({
177
+ playerUniqueId:"player456",
178
+ transactionId:"1234567890",
179
+ reversedTransactionId:"234567891",
180
+ transactionTime:"2019-09-19T11:14:09.895Z"
181
+ }
182
+ )
183
+ ```
184
+ #### Reverse Hold Example
185
+ ```ruby
186
+ Gameball::Transaction.reverse_hold({
187
+ playerUniqueId:" player456",
188
+ holdReference:"9245fe4a-d402-451c-b9ed-9c1a04247482",
189
+ transactionTime:"2019-09-21T16:53:28.190Z"
190
+ }
191
+ )
192
+ ```
193
+
194
+ ### Handling exceptions
195
+
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 [Gameball API docs](https://docs.gameball.co).
197
+
198
+ ## Contribution
199
+ The master branch of this repository contains the latest stable release of the SDK.
200
+
201
+ ## Contact
202
+ For usage questions\suggestions drop us an email at support[ at ]gameball.co. Please report any bugs as issues.
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "gameball"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,140 @@
1
+ # This file is not to be executed, this is for offering examples for the usage of the SDK
2
+ require "gameball"
3
+ Gameball.api_key = "7c7636658209418c9a82306a421f76a5"
4
+ Gameball.api_version = "v2.0"
5
+ Gameball::transaction_key = "26e1967d89114388bdd1772587c336c8"
6
+ # Events
7
+ # Example 1
8
+ Gameball::Event.send_event({
9
+ events: {
10
+ place_order: {
11
+ total_amount: "100",
12
+ category: [
13
+ "electronics",
14
+ "cosmetics",
15
+ ],
16
+ },
17
+ review: {},
18
+ },
19
+ playerUniqueId: "player123",
20
+ })
21
+ # Example 2
22
+ Gameball::Event.send_event({
23
+ events: {
24
+ reserve: {
25
+ rooms: 2,
26
+ },
27
+ },
28
+ playerUniqueId: " player123",
29
+ playerAttributes: {
30
+ displayName: " Jon Snow",
31
+ email: "jon.snow@example.com",
32
+ dateOfBirth: "1980-09-19T00:00:00.000Z",
33
+ joinDate: "2019-09-19T21:06:29.158Z",
34
+ },
35
+ })
36
+ # Example 3
37
+ Gameball::Event.send_event({
38
+ events: {
39
+ reserve: {
40
+ rooms: 2,
41
+ },
42
+ },
43
+ playerUniqueId: " player123",
44
+ playerAttributes: {
45
+ displayName: " Jon Snow",
46
+ email: "jon.snow@example.com",
47
+ dateOfBirth: "1980-09-19T00:00:00.000Z",
48
+ joinDate: "2019-09-19T21:06:29.158Z",
49
+ custom: {
50
+ location: "Miami",
51
+ graduationDate: "2018-07-04T21:06:29.158Z",
52
+ isMarried: false,
53
+ },
54
+ },
55
+ })
56
+ # Referrals
57
+ # Example 1
58
+ Gameball::Referral.create_referral({
59
+ playerCode: "CODE11",
60
+ playerUniqueId: "player456",
61
+ })
62
+ # Example 2
63
+ Gameball::Referral.create_referral({
64
+ playerCode: "CODE11",
65
+ playerUniqueId: "player456",
66
+ playerAttributes: {
67
+ displayName: " Tyrion Lannister",
68
+ firstName: "Tyrion",
69
+ lastName: "Lannister",
70
+ email: "tyrion@example.com",
71
+ gender: "M",
72
+ dateOfBirth: "1978-01-11T00:00:00.000Z",
73
+ joinDate: "2019-09-19T21:06:29.158Z",
74
+ custom: {
75
+ location: "Miami",
76
+ graduationDate: "2018-07-04T21:06:29.158Z",
77
+ isMarried: false,
78
+ },
79
+ },
80
+ })
81
+ # Reward
82
+ # Example 1
83
+ Gameball::Transaction.reward_points({
84
+ playerUniqueId: "player123",
85
+ amount: 99.98,
86
+ transactionId: "tra_123456789",
87
+ transactionTime: "2019-09-19T16:14:09.895Z",
88
+ })
89
+ # Example 2
90
+ Gameball::Transaction.reward_points({
91
+ playerUniqueId: "player456",
92
+ amount: 2500,
93
+ transactionId: "tra_123456789",
94
+ playerAttributes: {
95
+ displayName: " Tyrion Lannister",
96
+ firstName: "Tyrion",
97
+ lastName: "Lannister",
98
+ email: "tyrion@example.com",
99
+ gender: "M",
100
+ dateOfBirth: "1978-01-11T00:00:00.000Z",
101
+ joinDate: "2019-09-19T21:06:29.158Z",
102
+ custom: {
103
+ location: "Miami",
104
+ graduationDate: "2018-07-04T21:06:29.158Z",
105
+ isMarried: false,
106
+ },
107
+ },
108
+ transactionTime: "2019-09-19T16:14:09.895Z",
109
+ })
110
+ # Get Player Balance
111
+ Gameball::Transaction.get_player_balance("player456")
112
+ # Hold
113
+ # Example 1
114
+ Gameball::Transaction.hold_points({
115
+ playerUniqueId: "player456",
116
+ amount: 98.89,
117
+ transactionTime: "2019-09-21T16:53:28.190Z",
118
+ })
119
+ # Redeem
120
+ # Example 1
121
+ Gameball::Transaction.redeem_points({
122
+ playerUniqueId: "player456",
123
+ amount: 10,
124
+ transactionId: "tra_123456789",
125
+ holdReference: "2342452352435234",
126
+ transactionTime: "2019-09-19T16:14:09.895Z",
127
+ })
128
+ # Reverse Transaction
129
+ # Example 1
130
+ Gameball::Transaction.reverse_transaction({
131
+ playerUniqueId: "player456",
132
+ transactionId: "1234567890",
133
+ reversedTransactionId: "234567891",
134
+ transactionTime: "2019-09-19T11:14:09.895Z",
135
+ })
136
+ Gameball::Transaction.reverse_hold({
137
+ playerUniqueId: " player456",
138
+ holdReference: "9245fe4a-d402-451c-b9ed-9c1a04247482",
139
+ transactionTime: "2019-09-21T16:53:28.190Z",
140
+ })