alphaSDK 0.2.0 → 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/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +36 -0
- data/LICENSE.txt +21 -0
- data/README.md +259 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/examples.rb +174 -0
- data/gameball.gemspec +29 -0
- data/lib/gameball.rb +21 -20
- data/lib/gameball/exceptions/gameballException.rb +5 -5
- data/lib/gameball/models/action.rb +28 -10
- data/lib/gameball/models/coupon.rb +50 -29
- data/lib/gameball/models/event.rb +30 -25
- data/lib/gameball/models/player.rb +37 -28
- data/lib/gameball/models/referral.rb +24 -20
- data/lib/gameball/models/transaction.rb +90 -64
- data/lib/gameball/utils/helper.rb +30 -34
- data/lib/gameball/utils/request.rb +65 -91
- data/lib/gameball/utils/validation.rb +13 -11
- data/lib/gameball/version.rb +3 -0
- data/lib/testFile.rb +24 -16
- metadata +57 -12
- data/lib/gameball/models/gameballResponse.rb +0 -0
| @@ -1,18 +1,20 @@ | |
| 1 1 | 
             
            module Gameball
         | 
| 2 2 | 
             
              module Utils
         | 
| 3 3 | 
             
                extend self
         | 
| 4 | 
            -
             | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
                     | 
| 10 | 
            -
             | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
             | 
| 4 | 
            +
             | 
| 5 | 
            +
                def validate(hash, required, optional) # Method used to validate body parameters by checking optional fields and required fields
         | 
| 6 | 
            +
                  errors = []
         | 
| 7 | 
            +
                  # Loop on required fields and throw error if field is not in ruby hash
         | 
| 8 | 
            +
                  required.each do |val|
         | 
| 9 | 
            +
                    raise Gameball::GameballError.new("Required key: #{val.to_sym.inspect}") unless hash.has_key?(val.to_sym)
         | 
| 10 | 
            +
                  end
         | 
| 11 | 
            +
                  allowed = optional + required
         | 
| 12 | 
            +
                  # Loop on each field in ruby hash and check if it is allowed
         | 
| 13 | 
            +
                  hash.each_key do |val|
         | 
| 14 | 
            +
                    unless allowed.include?(val.to_s)
         | 
| 15 | 
            +
                      raise Gameball::GameballError.new("Unknown key: #{val.to_sym.inspect}. Valid keys are: #{allowed.map(&:inspect).join(", ")}")
         | 
| 14 16 | 
             
                    end
         | 
| 15 17 | 
             
                  end
         | 
| 18 | 
            +
                end
         | 
| 16 19 | 
             
              end
         | 
| 17 20 | 
             
            end
         | 
| 18 | 
            -
             | 
    
        data/lib/testFile.rb
    CHANGED
    
    | @@ -1,13 +1,22 @@ | |
| 1 | 
            -
            require_relative  | 
| 2 | 
            -
            Gameball::api_key="7c7636658209418c9a82306a421f76a5"
         | 
| 3 | 
            -
            Gameball::api_version="v2.0"
         | 
| 4 | 
            -
            Gameball::transaction_key="26e1967d89114388bdd1772587c336c8"
         | 
| 1 | 
            +
            require_relative "./gameball"
         | 
| 2 | 
            +
            Gameball::api_key = "7c7636658209418c9a82306a421f76a5"
         | 
| 3 | 
            +
            Gameball::api_version = "v2.0"
         | 
| 4 | 
            +
            Gameball::transaction_key = "26e1967d89114388bdd1772587c336c8"
         | 
| 5 5 | 
             
            # res=Gameball::Transaction.get_player_balance("uniqueKey00")
         | 
