gameball 1.0.1 → 2.1.3
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/Gemfile.lock +36 -36
- data/README.md +202 -132
- data/lib/gameball/models/configurations.rb +19 -0
- data/lib/gameball/models/event.rb +5 -1
- data/lib/gameball/models/leaderboard.rb +19 -0
- data/lib/gameball/models/notifications.rb +32 -0
- data/lib/gameball/models/order.rb +23 -0
- data/lib/gameball/models/player.rb +63 -6
- data/lib/gameball/models/transaction.rb +88 -11
- data/lib/gameball/utils/helper.rb +3 -0
- data/lib/gameball/utils/request.rb +13 -8
- data/lib/gameball/version.rb +1 -1
- data/lib/gameball.rb +6 -4
- data/test.rb +46 -0
- metadata +12 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9ba875c89a38d869e418a5633e7971aa0af4bcb549c7805f0ccf3a87f975b4be
         | 
| 4 | 
            +
              data.tar.gz: 54e13a38d1a96b88ce4d593e1825d83b3b75523427447cc3d22c100b4d2a4fba
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d6e8ec8fa126bbbf8b96520af518397af909be3302ea3c0b09a7a8e415662da09478564de793d0a57fa94b19b9ae7c59c3354d961f7a0956a34b61a4896c5ff5
         | 
| 7 | 
            +
              data.tar.gz: 97a487d56517f4e84046ded950ae2efe5559e8ba612333246c31e43ebfd1dc17bc34db6605e18b3afb460728ca94311e28e7dbd84ad044d3e102dba6227dfd59
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,36 +1,36 @@ | |
| 1 | 
            -
            PATH
         | 
| 2 | 
            -
              remote: .
         | 
| 3 | 
            -
              specs:
         | 
| 4 | 
            -
                gameball (1.0.1)
         | 
| 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 | 
            -
              gameball!
         | 
| 32 | 
            -
              rake (>= 12.0)
         | 
| 33 | 
            -
              rspec (>= 3.0)
         | 
| 34 | 
            -
             | 
| 35 | 
            -
            BUNDLED WITH
         | 
| 36 | 
            -
               2.1.4
         | 
| 1 | 
            +
            PATH
         | 
| 2 | 
            +
              remote: .
         | 
| 3 | 
            +
              specs:
         | 
| 4 | 
            +
                gameball (1.0.1)
         | 
| 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 | 
            +
              gameball!
         | 
| 32 | 
            +
              rake (>= 12.0)
         | 
| 33 | 
            +
              rspec (>= 3.0)
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            BUNDLED WITH
         | 
| 36 | 
            +
               2.1.4
         | 
    
        data/README.md
    CHANGED
    
    | @@ -28,10 +28,89 @@ require 'gameball' | |
| 28 28 |  | 
| 29 29 | 
             
            Gameball.api_key="api_key"
         | 
| 30 30 | 
             
            Gameball.transaction_key="transaction_key"
         | 
| 31 | 
            +
            # If using API Version 3.0
         | 
| 32 | 
            +
            Gameball.api_version="v3.0
         | 
| 31 33 | 
             
            ```
         | 
| 32 34 |  | 
| 33 35 | 
             
            ### Example
         | 
| 34 36 |  | 
| 37 | 
            +
            #### Create Player
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            ```ruby
         | 
| 40 | 
            +
            # Example 1
         | 
| 41 | 
            +
            Gameball::Player.initialize_player({
         | 
| 42 | 
            +
               playerUniqueId:"player123",
         | 
| 43 | 
            +
               mobile: "+1234567",
         | 
| 44 | 
            +
               email: "jon.snow@example.com",
         | 
| 45 | 
            +
               "playerAttributes":{
         | 
| 46 | 
            +
                  displayName:"Jon Snow",
         | 
| 47 | 
            +
                  firstName: "Jon",
         | 
| 48 | 
            +
                  lastName: "Snow",
         | 
| 49 | 
            +
                  mobile: "+1234567",
         | 
| 50 | 
            +
                  email:"jon.snow@example.com",
         | 
| 51 | 
            +
                  gender:"M",
         | 
| 52 | 
            +
                  dateOfBirth:"1980-09-19T00:00:00.000Z",
         | 
| 53 | 
            +
                  joinDate:"2019-09-19T21:06:29.158Z",
         | 
| 54 | 
            +
                  tags: "VIP,Platinum",
         | 
| 55 | 
            +
                	custom:{
         | 
| 56 | 
            +
                       location:"Miami",
         | 
| 57 | 
            +
                       graduationDate:"2018-07-04T21:06:29.158Z",
         | 
| 58 | 
            +
                       isMarried:false
         | 
| 59 | 
            +
                    }
         | 
| 60 | 
            +
                }
         | 
| 61 | 
            +
              })
         | 
| 62 | 
            +
            # Example 2
         | 
| 63 | 
            +
            Gameball::Player.initialize_player({
         | 
| 64 | 
            +
               referrerCode:"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 | 
            +
             | 
| 82 | 
            +
            ```
         | 
| 83 | 
            +
             | 
| 84 | 
            +
            #### Retrieve Player
         | 
| 85 | 
            +
            ```ruby
         | 
| 86 | 
            +
            Gameball::Player.get_player_info("player123")
         | 
| 87 | 
            +
             | 
| 88 | 
            +
            ```
         | 
| 89 | 
            +
             | 
| 90 | 
            +
            #### Player Balance
         | 
| 91 | 
            +
            ```ruby
         | 
| 92 | 
            +
            Gameball::Player.get_player_balance("player123")
         | 
| 93 | 
            +
             | 
| 94 | 
            +
            ```
         | 
| 95 | 
            +
             | 
| 96 | 
            +
            #### Player's Progress
         | 
| 97 | 
            +
            ```ruby
         | 
| 98 | 
            +
            Gameball::Player.get_player_progress("player123")
         | 
| 99 | 
            +
             | 
| 100 | 
            +
            ```
         | 
| 101 | 
            +
             | 
| 102 | 
            +
            #### Attach Tags to Player
         | 
| 103 | 
            +
            ```ruby
         | 
| 104 | 
            +
            Gameball::Player.attach_tags("player123","VIP,Platinum")
         | 
| 105 | 
            +
             | 
| 106 | 
            +
            ```
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            #### Detach Tags
         | 
| 109 | 
            +
            ```ruby
         | 
| 110 | 
            +
            Gameball::Player.detach_tags("player123","VIP,Platinum")
         | 
| 111 | 
            +
             | 
| 112 | 
            +
            ```
         | 
| 113 | 
            +
             | 
| 35 114 | 
             
            #### Sending an Event
         | 
| 36 115 |  | 
| 37 116 | 
             
            ```ruby
         | 
| @@ -56,104 +135,22 @@ Gameball::Event.send_event({ | |
| 56 135 | 
             
            			rooms:2
         | 
| 57 136 | 
             
            		}
         | 
| 58 137 | 
             
            	},
         | 
| 59 | 
            -
            	playerUniqueId:" player123" | 
| 60 | 
            -
            	 | 
| 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 | 
            -
            			}
         | 
| 138 | 
            +
            	playerUniqueId:" player123"
         | 
| 139 | 
            +
            	
         | 
| 86 140 | 
             
            })
         | 
| 87 141 |  | 
| 88 142 |  | 
| 89 143 | 
             
            ```
         | 
| 90 144 |  | 
| 91 | 
            -
            ####  | 
| 92 | 
            -
             | 
| 93 | 
            -
            ```ruby
         | 
| 94 | 
            -
            Gameball::Referral.create_referral({
         | 
| 95 | 
            -
            	playerCode:"CODE11",
         | 
| 96 | 
            -
            	playerUniqueId:"player456"
         | 
| 97 | 
            -
            }
         | 
| 98 | 
            -
            )
         | 
| 99 | 
            -
            # Example 2
         | 
| 100 | 
            -
            Gameball::Referral.create_referral({
         | 
| 101 | 
            -
            	playerCode:"CODE11",
         | 
| 102 | 
            -
            	playerUniqueId:"player456",
         | 
| 103 | 
            -
            	playerAttributes:{
         | 
| 104 | 
            -
            		displayName:" Tyrion Lannister",
         | 
| 105 | 
            -
            		firstName:"Tyrion",
         | 
| 106 | 
            -
            		lastName:"Lannister",
         | 
| 107 | 
            -
            		email:"tyrion@example.com",
         | 
| 108 | 
            -
            		gender:"M",
         | 
| 109 | 
            -
            		dateOfBirth:"1978-01-11T00:00:00.000Z",
         | 
| 110 | 
            -
            		joinDate:"2019-09-19T21:06:29.158Z",
         | 
| 111 | 
            -
            		custom:{
         | 
| 112 | 
            -
            			location:"Miami",
         | 
| 113 | 
            -
            			graduationDate:"2018-07-04T21:06:29.158Z",
         | 
| 114 | 
            -
            			isMarried:false
         | 
| 115 | 
            -
            		}
         | 
| 116 | 
            -
            	}
         | 
| 117 | 
            -
            }
         | 
| 118 | 
            -
            )
         | 
| 119 | 
            -
            ```
         | 
| 120 | 
            -
             | 
| 121 | 
            -
            #### Reward Examples
         | 
| 145 | 
            +
            #### Cashback Examples
         | 
| 122 146 |  | 
| 123 147 | 
             
            ```ruby
         | 
| 124 148 | 
             
            # Example 1
         | 
| 125 | 
            -
            Gameball::Transaction. | 
| 149 | 
            +
            Gameball::Transaction.cashback({
         | 
| 126 150 | 
             
            	playerUniqueId:"player123",
         | 
| 127 151 | 
             
            	amount:99.98,
         | 
| 128 152 | 
             
            	transactionId:"tra_123456789"
         | 
| 129 153 | 
             
            })
         | 
| 130 | 
            -
            # Example 2
         | 
| 131 | 
            -
            Gameball::Transaction.reward_points({
         | 
| 132 | 
            -
            	playerUniqueId:"player456",
         | 
| 133 | 
            -
            	amount:2500,
         | 
| 134 | 
            -
            	transactionId:"tra_123456789",
         | 
| 135 | 
            -
            	playerAttributes:{
         | 
| 136 | 
            -
            		displayName:" Tyrion Lannister",
         | 
| 137 | 
            -
            		firstName:"Tyrion",
         | 
| 138 | 
            -
            		lastName:"Lannister",
         | 
| 139 | 
            -
            		email:"tyrion@example.com",
         | 
| 140 | 
            -
            		gender:"M",
         | 
| 141 | 
            -
            		dateOfBirth:"1978-01-11T00:00:00.000Z",
         | 
| 142 | 
            -
            		joinDate:"2019-09-19T21:06:29.158Z",
         | 
| 143 | 
            -
            		custom:{
         | 
| 144 | 
            -
            			location:"Miami",
         | 
| 145 | 
            -
            			graduationDate:"2018-07-04T21:06:29.158Z",
         | 
| 146 | 
            -
            			isMarried:false
         | 
| 147 | 
            -
            		}
         | 
| 148 | 
            -
            	}
         | 
| 149 | 
            -
            }
         | 
| 150 | 
            -
            )
         | 
| 151 | 
            -
            ```
         | 
| 152 | 
            -
             | 
| 153 | 
            -
            #### Get Player Balance Example
         | 
| 154 | 
            -
             | 
| 155 | 
            -
            ```ruby
         | 
| 156 | 
            -
            Gameball::Transaction.get_player_balance("player456")
         | 
| 157 154 | 
             
            ```
         | 
| 158 155 |  | 
| 159 156 | 
             
            #### Hold Points Example
         | 
| @@ -169,21 +166,29 @@ Gameball::Transaction.hold_points({ | |
| 169 166 | 
             
            #### Redeem Example
         | 
| 170 167 |  | 
| 171 168 | 
             
            ```ruby
         | 
| 169 | 
            +
            # Example 1
         | 
| 172 170 | 
             
            Gameball::Transaction.redeem_points({
         | 
| 173 171 | 
             
            	playerUniqueId:"player456",
         | 
| 174 | 
            -
            	amount:10,
         | 
| 175 172 | 
             
            	transactionId:"tra_123456789",
         | 
| 176 173 | 
             
            	holdReference:"2342452352435234",
         | 
| 177 174 | 
             
            	})
         | 
| 175 | 
            +
             | 
| 176 | 
            +
            # Example 2
         | 
| 177 | 
            +
            Gameball::Transaction.redeem_points({
         | 
| 178 | 
            +
            	playerUniqueId:"player456",
         | 
| 179 | 
            +
            	transactionId:"tra_123456789",
         | 
| 180 | 
            +
            	redeemedAmount:12,
         | 
| 181 | 
            +
            	})
         | 
| 178 182 | 
             
            ```
         | 
| 179 183 |  | 
| 180 184 | 
             
            #### Reverse Transaction Example
         | 
| 181 185 |  | 
| 182 186 | 
             
            ```ruby
         | 
| 183 | 
            -
            Gameball::Transaction. | 
| 184 | 
            -
             | 
| 185 | 
            -
             | 
| 186 | 
            -
             | 
| 187 | 
            +
            Gameball::Transaction.refund({
         | 
| 188 | 
            +
               playerUniqueId:"player456",
         | 
| 189 | 
            +
               transactionId:"1234567890",
         | 
| 190 | 
            +
               reverseTransactionId:"234567891",
         | 
| 191 | 
            +
               amount: nil
         | 
| 187 192 | 
             
            }
         | 
| 188 193 | 
             
            )
         | 
| 189 194 | 
             
            ```
         | 
| @@ -191,56 +196,121 @@ Gameball::Transaction.reverse_transaction({ | |
| 191 196 | 
             
            #### Reverse Hold Example
         | 
| 192 197 |  | 
| 193 198 | 
             
            ```ruby
         | 
| 194 | 
            -
            Gameball::Transaction.reverse_hold( | 
| 195 | 
            -
            	playerUniqueId:" player456",
         | 
| 196 | 
            -
            	holdReference:"9245fe4a-d402-451c-b9ed-9c1a04247482"
         | 
| 197 | 
            -
            }
         | 