| 6 | 
            -
            res=Gameball::Player.initialize_player({playerUniqueId:"uniquekeys120",playerAttributes:
         | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 6 | 
            +
            # res = Gameball::Player.initialize_player({ playerUniqueId: "uniquekeys120", playerAttributes: { displayName: "player", firstName: "player1", lastName: "player2", email: "aliplayer@gmail.com",
         | 
| 7 | 
            +
            #                                                                                               gender: "Male", mobileNumber: "+201002580909",
         | 
| 8 | 
            +
            #                                                                                               dateOfBirth: Date.parse("10/10/2010"), joinDate: Time.now.utc } })
         | 
| 9 | 
            +
            res= Gameball::Action.send_action({ playerUniqueId: "player123",events:{
         | 
| 10 | 
            +
            review:{},
         | 
| 11 | 
            +
            reserve:{rooms:2}
         | 
| 12 | 
            +
                    
         | 
| 13 | 
            +
                  },
         | 
| 14 | 
            +
                  pointsTransaction:{
         | 
| 15 | 
            +
                        rewardAmount:2,
         | 
| 16 | 
            +
                        transactionId:12
         | 
| 17 | 
            +
                  }
         | 
| 18 | 
            +
                  }
         | 
| 19 | 
            +
                 )                                                                                            
         | 
| 11 20 | 
             
            # res=Gameball::Transaction.hold_points({
         | 
| 12 21 | 
             
            #   playerUniqueId:"uniqueKey00",
         | 
| 13 22 | 
             
            #   amount:2,
         | 
| @@ -17,13 +26,13 @@ res=Gameball::Player.initialize_player({playerUniqueId:"uniquekeys120",playerAtt | |
| 17 26 | 
             
            #     holdReference:"c61153e4-fc79-4b1c-adce-f789bc061fe9",
         | 
| 18 27 | 
             
            #     playerUniqueId:"uniqueKey00",
         | 
| 19 28 | 
             
            #     amount:2,
         | 
| 20 | 
            -
            #      | 
| 29 | 
            +
            #     transactionId:12,
         | 
| 21 30 | 
             
            #     transactionTime:Time.now.utc
         | 
| 22 31 | 
             
            # })
         | 
| 23 32 | 
             
            # res=Gameball::Transaction.reverse_transaction({
         | 
| 24 33 | 
             
            #     playerUniqueId:"uniqueKey00",
         | 
| 25 | 
            -
            #      | 
| 26 | 
            -
            #      | 
| 34 | 
            +
            #     transactionId:12,
         | 
| 35 | 
            +
            #     reversedTransactionId:12,
         | 
| 27 36 | 
             
            #     transactionTime:Time.now.utc
         | 
| 28 37 | 
             
            # })
         | 
| 29 38 | 
             
            # res=Gameball::Transaction.reverse_hold({
         | 
| @@ -42,7 +51,7 @@ res=Gameball::Player.initialize_player({playerUniqueId:"uniquekeys120",playerAtt | |
| 42 51 | 
             
            #  playerUniqueId:"uniqueKey00",
         | 
| 43 52 | 
             
            #   amount:100,
         | 
| 44 53 | 
             
            #   transactionTime:Time.now.utc,
         | 
| 45 | 
            -
            #    | 
| 54 | 
            +
            #   transactionId:"1232344",
         | 
| 46 55 |  | 
| 47 56 | 
             
            # })
         | 
| 48 57 | 
             
            #   res=Gameball::Event.sendEvent({
         | 
| @@ -62,16 +71,15 @@ res=Gameball::Player.initialize_player({playerUniqueId:"uniquekeys120",playerAtt | |
| 62 71 | 
             
            #          graduationDate:"2018-07-04T21:06:29.158Z",
         | 
| 63 72 | 
             
            #          isMarried:false
         | 
| 64 73 | 
             
            #   	}
         | 
| 65 | 
            -
             | 
| 74 | 
            +
             | 
| 66 75 | 
             
            #    }
         | 
| 67 76 | 
             
            # }
         | 
| 68 77 |  | 
| 69 | 
            -
             | 
| 70 78 | 
             
            # )
         | 
| 71 79 | 
             
            # res=Gameball::Event.sendEvent({
         | 
| 72 80 | 
             
            #         events:{view_product_page:{customer_id:"123",product_id:"123",product_title:"title",product_vendor:"vendor",shop_name:"shop"}},
         | 
| 73 81 | 
             
            #         playerUniqueId:"uniquekeys120",
         | 
| 74 | 
            -
            #         playerAttributes:{displayName:" | 
| 82 | 
            +
            #         playerAttributes:{displayName:"player",firstName:"player1",lastName:"player2",email:"aliplayer1@gmail.com",gender:"Male",mobileNumber:"+201002580909",dateOfBirth:"0123",joinDate:Time.now.utc}
         | 
| 75 83 | 
             
            #         })
         | 
| 76 84 | 
             
            p res.body
         | 
| 77 85 | 
             
            # p res
         | 
    
        metadata
    CHANGED
    
    | @@ -1,38 +1,83 @@ | |
| 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 | 
            -
            bindir:  | 
| 9 | 
            +
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2020- | 
| 12 | 
            -
            dependencies: | 
| 13 | 
            -
             | 
| 14 | 
            -
             | 
| 11 | 
            +
            date: 2020-08-19 00:00:00.000000000 Z
         | 
| 12 | 
            +
            dependencies:
         | 
| 13 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            +
              name: rake
         | 
| 15 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 | 
            +
                requirements:
         | 
| 17 | 
            +
                - - ">="
         | 
| 18 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            +
                    version: '12.0'
         | 
| 20 | 
            +
              type: :runtime
         | 
| 21 | 
            +
              prerelease: false
         | 
| 22 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 | 
            +
                requirements:
         | 
| 24 | 
            +
                - - ">="
         | 
| 25 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            +
                    version: '12.0'
         | 
| 27 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 28 | 
            +
              name: rspec
         | 
| 29 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 30 | 
            +
                requirements:
         | 
| 31 | 
            +
                - - ">="
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '3.0'
         | 
| 34 | 
            +
              type: :runtime
         | 
| 35 | 
            +
              prerelease: false
         | 
| 36 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 | 
            +
                requirements:
         | 
| 38 | 
            +
                - - ">="
         | 
| 39 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            +
                    version: '3.0'
         | 
| 41 | 
            +
            description: 
         | 
| 42 | 
            +
            email:
         | 
| 43 | 
            +
            - alsouidan@gmail.com
         | 
| 15 44 | 
             
            executables: []
         | 
| 16 45 | 
             
            extensions: []
         | 
| 17 46 | 
             
            extra_rdoc_files: []
         | 
| 18 47 | 
             
            files:
         | 
| 48 | 
            +
            - ".gitignore"
         | 
| 49 | 
            +
            - ".rspec"
         | 
| 50 | 
            +
            - ".travis.yml"
         | 
| 51 | 
            +
            - CODE_OF_CONDUCT.md
         | 
| 52 | 
            +
            - Gemfile
         | 
| 53 | 
            +
            - Gemfile.lock
         | 
| 54 | 
            +
            - LICENSE.txt
         | 
| 55 | 
            +
            - README.md
         | 
| 56 | 
            +
            - Rakefile
         | 
| 57 | 
            +
            - bin/console
         | 
| 58 | 
            +
            - bin/setup
         | 
| 59 | 
            +
            - examples.rb
         | 
| 60 | 
            +
            - gameball.gemspec
         | 
| 19 61 | 
             
            - lib/gameball.rb
         | 
| 20 62 | 
             
            - lib/gameball/exceptions/gameballException.rb
         | 
| 21 63 | 
             
            - lib/gameball/models/action.rb
         | 
| 22 64 | 
             
            - lib/gameball/models/coupon.rb
         | 
| 23 65 | 
             
            - lib/gameball/models/event.rb
         | 
| 24 | 
            -
            - lib/gameball/models/gameballResponse.rb
         | 
| 25 66 | 
             
            - lib/gameball/models/player.rb
         | 
| 26 67 | 
             
            - lib/gameball/models/referral.rb
         | 
| 27 68 | 
             
            - lib/gameball/models/transaction.rb
         | 
| 28 69 | 
             
            - lib/gameball/utils/helper.rb
         | 
| 29 70 | 
             
            - lib/gameball/utils/request.rb
         | 
| 30 71 | 
             
            - lib/gameball/utils/validation.rb
         | 
| 72 | 
            +
            - lib/gameball/version.rb
         | 
| 31 73 | 
             
            - lib/testFile.rb
         | 
| 32 | 
            -
            homepage: https:// | 
| 74 | 
            +
            homepage: https://www.gameball.co/
         | 
| 33 75 | 
             
            licenses:
         | 
| 34 76 | 
             
            - MIT
         | 
| 35 | 
            -
            metadata: | 
| 77 | 
            +
            metadata:
         | 
| 78 | 
            +
              homepage_uri: https://www.gameball.co/
         | 
| 79 | 
            +
              source_code_uri: http://mygemserver.com
         | 
| 80 | 
            +
              changelog_uri: http://mygemserver.com
         | 
| 36 81 | 
             
            post_install_message: 
         | 
| 37 82 | 
             
            rdoc_options: []
         | 
| 38 83 | 
             
            require_paths:
         | 
| @@ -41,7 +86,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 41 86 | 
             
              requirements:
         | 
| 42 87 | 
             
              - - ">="
         | 
| 43 88 | 
             
                - !ruby/object:Gem::Version
         | 
| 44 | 
            -
                  version:  | 
| 89 | 
            +
                  version: 2.3.0
         | 
| 45 90 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 46 91 | 
             
              requirements:
         | 
| 47 92 | 
             
              - - ">="
         | 
| @@ -51,5 +96,5 @@ requirements: [] | |
| 51 96 | 
             
            rubygems_version: 3.0.3
         | 
| 52 97 | 
             
            signing_key: 
         | 
| 53 98 | 
             
            specification_version: 4
         | 
| 54 | 
            -
            summary:  | 
| 99 | 
            +
            summary: Ruby SDK for Gameball's API
         | 
| 55 100 | 
             
            test_files: []
         | 
| 
            File without changes
         |