| 198 | 
            -
            )
         | 
| 199 | 
            +
            Gameball::Transaction.reverse_hold("9245fe4a-d402-451c-b9ed-9c1a04247482")
         | 
| 199 200 | 
             
            ```
         | 
| 200 201 |  | 
| 201 | 
            -
             | 
| 202 | 
            +
            #### Manual Transaction Example
         | 
| 202 203 |  | 
| 203 204 | 
             
            ```ruby
         | 
| 204 | 
            -
             | 
| 205 | 
            -
             | 
| 206 | 
            -
             | 
| 207 | 
            -
             | 
| 208 | 
            -
             | 
| 209 | 
            -
             | 
| 210 | 
            -
             | 
| 211 | 
            -
             | 
| 212 | 
            -
             | 
| 205 | 
            +
            Gameball::Transaction.manual_transaction({
         | 
| 206 | 
            +
               playerUniqueId:"player123",
         | 
| 207 | 
            +
               amount:99.98,
         | 
| 208 | 
            +
               transactionId:"tra_123456789",
         | 
| 209 | 
            +
               username: "admin_storename",
         | 
| 210 | 
            +
               reason: "Thank You Gift"
         | 
| 211 | 
            +
            })
         | 
| 212 | 
            +
            ```
         | 
| 213 | 
            +
             | 
| 214 | 
            +
            #### List Transactions Example
         | 
| 215 | 
            +
             | 
| 216 | 
            +
            ```ruby
         | 
| 217 | 
            +
            Gameball::Transaction.list_transactions({
         | 
| 218 | 
            +
               page:2,
         | 
| 219 | 
            +
               limit:10
         | 
| 220 | 
            +
            })
         | 
| 221 | 
            +
            ```
         | 
| 222 | 
            +
             | 
| 223 | 
            +
            #### Order Examples
         | 
| 224 | 
            +
             | 
| 225 | 
            +
            ```ruby
         | 
| 226 | 
            +
            Gameball::Order.place_order({
         | 
| 227 | 
            +
              playerUniqueId:"player456",   
         | 
| 228 | 
            +
              orderId: "6253e03b",
         | 
| 229 | 
            +
              totalPrice: "100",
         | 
| 230 | 
            +
              totalPaid: "90",
         | 
| 231 | 
            +
              totalDiscount: "0",
         | 
| 232 | 
            +
              totalShipping: "0",
         | 
| 233 | 
            +
              totalTax: "0", 
         | 
| 234 | 
            +
              lineItems:[
         | 
| 235 | 
            +
                {
         | 
| 236 | 
            +
                  productId:"197765",
         | 
| 237 | 
            +
                  tag: ["VIP"],
         | 
| 238 | 
            +
                  category: [
         | 
| 239 | 
            +
                    "natural",
         | 
| 240 | 
            +
                    "cosmetics"
         | 
| 241 | 
            +
                  ],
         | 
| 242 | 
            +
                  weight: "20",
         | 
| 243 | 
            +
                  vendor: "nike",
         | 
| 244 | 
            +
                  collection: ["14313", "4343"],
         | 
| 245 | 
            +
                },
         | 
| 246 | 
            +
                {
         | 
| 247 | 
            +
                  productId:"875511",
         | 
| 248 | 
            +
                  title: "XPS-15s",
         | 
| 249 | 
            +
                  category: [
         | 
| 250 | 
            +
                    "electronics"
         | 
| 251 | 
            +
                  ],
         | 
| 252 | 
            +
                  vendor: "Dell"
         | 
| 253 | 
            +
                }
         | 
| 254 | 
            +
              ],
         | 
| 255 | 
            +
              discountCodes: [
         | 
| 256 | 
            +
                  "AU7X-8Q7L",
         | 
| 257 | 
            +
                  "BY3V-22GK"
         | 
| 258 | 
            +
              ],
         | 
| 259 | 
            +
              extra: {
         | 
| 260 | 
            +
                paymentMethod: "credit card",
         | 
| 261 | 
            +
                billingAddress: "Alabama"
         | 
| 262 | 
            +
              },
         | 
| 263 | 
            +
              redeemedAmount: 20,
         | 
| 264 | 
            +
              holdReference: nil,
         | 
| 265 | 
            +
              guest: false
         | 
| 213 266 | 
             
            })
         | 
| 267 | 
            +
            ```
         | 
| 268 | 
            +
            #### Leaderboard 
         | 
| 269 | 
            +
             | 
| 270 | 
            +
            ```ruby
         | 
| 271 | 
            +
            # Example 1
         | 
| 272 | 
            +
            Gameball::Leaderboard.get_leaderboard()
         | 
| 273 | 
            +
             | 
| 214 274 | 
             
            # Example 2
         | 
| 215 | 
            -
             | 
| 216 | 
            -
             | 
| 217 | 
            -
             | 
| 218 | 
            -
             | 
| 219 | 
            -
             | 
| 220 | 
            -
             | 
| 221 | 
            -
             | 
| 222 | 
            -
             | 
| 223 | 
            -
             | 
| 224 | 
            -
             | 
| 225 | 
            -
             | 
| 226 | 
            -
             | 
| 275 | 
            +
             | 
| 276 | 
            +
            Gameball::Leaderboard.get_leaderboard({limit: 5})
         | 
| 277 | 
            +
            ```
         | 
| 278 | 
            +
             | 
| 279 | 
            +
            #### Get Player Notifications
         | 
| 280 | 
            +
             | 
| 281 | 
            +
            ```ruby
         | 
| 282 | 
            +
            # Example 1
         | 
| 283 | 
            +
            Gameball::Notifications.get_notifications("player123")
         | 
| 284 | 
            +
             | 
| 285 | 
            +
            # Example 2
         | 
| 286 | 
            +
            Gameball::Notifications.get_notifications("player123",{
         | 
| 287 | 
            +
            	page: 2,
         | 
| 288 | 
            +
            	limit: 10
         | 
| 227 289 | 
             
            })
         | 
| 228 | 
            -
             | 
| 229 | 
            -
             | 
| 230 | 
            -
             | 
| 231 | 
            -
             | 
| 232 | 
            -
             | 
| 233 | 
            -
             | 
| 234 | 
            -
             | 
| 235 | 
            -
             | 
| 236 | 
            -
             | 
| 237 | 
            -
             | 
| 238 | 
            -
             | 
| 239 | 
            -
             | 
| 240 | 
            -
             | 
| 241 | 
            -
             | 
| 290 | 
            +
             | 
| 291 | 
            +
            ```
         | 
| 292 | 
            +
             | 
| 293 | 
            +
            #### Mark Player Notifications
         | 
| 294 | 
            +
             | 
| 295 | 
            +
            ```ruby
         | 
| 296 | 
            +
            Gameball::Notifications.mark_notifications({notificationIds: ["123", "3441", "3245"]})
         | 
| 297 | 
            +
             | 
| 298 | 
            +
            ```
         | 
| 299 | 
            +
             | 
| 300 | 
            +
            #### Configurations
         | 
| 301 | 
            +
             | 
| 302 | 
            +
            ```ruby
         | 
| 303 | 
            +
            # Example 1
         | 
| 304 | 
            +
            Gameball::Configurations.get_configurations()
         | 
| 305 | 
            +
             | 
| 306 | 
            +
            # Example 2
         | 
| 307 | 
            +
            Gameball::Configurations.get_configurations({lang: "en"})
         | 
| 308 | 
            +
             | 
| 242 309 | 
             
            ```
         | 
| 243 310 |  | 
| 311 | 
            +
             | 
| 312 | 
            +
             | 
| 313 | 
            +
             | 
| 244 314 | 
             
            ### Testing
         | 
| 245 315 |  | 
| 246 316 | 
             
            To test run in the terminal `bundle exec rspec spec`
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            module Gameball
         | 
| 2 | 
            +
                class Configurations
         | 
| 3 | 
            +
                  # include Gameball::Utils
         | 
| 4 | 
            +
                  def self.get_configurations(params={})
         | 
| 5 | 
            +
                    Gameball::Utils.validate(params, [], ["lang"])
         | 
| 6 | 
            +
                    res = Gameball::Utils::request("get", "/integrations/config",params:params)
         | 
| 7 | 
            +
                    unless res.kind_of? Net::HTTPSuccess
         | 
| 8 | 
            +
                      if res.kind_of? Net::HTTPInternalServerError
         | 
| 9 | 
            +
                        raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 10 | 
            +
                      else
         | 
| 11 | 
            +
                        raise Gameball::GameballError.new(res.body) 
         | 
| 12 | 
            +
                      end
         | 
| 13 | 
            +
                    else
         | 
| 14 | 
            +
                      return res
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
              
         | 
| @@ -2,7 +2,11 @@ module Gameball | |
| 2 2 | 
             
              class Event
         | 
| 3 3 | 
             
                def self.sendEvent(eventBody)
         | 
| 4 4 | 
             
                  # Validating keys in incoming body
         | 
| 5 | 
            -
                  Gameball | 
| 5 | 
            +
                  if(Gameball.api_version=="v3.0")
         | 
| 6 | 
            +
                    Gameball::Utils.validate(eventBody, ["events", "playerUniqueId"], ["mobile","email"])
         | 
| 7 | 
            +
                  else
         | 
| 8 | 
            +
                    Gameball::Utils.validate(eventBody, ["events", "playerUniqueId"], ["playerAttributes"])
         | 
| 9 | 
            +
                  end
         | 
| 6 10 | 
             
                  res = Gameball::Utils::request("post", "/integrations/event", eventBody)
         | 
| 7 11 | 
             
                  # Check for HTTP Success and throws error if not success
         | 
| 8 12 | 
             
                  unless res.kind_of? Net::HTTPSuccess
         | 
| @@ -0,0 +1,19 @@ | |
| 1 | 
            +
            module Gameball
         | 
| 2 | 
            +
                class Leaderboard
         | 
| 3 | 
            +
                  # include Gameball::Utils
         | 
| 4 | 
            +
                  def self.get_leaderboard(params={})
         | 
| 5 | 
            +
                    Gameball::Utils.validate(params, [], ["limit","from","to","playerUniqueId","challengeId"])
         | 
| 6 | 
            +
                    res = Gameball::Utils::request("get", "/integrations/leaderboard",params:params)
         | 
| 7 | 
            +
                    unless res.kind_of? Net::HTTPSuccess
         | 
| 8 | 
            +
                      if res.kind_of? Net::HTTPInternalServerError
         | 
| 9 | 
            +
                        raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 10 | 
            +
                      else
         | 
| 11 | 
            +
                        raise Gameball::GameballError.new(res.body) 
         | 
| 12 | 
            +
                      end
         | 
| 13 | 
            +
                    else
         | 
| 14 | 
            +
                      return res
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
              
         | 
| @@ -0,0 +1,32 @@ | |
| 1 | 
            +
            module Gameball
         | 
| 2 | 
            +
                class Notifications
         | 
| 3 | 
            +
                  # include Gameball::Utils
         | 
| 4 | 
            +
                  def self.get_notifications(playerUniqueId,params={})
         | 
| 5 | 
            +
                    Gameball::Utils.validate(params, [], ["limit","page","isRead","lang"])
         | 
| 6 | 
            +
                    res = Gameball::Utils::request("get", "/integrations/notifications/#{playerUniqueId}",params:params)
         | 
| 7 | 
            +
                    unless res.kind_of? Net::HTTPSuccess
         | 
| 8 | 
            +
                      if res.kind_of? Net::HTTPInternalServerError
         | 
| 9 | 
            +
                        raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 10 | 
            +
                      else
         | 
| 11 | 
            +
                        raise Gameball::GameballError.new(res.body) 
         | 
| 12 | 
            +
                      end
         | 
| 13 | 
            +
                    else
         | 
| 14 | 
            +
                      return res
         | 
| 15 | 
            +
                    end
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
                  def self.mark_notifications(body)
         | 
| 18 | 
            +
                    Gameball::Utils.validate(body, ["notificationIds"], [])
         | 
| 19 | 
            +
                    res = Gameball::Utils::request("put", "/integrations/notifications",body)
         | 
| 20 | 
            +
                    unless res.kind_of? Net::HTTPSuccess
         | 
| 21 | 
            +
                      if res.kind_of? Net::HTTPInternalServerError
         | 
| 22 | 
            +
                        raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 23 | 
            +
                      else
         | 
| 24 | 
            +
                        raise Gameball::GameballError.new(res.body) 
         | 
| 25 | 
            +
                      end
         | 
| 26 | 
            +
                    else
         | 
| 27 | 
            +
                      return res
         | 
| 28 | 
            +
                    end
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
                end
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
              
         | 
| @@ -0,0 +1,23 @@ | |
| 1 | 
            +
            module Gameball
         | 
| 2 | 
            +
                class Order
         | 
| 3 | 
            +
                  def self.place_order(body)
         | 
| 4 | 
            +
                    # Validating keys in incoming body
         | 
| 5 | 
            +
                    Gameball::Utils.validate(body, ["playerUniqueId","orderId","totalPaid","totalPrice"], 
         | 
| 6 | 
            +
                        ["mobile","email","totalShipping","totalTax","totalDiscount","lineItems","discountCodes","extra","redeemedAmount","holdReference","guest",
         | 
| 7 | 
            +
                            "merchant"])
         | 
| 8 | 
            +
                    body[:orderDate] = Time.now.utc.iso8601
         | 
| 9 | 
            +
                    res = Gameball::Utils::request("post", "/Integrations/order", body)
         | 
| 10 | 
            +
                    # Check for HTTP Success and throws error if not success
         | 
| 11 | 
            +
                    unless res.kind_of? Net::HTTPSuccess
         | 
| 12 | 
            +
                      if res.kind_of? Net::HTTPInternalServerError
         | 
| 13 | 
            +
                        raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 14 | 
            +
                      else
         | 
| 15 | 
            +
                        raise Gameball::GameballError.new(res.body) 
         | 
| 16 | 
            +
                      end
         | 
| 17 | 
            +
                    else
         | 
| 18 | 
            +
                      return res
         | 
| 19 | 
            +
                    end
         | 
| 20 | 
            +
                  end
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
              
         | 
| @@ -2,7 +2,7 @@ module Gameball | |
| 2 2 | 
             
              class Player
         | 
| 3 3 | 
             
                def self.initialize_player(body)
         | 
| 4 4 | 
             
                  # Validating keys in incoming body
         | 
| 5 | 
            -
                  Gameball::Utils.validate(body, ["playerAttributes", "playerUniqueId"], [])
         | 
| 5 | 
            +
                  Gameball::Utils.validate(body, ["playerAttributes", "playerUniqueId"], ["mobile","email","referrerCode","levelOrder"])
         | 
| 6 6 | 
             
                  # .iso8601 Throws an exception if not invoked on a valid date object, so it is used to check if the dates are valid
         | 
| 7 7 | 
             
                  begin
         | 
| 8 8 | 
             
                    body[:playerAttributes][:joinDate] = body[:playerAttributes][:joinDate].iso8601
         | 
| @@ -20,13 +20,70 @@ module Gameball | |
| 20 20 | 
             
                    end
         | 
| 21 21 | 
             
                  else
         | 
| 22 22 | 
             
                    return res
         | 
| 23 | 
            -
                  return res
         | 
| 24 23 | 
             
                  end
         | 
| 25 24 | 
             
                end
         | 
| 26 | 
            -
                def self.get_player_info(playerUniqueId | 
| 27 | 
            -
                   | 
| 28 | 
            -
             | 
| 29 | 
            -
             | 
| 25 | 
            +
                def self.get_player_info(playerUniqueId)
         | 
| 26 | 
            +
                  if Gameball.api_version!="v3.0"
         | 
| 27 | 
            +
                    body = { playerUniqueId: playerUniqueId }
         | 
| 28 | 
            +
                    body["hash"] = Gameball::Utils::hashBody(playerUniqueId: playerUniqueId)
         | 
| 29 | 
            +
                    res = Gameball::Utils::request("post", "/integrations/Player/Info", body)
         | 
| 30 | 
            +
                  else
         | 
| 31 | 
            +
                    res=Gameball::Utils::request("get","/integrations/player/#{playerUniqueId}")
         | 
| 32 | 
            +
                  end
         | 
| 33 | 
            +
                  # Check for HTTP Success and throws error if not success
         | 
| 34 | 
            +
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 35 | 
            +
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| 36 | 
            +
                      raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 37 | 
            +
                    else
         | 
| 38 | 
            +
                      raise Gameball::GameballError.new(res.body) 
         | 
| 39 | 
            +
                    end
         | 
| 40 | 
            +
                  else
         | 
| 41 | 
            +
                    return res
         | 
| 42 | 
            +
                  end
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
                def self.get_player_balance(playerUniqueId)
         | 
| 45 | 
            +
                    res=Gameball::Utils::request("get","/integrations/player/#{playerUniqueId}/balance")
         | 
| 46 | 
            +
                  # Check for HTTP Success and throws error if not success
         | 
| 47 | 
            +
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 48 | 
            +
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| 49 | 
            +
                      raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 50 | 
            +
                    else
         | 
| 51 | 
            +
                      raise Gameball::GameballError.new(res.body) 
         | 
| 52 | 
            +
                    end
         | 
| 53 | 
            +
                  else
         | 
| 54 | 
            +
                    return res
         | 
| 55 | 
            +
                  end
         | 
| 56 | 
            +
                end
         | 
| 57 | 
            +
                def self.get_player_progress(playerUniqueId)
         | 
| 58 | 
            +
                    res=Gameball::Utils::request("get","/integrations/player/#{playerUniqueId}/progress")
         | 
| 59 | 
            +
                  # Check for HTTP Success and throws error if not success
         | 
| 60 | 
            +
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 61 | 
            +
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| 62 | 
            +
                      raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 63 | 
            +
                    else
         | 
| 64 | 
            +
                      raise Gameball::GameballError.new(res.body) 
         | 
| 65 | 
            +
                    end
         | 
| 66 | 
            +
                  else
         | 
| 67 | 
            +
                    return res
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
                end
         | 
| 70 | 
            +
                def self.attach_tags(playerUniqueId,tags)
         | 
| 71 | 
            +
                  body={tags:tags}
         | 
| 72 | 
            +
                  res=Gameball::Utils::request("post","/integrations/player/#{playerUniqueId}/tags",body)
         | 
| 73 | 
            +
                  # Check for HTTP Success and throws error if not success
         | 
| 74 | 
            +
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 75 | 
            +
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| 76 | 
            +
                      raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 77 | 
            +
                    else
         | 
| 78 | 
            +
                      raise Gameball::GameballError.new(res.body) 
         | 
| 79 | 
            +
                    end
         | 
| 80 | 
            +
                  else
         | 
| 81 | 
            +
                    return res
         | 
| 82 | 
            +
                  end
         | 
| 83 | 
            +
                end
         | 
| 84 | 
            +
                def self.detach_tags(playerUniqueId,tags)
         | 
| 85 | 
            +
                  body={tags:tags}
         | 
| 86 | 
            +
                  res=Gameball::Utils::request("delete","/integrations/player/#{playerUniqueId}/tags",body)
         | 
| 30 87 | 
             
                  # Check for HTTP Success and throws error if not success
         | 
| 31 88 | 
             
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 32 89 | 
             
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| @@ -15,10 +15,14 @@ module Gameball | |
| 15 15 | 
             
                def self.hold_points(body)
         | 
| 16 16 | 
             
                  # puts body
         | 
| 17 17 | 
             
                  # check if attributes are available
         | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
             | 
| 18 | 
            +
                  if (Gameball.api_version!="v3.0")
         | 
| 19 | 
            +
                    Gameball::Utils.validate(body, ["playerUniqueId", "amount"], ["otp"])
         | 
| 20 | 
            +
                    body[:transactionTime] = Time.now.utc
         | 
| 21 | 
            +
                    body = Gameball::Utils::extractAttributesToHash(body)
         | 
| 22 | 
            +
                  else
         | 
| 23 | 
            +
                    Gameball::Utils.validate(body, ["playerUniqueId", "amount"], ["mobile","email"])
         | 
| 24 | 
            +
                    body[:transactionTime] = Time.now.utc.iso8601
         | 
| 25 | 
            +
                  end
         | 
| 22 26 | 
             
                  res = Gameball::Utils::request("post", "/integrations/transaction/hold", body)
         | 
| 23 27 | 
             
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 24 28 | 
             
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| @@ -32,9 +36,15 @@ module Gameball | |
| 32 36 | 
             
                end
         | 
| 33 37 | 
             
                def self.redeem_points(body)
         | 
| 34 38 | 
             
                  # check if attributes are available
         | 
| 35 | 
            -
                  Gameball | 
| 36 | 
            -
             | 
| 37 | 
            -
             | 
| 39 | 
            +
                  if (Gameball.api_version!="v3.0")
         | 
| 40 | 
            +
                    Gameball::Utils.validate(body, ["holdReference", "playerUniqueId", "transactionId"], [])
         | 
| 41 | 
            +
                    body[:transactionTime] = Time.now.utc
         | 
| 42 | 
            +
                    body = Gameball::Utils::extractAttributesToHash(body)
         | 
| 43 | 
            +
                  else
         | 
| 44 | 
            +
                    Gameball::Utils.validate(body, ["playerUniqueId", "transactionId"],
         | 
| 45 | 
            +
                      ["mobile","email","redeemedAmount","holdReference"])
         | 
| 46 | 
            +
                    body[:transactionTime] = Time.now.utc.iso8601
         | 
| 47 | 
            +
                  end
         | 
| 38 48 | 
             
                  res = Gameball::Utils::request("post", "/integrations/transaction/redeem", body)
         | 
| 39 49 | 
             
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 40 50 | 
             
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| @@ -49,7 +59,6 @@ module Gameball | |
| 49 59 | 
             
                def self.reverse_transaction(body)
         | 
| 50 60 | 
             
                  Gameball::Utils.validate(body, ["reversedTransactionId", "playerUniqueId", "transactionId"], [])
         | 
| 51 61 | 
             
                  body[:transactionTime] = Time.now.utc
         | 
| 52 | 
            -
             | 
| 53 62 | 
             
                  body = Gameball::Utils::extractAttributesToHash(body)
         | 
| 54 63 | 
             
                  res = Gameball::Utils::request("post", "/integrations/transaction/cancel", body)
         | 
| 55 64 | 
             
                  unless res.kind_of? Net::HTTPSuccess
         | 
| @@ -62,10 +71,24 @@ module Gameball | |
| 62 71 | 
             
                    return res
         | 
| 63 72 | 
             
                  end
         | 
| 64 73 | 
             
                end
         | 
| 74 | 
            +
                def self.refund(body)
         | 
| 75 | 
            +
                  Gameball::Utils.validate(body, ["reverseTransactionId", "playerUniqueId", "transactionId"],
         | 
| 76 | 
            +
                     ["mobile","email","amount"])
         | 
| 77 | 
            +
                  body[:transactionTime] = Time.now.utc.iso8601
         | 
| 78 | 
            +
                  res = Gameball::Utils::request("post", "/integrations/transaction/refund", body)
         | 
| 79 | 
            +
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 80 | 
            +
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| 81 | 
            +
                      raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 82 | 
            +
                    else
         | 
| 83 | 
            +
                      raise Gameball::GameballError.new(res.body) 
         | 
| 84 | 
            +
                    end
         | 
| 85 | 
            +
                  else
         | 
| 86 | 
            +
                    return res
         | 
| 87 | 
            +
                  end
         | 
| 88 | 
            +
                end
         | 
| 65 89 | 
             
                def self.reward_points(body)
         | 
| 66 90 | 
             
                  Gameball::Utils.validate(body, ["playerUniqueId", "amount", "transactionId"], ["playerAttributes"])
         | 
| 67 91 | 
             
                  body[:transactionTime] = Time.now.utc
         | 
| 68 | 
            -
             | 
| 69 92 | 
             
                  body = Gameball::Utils::extractAttributesToHash(body)
         | 
| 70 93 | 
             
                  res = Gameball::Utils::request("post", "/integrations/transaction/reward", body)
         | 
| 71 94 | 
             
                  unless res.kind_of? Net::HTTPSuccess
         | 
| @@ -75,14 +98,68 @@ module Gameball | |
| 75 98 | 
             
                      raise Gameball::GameballError.new(res.body) 
         | 
| 76 99 | 
             
                    end
         | 
| 77 100 | 
             
                  else
         | 
| 78 | 
            -
                    return  | 
| 101 | 
            +
                    return res
         | 
| 102 | 
            +
                  end
         | 
| 103 | 
            +
                end
         | 
| 104 | 
            +
                def self.cashback(body)
         | 
| 105 | 
            +
                  Gameball::Utils.validate(body, ["playerUniqueId", "amount", "transactionId"], ["mobile","email","merchant"])
         | 
| 106 | 
            +
                  body[:transactionTime] = Time.now.utc.iso8601
         | 
| 107 | 
            +
                  res = Gameball::Utils::request("post", "/integrations/transaction/cashback", body)
         | 
| 108 | 
            +
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 109 | 
            +
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| 110 | 
            +
                      raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 111 | 
            +
                    else
         | 
| 112 | 
            +
                      raise Gameball::GameballError.new(res.body) 
         | 
| 113 | 
            +
                    end
         | 
| 114 | 
            +
                  else
         | 
| 115 | 
            +
                    return res
         | 
| 116 | 
            +
                  end
         | 
| 117 | 
            +
                end
         | 
| 118 | 
            +
                def self.manual_transaction(body)
         | 
| 119 | 
            +
                  Gameball::Utils.validate(body, ["playerUniqueId", "username", "transactionId","reason"],
         | 
| 120 | 
            +
                     ["mobile","email","amount","points"])
         | 
| 121 | 
            +
                  body[:transactionTime] = Time.now.utc.iso8601
         | 
| 122 | 
            +
                  res = Gameball::Utils::request("post", "/integrations/transaction/manual", body)
         | 
| 123 | 
            +
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 124 | 
            +
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| 125 | 
            +
                      raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 126 | 
            +
                    else
         | 
| 127 | 
            +
                      raise Gameball::GameballError.new(res.body) 
         | 
| 128 | 
            +
                    end
         | 
| 129 | 
            +
                  else
         | 
| 130 | 
            +
                    return res
         | 
| 131 | 
            +
                  end
         | 
| 132 | 
            +
                end
         | 
| 133 | 
            +
                def self.list_transactions(params={})
         | 
| 134 | 
            +
                  Gameball::Utils.validate(params, [], ["page","limit","direction","from","to","transactionId","status"])
         | 
| 135 | 
            +
                  res = Gameball::Utils::request("get", "/integrations/transaction/list",params:params)
         | 
| 136 | 
            +
                  unless res.kind_of? Net::HTTPSuccess
         | 
| 137 | 
            +
                    if res.kind_of? Net::HTTPInternalServerError
         | 
| 138 | 
            +
                      raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 139 | 
            +
                    else
         | 
| 140 | 
            +
                      raise Gameball::GameballError.new(res.body) 
         | 
| 141 | 
            +
                    end
         | 
| 142 | 
            +
                  else
         | 
| 143 | 
            +
                    return res
         | 
| 79 144 | 
             
                  end
         | 
| 80 145 | 
             
                end
         | 
| 81 146 | 
             
                def self.reverse_hold(body)
         | 
| 82 147 | 
             
                  # check if holdReference is in body else throw error
         | 
| 148 | 
            +
                  if(Gameball.api_version=="v3.0")
         | 
| 149 | 
            +
                    # If v3.0 holReference is sent instead of body in args
         | 
| 150 | 
            +
                    res = Gameball::Utils::request("delete", "/integrations/transaction/hold/#{body}")
         | 
| 151 | 
            +
                    unless res.kind_of? Net::HTTPSuccess
         | 
| 152 | 
            +
                      if res.kind_of? Net::HTTPInternalServerError
         | 
| 153 | 
            +
                        raise Gameball::GameballError.new("An Internal Server Error has occurred")
         | 
| 154 | 
            +
                      else
         | 
| 155 | 
            +
                        raise Gameball::GameballError.new(res.body) 
         | 
| 156 | 
            +
                      end
         | 
| 157 | 
            +
                    else
         | 
| 158 | 
            +
                      return res
         | 
| 159 | 
            +
                    end
         | 
| 160 | 
            +
                  end
         | 
| 83 161 | 
             
                  Gameball::Utils.validate(body, ["holdReference", "playerUniqueId"], [])
         | 
| 84 162 | 
             
                  body[:transactionTime] = Time.now.utc
         | 
| 85 | 
            -
             | 
| 86 163 | 
             
                  body = Gameball::Utils::extractAttributesToHash(body)
         | 
| 87 164 | 
             
                  res = Gameball::Utils::request("post", "/integrations/transaction/hold", body)
         | 
| 88 165 | 
             
                  unless res.kind_of? Net::HTTPSuccess
         | 
| @@ -2,28 +2,31 @@ module Gameball | |
| 2 2 | 
             
              module Utils
         | 
| 3 3 | 
             
                extend self
         | 
| 4 4 |  | 
| 5 | 
            -
                def request(verb, path, body = {},lang | 
| 5 | 
            +
                def request(verb, path, body = {},lang:"",params:{})
         | 
| 6 | 
            +
             | 
| 6 7 | 
             
                  # check for api_version and key and throw error if not included
         | 
| 7 8 | 
             
                  if !Gameball.api_key
         | 
| 8 9 | 
             
                    raise Gameball::GameballError.new("Please provide the api_key before making a request, try Gameball::api_key='your_key'")
         | 
| 9 10 | 
             
                  end
         | 
| 10 11 | 
             
                  uri = URI(Gameball.api_base + "/api" + "/" + Gameball.api_version + path)
         | 
| 11 | 
            -
             | 
| 12 | 
            +
                  if params != {}
         | 
| 13 | 
            +
                    uri.query=URI.encode_www_form(params)
         | 
| 14 | 
            +
                  end
         | 
| 12 15 | 
             
                  https = Net::HTTP.new(uri.host, uri.port)
         | 
| 13 16 | 
             
                  https.max_retries = Gameball.max_retries
         | 
| 14 17 | 
             
                  https.read_timeout = Gameball.read_timeout
         | 
| 15 18 | 
             
                  https.keep_alive_timeout = Gameball.keep_alive_timeout
         | 
| 16 19 | 
             
                  https.use_ssl = true
         | 
| 17 | 
            -
             | 
| 20 | 
            +
                  
         | 
| 18 21 | 
             
                  case verb.downcase
         | 
| 19 22 | 
             
                  when "post"
         | 
| 20 | 
            -
                    req = Net::HTTP::Post.new(uri | 
| 23 | 
            +
                    req = Net::HTTP::Post.new(uri, initheader = { "Content-Type" => "application/json" })
         | 
| 21 24 | 
             
                  when "get"
         | 
| 22 | 
            -
                    req = Net::HTTP::Get.new(uri | 
| 25 | 
            +
                    req = Net::HTTP::Get.new(uri, initheader = { "Content-Type" => "application/json" })
         | 
| 23 26 | 
             
                  when "put"
         | 
| 24 | 
            -
                    req = Net::HTTP::Put.new(uri | 
| 27 | 
            +
                    req = Net::HTTP::Put.new(uri, initheader = { "Content-Type" => "application/json" })
         | 
| 25 28 | 
             
                  when "delete"
         | 
| 26 | 
            -
                    req = Net::HTTP::Delete.new(uri | 
| 29 | 
            +
                    req = Net::HTTP::Delete.new(uri, initheader = { "Content-Type" => "application/json" })
         | 
| 27 30 | 
             
                  else
         | 
| 28 31 | 
             
                    raise Gameball::GameballException.new("Please provide a valid HTTP Verb") # will later throw an exception
         | 
| 29 32 | 
             
                  end
         | 
| @@ -34,6 +37,7 @@ module Gameball | |
| 34 37 | 
             
                    req["lang"]=lang
         | 
| 35 38 | 
             
                  end
         | 
| 36 39 | 
             
                  req["APIKey"] = Gameball.api_key
         | 
| 40 | 
            +
                  req["secretKey"]=Gameball.transaction_key
         | 
| 37 41 | 
             
                  res = https.request(req)
         | 
| 38 42 | 
             
                  return res
         | 
| 39 43 | 
             
                end
         | 
| @@ -66,8 +70,9 @@ module Gameball | |
| 66 70 | 
             
                  if body != {}
         | 
| 67 71 | 
             
                    req.body = body.to_json
         | 
| 68 72 | 
             
                  end
         | 
| 69 | 
            -
                  req["APIKey"] = Gameball.api_key
         | 
| 70 73 | 
             
                  Thread.new do
         | 
| 74 | 
            +
                    req["APIKey"] = Gameball.api_key
         | 
| 75 | 
            +
                    req["secretKey"]=Gameball.transaction_key
         | 
| 71 76 | 
             
                    res = https.request(req)
         | 
| 72 77 | 
             
                    return res
         | 
| 73 78 | 
             
                  end
         | 
    
        data/lib/gameball/version.rb
    CHANGED
    
    
    
        data/lib/gameball.rb
    CHANGED
    
    | @@ -1,6 +1,5 @@ | |
| 1 1 | 
             
            # Requiring all dependencies needed
         | 
| 2 2 | 
             
            require "net/http"
         | 
| 3 | 
            -
            require "net/http"
         | 
| 4 3 | 
             
            require "openssl"
         | 
| 5 4 | 
             
            require "uri"
         | 
| 6 5 | 
             
            require "Time"
         | 
| @@ -16,18 +15,21 @@ require_relative "./gameball/models/transaction" | |
| 16 15 | 
             
            require_relative "./gameball/models/referral"
         | 
| 17 16 | 
             
            require_relative "./gameball/models/coupon"
         | 
| 18 17 | 
             
            require_relative "./gameball/models/action"
         | 
| 18 | 
            +
            require_relative "./gameball/models/order"
         | 
| 19 | 
            +
            require_relative "./gameball/models/leaderboard"
         | 
| 20 | 
            +
            require_relative "./gameball/models/notifications"
         | 
| 21 | 
            +
            require_relative "./gameball/models/configurations"
         | 
| 19 22 | 
             
            require_relative "./gameball/exceptions/gameballException"
         | 
| 20 | 
            -
            require_relative "./gameball/lang"
         | 
| 21 23 |  | 
| 22 24 | 
             
            module Gameball
         | 
| 23 | 
            -
              @api_base = "https://api.gameball. | 
| 25 | 
            +
              @api_base = "https://api.dev.gameball.app/"
         | 
| 24 26 | 
             
              @max_retries = 1
         | 
| 25 27 | 
             
              @read_timeout = 60
         | 
| 26 28 | 
             
              @keep_alive_timeout = 30
         | 
| 27 29 | 
             
              @api_version = "v2.0"
         | 
| 28 30 | 
             
              class << self
         | 
| 29 31 | 
             
                attr_accessor :api_key
         | 
| 30 | 
            -
                 | 
| 32 | 
            +
                attr_accessor :api_version
         | 
| 31 33 | 
             
                attr_accessor :transaction_key
         | 
| 32 34 | 
             
                attr_accessor :read_timeout
         | 
| 33 35 | 
             
                attr_accessor :max_retries
         | 
    
        data/test.rb
    ADDED
    
    | @@ -0,0 +1,46 @@ | |
| 1 | 
            +
            require "./lib/gameball"
         | 
| 2 | 
            +
            Gameball.api_key="184be486ad124379a8d1bf6dbe59cd8a"
         | 
| 3 | 
            +
            Gameball.transaction_key="5cd1cb2bef9f475c85e8d2a6edd85895"
         | 
| 4 | 
            +
            Gameball.api_version="v3.0"
         | 
| 5 | 
            +
            res=Gameball::Order.place_order({
         | 
| 6 | 
            +
                playerUniqueId:"player45126",   
         | 
| 7 | 
            +
                orderId: "6253e0123b",
         | 
| 8 | 
            +
                totalPrice: "100",
         | 
| 9 | 
            +
                totalPaid: "90",
         | 
| 10 | 
            +
                totalDiscount: "0",
         | 
| 11 | 
            +
                totalShipping: "0",
         | 
| 12 | 
            +
                totalTax: "0", 
         | 
| 13 | 
            +
                lineItems:[
         | 
| 14 | 
            +
                  {
         | 
| 15 | 
            +
                    productId:"197765",
         | 
| 16 | 
            +
                    tag: ["VIP"],
         | 
| 17 | 
            +
                    category: [
         | 
| 18 | 
            +
                      "natural",
         | 
| 19 | 
            +
                      "cosmetics"
         | 
| 20 | 
            +
                    ],
         | 
| 21 | 
            +
                    weight: "20",
         | 
| 22 | 
            +
                    vendor: "nike",
         | 
| 23 | 
            +
                    collection: ["14313", "4343"],
         | 
| 24 | 
            +
                  },
         | 
| 25 | 
            +
                  {
         | 
| 26 | 
            +
                    productId:"875511",
         | 
| 27 | 
            +
                    title: "XPS-15s",
         | 
| 28 | 
            +
                    category: [
         | 
| 29 | 
            +
                      "electronics"
         | 
| 30 | 
            +
                    ],
         | 
| 31 | 
            +
                    vendor: "Dell"
         | 
| 32 | 
            +
                  }
         | 
| 33 | 
            +
                ],
         | 
| 34 | 
            +
                discountCodes: [
         | 
| 35 | 
            +
                    "AU7X-8Q7L",
         | 
| 36 | 
            +
                    "BY3V-22GK"
         | 
| 37 | 
            +
                ],
         | 
| 38 | 
            +
                extra: {
         | 
| 39 | 
            +
                  paymentMethod: "credit card",
         | 
| 40 | 
            +
                  billingAddress: "Alabama"
         | 
| 41 | 
            +
                },
         | 
| 42 | 
            +
                redeemedAmount: 20,
         | 
| 43 | 
            +
                holdReference: nil,
         | 
| 44 | 
            +
                guest: false
         | 
| 45 | 
            +
              })
         | 
| 46 | 
            +
              puts res.body
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gameball
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1. | 
| 4 | 
            +
              version: 2.1.3
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Alsouidan
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-12-06 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         | 
| @@ -38,7 +38,7 @@ dependencies: | |
| 38 38 | 
             
                - - ">="
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 40 | 
             
                    version: '3.0'
         | 
| 41 | 
            -
            description: | 
| 41 | 
            +
            description:
         | 
| 42 42 | 
             
            email:
         | 
| 43 43 | 
             
            - alsouidan@gmail.com
         | 
| 44 44 | 
             
            executables: []
         | 
| @@ -63,8 +63,12 @@ files: | |
| 63 63 | 
             
            - lib/gameball/exceptions/gameballException.rb
         | 
| 64 64 | 
             
            - lib/gameball/lang.rb
         | 
| 65 65 | 
             
            - lib/gameball/models/action.rb
         | 
| 66 | 
            +
            - lib/gameball/models/configurations.rb
         | 
| 66 67 | 
             
            - lib/gameball/models/coupon.rb
         | 
| 67 68 | 
             
            - lib/gameball/models/event.rb
         | 
| 69 | 
            +
            - lib/gameball/models/leaderboard.rb
         | 
| 70 | 
            +
            - lib/gameball/models/notifications.rb
         | 
| 71 | 
            +
            - lib/gameball/models/order.rb
         | 
| 68 72 | 
             
            - lib/gameball/models/player.rb
         | 
| 69 73 | 
             
            - lib/gameball/models/referral.rb
         | 
| 70 74 | 
             
            - lib/gameball/models/transaction.rb
         | 
| @@ -72,6 +76,7 @@ files: | |
| 72 76 | 
             
            - lib/gameball/utils/request.rb
         | 
| 73 77 | 
             
            - lib/gameball/utils/validation.rb
         | 
| 74 78 | 
             
            - lib/gameball/version.rb
         | 
| 79 | 
            +
            - test.rb
         | 
| 75 80 | 
             
            homepage: https://www.gameball.co/
         | 
| 76 81 | 
             
            licenses:
         | 
| 77 82 | 
             
            - MIT
         | 
| @@ -79,7 +84,7 @@ metadata: | |
| 79 84 | 
             
              homepage_uri: https://www.gameball.co/
         | 
| 80 85 | 
             
              source_code_uri: https://github.com/gameballers/gameball-ruby
         | 
| 81 86 | 
             
              changelog_uri: http://mygemserver.com
         | 
| 82 | 
            -
            post_install_message: | 
| 87 | 
            +
            post_install_message:
         | 
| 83 88 | 
             
            rdoc_options: []
         | 
| 84 89 | 
             
            require_paths:
         | 
| 85 90 | 
             
            - lib
         | 
| @@ -94,8 +99,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 94 99 | 
             
                - !ruby/object:Gem::Version
         | 
| 95 100 | 
             
                  version: '0'
         | 
| 96 101 | 
             
            requirements: []
         | 
| 97 | 
            -
            rubygems_version: 3. | 
| 98 | 
            -
            signing_key: | 
| 102 | 
            +
            rubygems_version: 3.2.32
         | 
| 103 | 
            +
            signing_key:
         | 
| 99 104 | 
             
            specification_version: 4
         | 
| 100 105 | 
             
            summary: Ruby SDK for Gameball's API
         | 
| 101 106 | 
             
            test_files: []
         |