big_door 0.0.1
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.
- data/History.txt +4 -0
 - data/Manifest.txt +72 -0
 - data/README.rdoc +170 -0
 - data/Rakefile +32 -0
 - data/autotest/discover.rb +1 -0
 - data/big_door.gemspec +56 -0
 - data/bin/example.rb +93 -0
 - data/features/resources/attribute.feature +41 -0
 - data/features/resources/currency_type.feature +12 -0
 - data/features/resources/end_user.feature +92 -0
 - data/features/resources/named_award_collection.feature +42 -0
 - data/features/resources/named_good_collection.feature +40 -0
 - data/features/resources/named_level_collection.feature +44 -0
 - data/features/resources/url.feature +41 -0
 - data/features/step_definitions/resources_steps.rb +370 -0
 - data/features/support/env.rb +9 -0
 - data/lib/big_door/attribute.rb +21 -0
 - data/lib/big_door/award.rb +24 -0
 - data/lib/big_door/client.rb +281 -0
 - data/lib/big_door/currency.rb +26 -0
 - data/lib/big_door/currency_balance.rb +27 -0
 - data/lib/big_door/currency_type.rb +29 -0
 - data/lib/big_door/end_user.rb +32 -0
 - data/lib/big_door/good.rb +32 -0
 - data/lib/big_door/leaderboard.rb +41 -0
 - data/lib/big_door/level.rb +25 -0
 - data/lib/big_door/named_award.rb +24 -0
 - data/lib/big_door/named_award_collection.rb +21 -0
 - data/lib/big_door/named_good.rb +24 -0
 - data/lib/big_door/named_good_collection.rb +22 -0
 - data/lib/big_door/named_level.rb +26 -0
 - data/lib/big_door/named_level_collection.rb +23 -0
 - data/lib/big_door/named_transaction.rb +21 -0
 - data/lib/big_door/named_transaction_group.rb +74 -0
 - data/lib/big_door/profile.rb +28 -0
 - data/lib/big_door/resource.rb +204 -0
 - data/lib/big_door/resource_end_user.rb +84 -0
 - data/lib/big_door/resource_with_association.rb +37 -0
 - data/lib/big_door/resource_with_parent.rb +43 -0
 - data/lib/big_door/url.rb +21 -0
 - data/lib/big_door.rb +40 -0
 - data/script/console +10 -0
 - data/script/destroy +14 -0
 - data/script/generate +14 -0
 - data/spec/big_door/attribute_spec.rb +18 -0
 - data/spec/big_door/award_spec.rb +19 -0
 - data/spec/big_door/client_spec.rb +163 -0
 - data/spec/big_door/currency_balance_spec.rb +14 -0
 - data/spec/big_door/currency_spec.rb +81 -0
 - data/spec/big_door/currency_type_spec.rb +21 -0
 - data/spec/big_door/end_user_spec.rb +23 -0
 - data/spec/big_door/good_spec.rb +14 -0
 - data/spec/big_door/leaderboard_spec.rb +15 -0
 - data/spec/big_door/level_spec.rb +19 -0
 - data/spec/big_door/named_award_collection_spec.rb +23 -0
 - data/spec/big_door/named_award_spec.rb +23 -0
 - data/spec/big_door/named_good_collection_spec.rb +23 -0
 - data/spec/big_door/named_good_spec.rb +23 -0
 - data/spec/big_door/named_level_collection_spec.rb +23 -0
 - data/spec/big_door/named_level_spec.rb +24 -0
 - data/spec/big_door/named_transaction_group_spec.rb +29 -0
 - data/spec/big_door/named_transaction_spec.rb +23 -0
 - data/spec/big_door/profile_spec.rb +19 -0
 - data/spec/big_door/resource_end_user_spec.rb +22 -0
 - data/spec/big_door/resource_spec.rb +22 -0
 - data/spec/big_door/resource_with_association_spec.rb +23 -0
 - data/spec/big_door/resource_with_parent_spec.rb +22 -0
 - data/spec/big_door/url_spec.rb +23 -0
 - data/spec/spec.opts +1 -0
 - data/spec/spec_helper.rb +17 -0
 - data/tasks/cucumber.rake +5 -0
 - data/tasks/rspec.rake +29 -0
 - metadata +263 -0
 
| 
         @@ -0,0 +1,281 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'restclient'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'addressable/uri'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'json'
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'digest/sha1'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'uuidtools'
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 8 
     | 
    
         
            +
                #
         
     | 
| 
      
 9 
     | 
    
         
            +
                # This module provides interface to BigDoor public REST API
         
     | 
| 
      
 10 
     | 
    
         
            +
                #
         
     | 
| 
      
 11 
     | 
    
         
            +
                DEFAULT_APP_HOST = 'http://api.bigdoor.com'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                class Client
         
     | 
| 
      
 14 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 15 
     | 
    
         
            +
                    # This class provides low-level interface to BigDoor public REST API
         
     | 
| 
      
 16 
     | 
    
         
            +
                    #
         
     | 
| 
      
 17 
     | 
    
         
            +
                    attr_accessor :app_key
         
     | 
| 
      
 18 
     | 
    
         
            +
                    attr_accessor :app_secret
         
     | 
| 
      
 19 
     | 
    
         
            +
                    attr_accessor :app_host
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 22 
     | 
    
         
            +
                    # Creates new BigDoor::Client object
         
     | 
| 
      
 23 
     | 
    
         
            +
                    #
         
     | 
| 
      
 24 
     | 
    
         
            +
                    # @param [String] app_secret
         
     | 
| 
      
 25 
     | 
    
         
            +
                    #   The API secret supplied by BigDoor. (see API Keys http://publisher.bigdoor.com/)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #
         
     | 
| 
      
 27 
     | 
    
         
            +
                    # @param [String] app_key
         
     | 
| 
      
 28 
     | 
    
         
            +
                    #   The API key supplied by BigDoor. (see API Keys http://publisher.bigdoor.com/)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    #
         
     | 
| 
      
 30 
     | 
    
         
            +
                    # @param [String] app_host  
         
     | 
| 
      
 31 
     | 
    
         
            +
                    #   An alternative host to enable use with testing servers.
         
     | 
| 
      
 32 
     | 
    
         
            +
                    #
         
     | 
| 
      
 33 
     | 
    
         
            +
                    def initialize( app_secret, app_key, app_host = DEFAULT_APP_HOST )
         
     | 
| 
      
 34 
     | 
    
         
            +
                        @app_key = app_key
         
     | 
| 
      
 35 
     | 
    
         
            +
                        @app_secret = app_secret
         
     | 
| 
      
 36 
     | 
    
         
            +
                        @app_host = app_host
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                        @base_url = "/api/publisher/#{@app_key}"
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 42 
     | 
    
         
            +
                    # Converts params hash to string
         
     | 
| 
      
 43 
     | 
    
         
            +
                    #
         
     | 
| 
      
 44 
     | 
    
         
            +
                    # @param params 
         
     | 
| 
      
 45 
     | 
    
         
            +
                    #   Hash representing request params, except +sig+ and +format+ fields
         
     | 
| 
      
 46 
     | 
    
         
            +
                    # 
         
     | 
| 
      
 47 
     | 
    
         
            +
                    # @return [String] Request params concatanated 
         
     | 
| 
      
 48 
     | 
    
         
            +
                    #
         
     | 
| 
      
 49 
     | 
    
         
            +
                    def flatten_params( params )
         
     | 
| 
      
 50 
     | 
    
         
            +
                        raise ArgumentError.new('params should be defined') unless params
         
     | 
| 
      
 51 
     | 
    
         
            +
                        result = ''
         
     | 
| 
      
 52 
     | 
    
         
            +
                        keys = params.keys.sort{|a,b| a.to_s <=> b.to_s}
         
     | 
| 
      
 53 
     | 
    
         
            +
                        keys.each do |key| 
         
     | 
| 
      
 54 
     | 
    
         
            +
                            next if key == 'sig' 
         
     | 
| 
      
 55 
     | 
    
         
            +
                            next if key == 'format'
         
     | 
| 
      
 56 
     | 
    
         
            +
                            result += "#{key}#{params[key]}"
         
     | 
| 
      
 57 
     | 
    
         
            +
                        end
         
     | 
| 
      
 58 
     | 
    
         
            +
                        $log.debug(sprintf "flatten_params = %s", result )
         
     | 
| 
      
 59 
     | 
    
         
            +
                        result
         
     | 
| 
      
 60 
     | 
    
         
            +
                    end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 63 
     | 
    
         
            +
                    #  Generate appropriate request signature given a url and optional
         
     | 
| 
      
 64 
     | 
    
         
            +
                    #  params and payload.
         
     | 
| 
      
 65 
     | 
    
         
            +
                    #
         
     | 
| 
      
 66 
     | 
    
         
            +
                    #  @param [String] url
         
     | 
| 
      
 67 
     | 
    
         
            +
                    #    The full URL, including the base /api/publisher/[app_key]
         
     | 
| 
      
 68 
     | 
    
         
            +
                    #
         
     | 
| 
      
 69 
     | 
    
         
            +
                    #  @param [Hash] params  
         
     | 
| 
      
 70 
     | 
    
         
            +
                    #    The parameters to be sent via the query string.
         
     | 
| 
      
 71 
     | 
    
         
            +
                    #
         
     | 
| 
      
 72 
     | 
    
         
            +
                    #  @param [Hash] payload
         
     | 
| 
      
 73 
     | 
    
         
            +
                    #    The parameters to be sent via the PUT or POST request body.
         
     | 
| 
      
 74 
     | 
    
         
            +
                    #
         
     | 
| 
      
 75 
     | 
    
         
            +
                    #  @return [String] request signature to be sent as +sign+ query param
         
     | 
| 
      
 76 
     | 
    
         
            +
                    #    
         
     | 
| 
      
 77 
     | 
    
         
            +
                    def generate_signature( url, params = nil, payload = nil )
         
     | 
| 
      
 78 
     | 
    
         
            +
                        signature = url
         
     | 
| 
      
 79 
     | 
    
         
            +
                        signature += flatten_params( params ) if params
         
     | 
| 
      
 80 
     | 
    
         
            +
                        signature += flatten_params( payload ) if payload 
         
     | 
| 
      
 81 
     | 
    
         
            +
                        signature += @app_secret
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                        $log.debug(sprintf "signature = %s", signature )
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
                        Digest::SHA256.hexdigest(signature)
         
     | 
| 
      
 86 
     | 
    
         
            +
                    end
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 89 
     | 
    
         
            +
                    # Generate random token for request
         
     | 
| 
      
 90 
     | 
    
         
            +
                    #
         
     | 
| 
      
 91 
     | 
    
         
            +
                    #  @return [String] Random token to be sent as +token+ 
         
     | 
| 
      
 92 
     | 
    
         
            +
                    def generate_token
         
     | 
| 
      
 93 
     | 
    
         
            +
                        UUIDTools::UUID.random_create.hexdigest
         
     | 
| 
      
 94 
     | 
    
         
            +
                    end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 97 
     | 
    
         
            +
                    # Add requered fields to params and payload
         
     | 
| 
      
 98 
     | 
    
         
            +
                    #
         
     | 
| 
      
 99 
     | 
    
         
            +
                    #  @param [Symbol] method 
         
     | 
| 
      
 100 
     | 
    
         
            +
                    #    HTTP request method
         
     | 
| 
      
 101 
     | 
    
         
            +
                    #
         
     | 
| 
      
 102 
     | 
    
         
            +
                    #  @param [Hash] params  
         
     | 
| 
      
 103 
     | 
    
         
            +
                    #    The parameters to be sent via the query string.
         
     | 
| 
      
 104 
     | 
    
         
            +
                    #
         
     | 
| 
      
 105 
     | 
    
         
            +
                    #  @param [Hash] payload
         
     | 
| 
      
 106 
     | 
    
         
            +
                    #    The parameters to be sent via the PUT or POST request body.
         
     | 
| 
      
 107 
     | 
    
         
            +
                    #
         
     | 
| 
      
 108 
     | 
    
         
            +
                    #  @return [Hash, Hash] Updated params and payload
         
     | 
| 
      
 109 
     | 
    
         
            +
                    #
         
     | 
| 
      
 110 
     | 
    
         
            +
                    def add_required_params( method, params, payload )
         
     | 
| 
      
 111 
     | 
    
         
            +
                        raise ArgumentError.new('unkown method') unless [:get, :put, :post, :delete].include?(method)
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
                        params = {} unless params
         
     | 
| 
      
 114 
     | 
    
         
            +
                        payload = {} unless payload
         
     | 
| 
      
 115 
     | 
    
         
            +
                        
         
     | 
| 
      
 116 
     | 
    
         
            +
                        is_postish = [:post, :put].include?(method)
         
     | 
| 
      
 117 
     | 
    
         
            +
             
     | 
| 
      
 118 
     | 
    
         
            +
                        if is_postish && payload.key?('time')
         
     | 
| 
      
 119 
     | 
    
         
            +
                            params['time'] = payload['time']
         
     | 
| 
      
 120 
     | 
    
         
            +
                        end
         
     | 
| 
      
 121 
     | 
    
         
            +
                        if params && !params.key?('time')
         
     | 
| 
      
 122 
     | 
    
         
            +
                            params['time'] = Time.now.to_i.to_s
         
     | 
| 
      
 123 
     | 
    
         
            +
                        end
         
     | 
| 
      
 124 
     | 
    
         
            +
                        if is_postish && !payload.key?('time')
         
     | 
| 
      
 125 
     | 
    
         
            +
                            payload['time'] = params['time']
         
     | 
| 
      
 126 
     | 
    
         
            +
                        end
         
     | 
| 
      
 127 
     | 
    
         
            +
             
     | 
| 
      
 128 
     | 
    
         
            +
                        if is_postish && !payload.key?('token')
         
     | 
| 
      
 129 
     | 
    
         
            +
                            payload['token'] = self.generate_token
         
     | 
| 
      
 130 
     | 
    
         
            +
                        end
         
     | 
| 
      
 131 
     | 
    
         
            +
                        
         
     | 
| 
      
 132 
     | 
    
         
            +
                        if method == :delete && !params.key?('delete_token') 
         
     | 
| 
      
 133 
     | 
    
         
            +
                            params['delete_token'] = self.generate_token
         
     | 
| 
      
 134 
     | 
    
         
            +
                        end
         
     | 
| 
      
 135 
     | 
    
         
            +
             
     | 
| 
      
 136 
     | 
    
         
            +
                        [params, payload]
         
     | 
| 
      
 137 
     | 
    
         
            +
                    end
         
     | 
| 
      
 138 
     | 
    
         
            +
             
     | 
| 
      
 139 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 140 
     | 
    
         
            +
                    # Sign request
         
     | 
| 
      
 141 
     | 
    
         
            +
                    #
         
     | 
| 
      
 142 
     | 
    
         
            +
                    #  @param [Symbol] method 
         
     | 
| 
      
 143 
     | 
    
         
            +
                    #    HTTP request method
         
     | 
| 
      
 144 
     | 
    
         
            +
                    #
         
     | 
| 
      
 145 
     | 
    
         
            +
                    #  @param [String] url 
         
     | 
| 
      
 146 
     | 
    
         
            +
                    #    HTTP request URL
         
     | 
| 
      
 147 
     | 
    
         
            +
                    #
         
     | 
| 
      
 148 
     | 
    
         
            +
                    #  @param [Hash] params  
         
     | 
| 
      
 149 
     | 
    
         
            +
                    #    The parameters to be sent via the query string.
         
     | 
| 
      
 150 
     | 
    
         
            +
                    #
         
     | 
| 
      
 151 
     | 
    
         
            +
                    #  @param [Hash] payload
         
     | 
| 
      
 152 
     | 
    
         
            +
                    #    The parameters to be sent via the PUT or POST request body.
         
     | 
| 
      
 153 
     | 
    
         
            +
                    #
         
     | 
| 
      
 154 
     | 
    
         
            +
                    #  @return [Hash, Hash] Updated params and payload 
         
     | 
| 
      
 155 
     | 
    
         
            +
                    #
         
     | 
| 
      
 156 
     | 
    
         
            +
                    def sign_request( method, url, params, payload )
         
     | 
| 
      
 157 
     | 
    
         
            +
             
     | 
| 
      
 158 
     | 
    
         
            +
                        params, payload = add_required_params( method, params, payload )
         
     | 
| 
      
 159 
     | 
    
         
            +
             
     | 
| 
      
 160 
     | 
    
         
            +
                        params['sig'] = self.generate_signature( url, params, payload )
         
     | 
| 
      
 161 
     | 
    
         
            +
                        
         
     | 
| 
      
 162 
     | 
    
         
            +
                        [params, payload]
         
     | 
| 
      
 163 
     | 
    
         
            +
                    end
         
     | 
| 
      
 164 
     | 
    
         
            +
             
     | 
| 
      
 165 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 166 
     | 
    
         
            +
                    # Makes GET HTTP request to API with optional params
         
     | 
| 
      
 167 
     | 
    
         
            +
                    #
         
     | 
| 
      
 168 
     | 
    
         
            +
                    #  @param [String] url 
         
     | 
| 
      
 169 
     | 
    
         
            +
                    #    relative API end point (eg. currency_type/1 )
         
     | 
| 
      
 170 
     | 
    
         
            +
                    #
         
     | 
| 
      
 171 
     | 
    
         
            +
                    #  @param [Hash] params
         
     | 
| 
      
 172 
     | 
    
         
            +
                    #    The parameters to be sent via the query string.
         
     | 
| 
      
 173 
     | 
    
         
            +
                    #
         
     | 
| 
      
 174 
     | 
    
         
            +
                    #  @return [Hash] Decoded JSON response
         
     | 
| 
      
 175 
     | 
    
         
            +
                    #
         
     | 
| 
      
 176 
     | 
    
         
            +
                    def get( url, params = nil)
         
     | 
| 
      
 177 
     | 
    
         
            +
                        do_request( :get, url, params)
         
     | 
| 
      
 178 
     | 
    
         
            +
                    end
         
     | 
| 
      
 179 
     | 
    
         
            +
             
     | 
| 
      
 180 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 181 
     | 
    
         
            +
                    # Makes POST HTTP request to API with optional params and
         
     | 
| 
      
 182 
     | 
    
         
            +
                    # www-form-urlencoded payload
         
     | 
| 
      
 183 
     | 
    
         
            +
                    #
         
     | 
| 
      
 184 
     | 
    
         
            +
                    #  @param [String] url 
         
     | 
| 
      
 185 
     | 
    
         
            +
                    #    relative API end point (eg. currency_type )
         
     | 
| 
      
 186 
     | 
    
         
            +
                    #
         
     | 
| 
      
 187 
     | 
    
         
            +
                    #  @param [Hash] params
         
     | 
| 
      
 188 
     | 
    
         
            +
                    #    The parameters to be sent via the query string.
         
     | 
| 
      
 189 
     | 
    
         
            +
                    #
         
     | 
| 
      
 190 
     | 
    
         
            +
                    #  @param [Hash] payload
         
     | 
| 
      
 191 
     | 
    
         
            +
                    #    The parameters to be sent via the PUT or POST request body.
         
     | 
| 
      
 192 
     | 
    
         
            +
                    #
         
     | 
| 
      
 193 
     | 
    
         
            +
                    #  @return [Hash] Decoded JSON response
         
     | 
| 
      
 194 
     | 
    
         
            +
                    #
         
     | 
| 
      
 195 
     | 
    
         
            +
                    def post( url, params, payload )
         
     | 
| 
      
 196 
     | 
    
         
            +
                        do_request( :post, url, params, payload)
         
     | 
| 
      
 197 
     | 
    
         
            +
                    end
         
     | 
| 
      
 198 
     | 
    
         
            +
             
     | 
| 
      
 199 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 200 
     | 
    
         
            +
                    # Makes PUT HTTP request to API with optional params and
         
     | 
| 
      
 201 
     | 
    
         
            +
                    # www-form-urlencoded payload
         
     | 
| 
      
 202 
     | 
    
         
            +
                    #
         
     | 
| 
      
 203 
     | 
    
         
            +
                    #  @param [String] url 
         
     | 
| 
      
 204 
     | 
    
         
            +
                    #    relative API end point (eg. currency/12345 )
         
     | 
| 
      
 205 
     | 
    
         
            +
                    #
         
     | 
| 
      
 206 
     | 
    
         
            +
                    #  @param [Hash] params
         
     | 
| 
      
 207 
     | 
    
         
            +
                    #    The parameters to be sent via the query string.
         
     | 
| 
      
 208 
     | 
    
         
            +
                    #
         
     | 
| 
      
 209 
     | 
    
         
            +
                    #  @param [Hash] payload
         
     | 
| 
      
 210 
     | 
    
         
            +
                    #    The parameters to be sent via the PUT or POST request body.
         
     | 
| 
      
 211 
     | 
    
         
            +
                    #
         
     | 
| 
      
 212 
     | 
    
         
            +
                    #  @return [Hash] Decoded JSON response
         
     | 
| 
      
 213 
     | 
    
         
            +
                    #
         
     | 
| 
      
 214 
     | 
    
         
            +
                    def put( url, params, payload  )
         
     | 
| 
      
 215 
     | 
    
         
            +
                        do_request( :put, url, params, payload)
         
     | 
| 
      
 216 
     | 
    
         
            +
                    end
         
     | 
| 
      
 217 
     | 
    
         
            +
             
     | 
| 
      
 218 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 219 
     | 
    
         
            +
                    # Makes DELETE HTTP request to API with optional params
         
     | 
| 
      
 220 
     | 
    
         
            +
                    #
         
     | 
| 
      
 221 
     | 
    
         
            +
                    #  @param [String] url 
         
     | 
| 
      
 222 
     | 
    
         
            +
                    #    relative API end point (eg. currency/12345 )
         
     | 
| 
      
 223 
     | 
    
         
            +
                    #
         
     | 
| 
      
 224 
     | 
    
         
            +
                    #  @param [Hash] params
         
     | 
| 
      
 225 
     | 
    
         
            +
                    #    The parameters to be sent via the query string.
         
     | 
| 
      
 226 
     | 
    
         
            +
                    #
         
     | 
| 
      
 227 
     | 
    
         
            +
                    #  @return [String] should return empty string in case of success
         
     | 
| 
      
 228 
     | 
    
         
            +
                    #
         
     | 
| 
      
 229 
     | 
    
         
            +
                    def delete( url, params = nil)
         
     | 
| 
      
 230 
     | 
    
         
            +
                        do_request( :delete, url, params)
         
     | 
| 
      
 231 
     | 
    
         
            +
                    end
         
     | 
| 
      
 232 
     | 
    
         
            +
             
     | 
| 
      
 233 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 234 
     | 
    
         
            +
                    # Makes HTTP request to API with optional params and 
         
     | 
| 
      
 235 
     | 
    
         
            +
                    # www-form-urlencoded payload
         
     | 
| 
      
 236 
     | 
    
         
            +
                    #
         
     | 
| 
      
 237 
     | 
    
         
            +
                    #   @param [Symbol] method 
         
     | 
| 
      
 238 
     | 
    
         
            +
                    #     HTTP request method
         
     | 
| 
      
 239 
     | 
    
         
            +
                    #
         
     | 
| 
      
 240 
     | 
    
         
            +
                    #  @param [String] url 
         
     | 
| 
      
 241 
     | 
    
         
            +
                    #    relative API end point (eg. currency/12345 )
         
     | 
| 
      
 242 
     | 
    
         
            +
                    #
         
     | 
| 
      
 243 
     | 
    
         
            +
                    #  @param [Hash] params
         
     | 
| 
      
 244 
     | 
    
         
            +
                    #    The parameters to be sent via the query string.
         
     | 
| 
      
 245 
     | 
    
         
            +
                    #
         
     | 
| 
      
 246 
     | 
    
         
            +
                    #  @param [Hash] payload
         
     | 
| 
      
 247 
     | 
    
         
            +
                    #    The parameters to be sent via the PUT or POST request body.
         
     | 
| 
      
 248 
     | 
    
         
            +
                    #
         
     | 
| 
      
 249 
     | 
    
         
            +
                    #  @return [Hash] Decoded JSON response or empty/undefined string
         
     | 
| 
      
 250 
     | 
    
         
            +
                    #
         
     | 
| 
      
 251 
     | 
    
         
            +
                    def do_request( method, end_point, params = nil, payload = nil )
         
     | 
| 
      
 252 
     | 
    
         
            +
                        headers = {
         
     | 
| 
      
 253 
     | 
    
         
            +
                            'User-Agent' => "BigDoorKit-Ruby/#{VERSION}",
         
     | 
| 
      
 254 
     | 
    
         
            +
                        }
         
     | 
| 
      
 255 
     | 
    
         
            +
                        
         
     | 
| 
      
 256 
     | 
    
         
            +
                        if [:post, :put].include?(method)
         
     | 
| 
      
 257 
     | 
    
         
            +
                            headers['Content-Type'] = 'application/x-www-form-urlencoded'
         
     | 
| 
      
 258 
     | 
    
         
            +
                        end
         
     | 
| 
      
 259 
     | 
    
         
            +
             
     | 
| 
      
 260 
     | 
    
         
            +
                        params, payload = sign_request( method, @base_url + '/' + end_point, params, payload )
         
     | 
| 
      
 261 
     | 
    
         
            +
             
     | 
| 
      
 262 
     | 
    
         
            +
                        url = Addressable::URI.parse( @app_host + @base_url + '/' + end_point )
         
     | 
| 
      
 263 
     | 
    
         
            +
                        $log.debug( sprintf 'url  object = %s', url.inspect )
         
     | 
| 
      
 264 
     | 
    
         
            +
                        $log.debug( sprintf 'params = %s', params.inspect )
         
     | 
| 
      
 265 
     | 
    
         
            +
                        url.query_values = params
         
     | 
| 
      
 266 
     | 
    
         
            +
             
     | 
| 
      
 267 
     | 
    
         
            +
                        $log.debug( sprintf 'method url = %s %s', method, url )
         
     | 
| 
      
 268 
     | 
    
         
            +
                        $log.debug( sprintf 'payload = %s', payload.inspect )
         
     | 
| 
      
 269 
     | 
    
         
            +
                        
         
     | 
| 
      
 270 
     | 
    
         
            +
                        response = RestClient::Request.execute(:method => method, :url => url.to_s, :payload => payload, :headers => headers, :raw_response => false)
         
     | 
| 
      
 271 
     | 
    
         
            +
                        if response && !response.empty?
         
     | 
| 
      
 272 
     | 
    
         
            +
                            $log.debug( sprintf 'undecoded_response = %s', response.inspect )
         
     | 
| 
      
 273 
     | 
    
         
            +
                            decoded_response = JSON.parse( response )
         
     | 
| 
      
 274 
     | 
    
         
            +
                            $log.debug( sprintf 'decoded_response = %s', decoded_response.inspect )
         
     | 
| 
      
 275 
     | 
    
         
            +
                            decoded_response[0]
         
     | 
| 
      
 276 
     | 
    
         
            +
                        end
         
     | 
| 
      
 277 
     | 
    
         
            +
                    rescue RestClient::Exception => ex
         
     | 
| 
      
 278 
     | 
    
         
            +
                        $log.debug(sprintf 'Error response body: %s', ex.http_body)
         
     | 
| 
      
 279 
     | 
    
         
            +
                    end
         
     | 
| 
      
 280 
     | 
    
         
            +
                end
         
     | 
| 
      
 281 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides Currency Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /currency BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class Currency < Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new Currency object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "Currency init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'currency_type_id' => 1,
         
     | 
| 
      
 17 
     | 
    
         
            +
                            'currency_type_title' => '',
         
     | 
| 
      
 18 
     | 
    
         
            +
                            'exchange_rate' => 1,
         
     | 
| 
      
 19 
     | 
    
         
            +
                            'relative_weight' => 1,
         
     | 
| 
      
 20 
     | 
    
         
            +
                        }
         
     | 
| 
      
 21 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 22 
     | 
    
         
            +
                        $log.debug( "Currency default_values = #{default_values.inspect}")
         
     | 
| 
      
 23 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides CurrencyBalance Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /end_user/{id}/currency_balance BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class CurrencyBalance < ResourceEndUser
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new CurrencyBalance object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "CurrencyBalance init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'read_only'            => 0,
         
     | 
| 
      
 17 
     | 
    
         
            +
                            'adjustment_amount'    => 0,
         
     | 
| 
      
 18 
     | 
    
         
            +
                            'curr_balance'         => 0,
         
     | 
| 
      
 19 
     | 
    
         
            +
                            'prev_balance'         => 0,
         
     | 
| 
      
 20 
     | 
    
         
            +
                            'transaction_group_id' => nil,
         
     | 
| 
      
 21 
     | 
    
         
            +
                        }
         
     | 
| 
      
 22 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 23 
     | 
    
         
            +
                        $log.debug( "CurrencyBalance default_values = #{default_values.inspect}")
         
     | 
| 
      
 24 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 25 
     | 
    
         
            +
                    end
         
     | 
| 
      
 26 
     | 
    
         
            +
                end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,29 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides CurrencyType Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /currency_type BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class CurrencyType < Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new CurrencyType object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "CurrencyType init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'read_only'                          => 1,
         
     | 
| 
      
 17 
     | 
    
         
            +
                            'title'                              => '',
         
     | 
| 
      
 18 
     | 
    
         
            +
                            'description'                        => '',
         
     | 
| 
      
 19 
     | 
    
         
            +
                            'has_dollar_exchange_rate_integrity' => 0,
         
     | 
| 
      
 20 
     | 
    
         
            +
                            'can_be_cross_publisher'             => 0,
         
     | 
| 
      
 21 
     | 
    
         
            +
                            'can_be_purchased'                   => 0,
         
     | 
| 
      
 22 
     | 
    
         
            +
                            'can_be_rewarded'                    => 0,
         
     | 
| 
      
 23 
     | 
    
         
            +
                        }
         
     | 
| 
      
 24 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 25 
     | 
    
         
            +
                        $log.debug( "CurrencyType default_values = #{default_values.inspect}")
         
     | 
| 
      
 26 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 27 
     | 
    
         
            +
                    end
         
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides EndUser Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /end_user BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class EndUser < Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # Initialize new EndUser object with optional Hash 
         
     | 
| 
      
 10 
     | 
    
         
            +
                    #
         
     | 
| 
      
 11 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 13 
     | 
    
         
            +
                    #
         
     | 
| 
      
 14 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 15 
     | 
    
         
            +
                        $log.debug( "EndUser init with hash = #{hash.inspect}")
         
     | 
| 
      
 16 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 17 
     | 
    
         
            +
                            'end_user_login'          => '',
         
     | 
| 
      
 18 
     | 
    
         
            +
                        }
         
     | 
| 
      
 19 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 20 
     | 
    
         
            +
                        $log.debug( "EndUser default_values = #{default_values.inspect}")
         
     | 
| 
      
 21 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 25 
     | 
    
         
            +
                    # Overrides object resource id 
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #
         
     | 
| 
      
 27 
     | 
    
         
            +
                    # @return [String] resource id
         
     | 
| 
      
 28 
     | 
    
         
            +
                    def resource_id
         
     | 
| 
      
 29 
     | 
    
         
            +
                        self.end_user_login
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides Good Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /end_user/{id}/good BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class Good < ResourceEndUser
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new Good object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "Good init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'named_good_id' => nil,
         
     | 
| 
      
 17 
     | 
    
         
            +
                        }
         
     | 
| 
      
 18 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 19 
     | 
    
         
            +
                        $log.debug( "Good default_values = #{default_values.inspect}")
         
     | 
| 
      
 20 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 24 
     | 
    
         
            +
                    # Override parent_id_attr from ResourceEndUser Class
         
     | 
| 
      
 25 
     | 
    
         
            +
                    #
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #  @return [String] Parent Id attribute
         
     | 
| 
      
 27 
     | 
    
         
            +
                    #
         
     | 
| 
      
 28 
     | 
    
         
            +
                    def parent_id_attr
         
     | 
| 
      
 29 
     | 
    
         
            +
                        'good_receiver'
         
     | 
| 
      
 30 
     | 
    
         
            +
                    end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,41 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides Leaderboard Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /leaderboard BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class Leaderboard < Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new Leaderboard object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "Leaderboard init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = { }
         
     | 
| 
      
 16 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 17 
     | 
    
         
            +
                        $log.debug( "Leaderboard default_values = #{default_values.inspect}")
         
     | 
| 
      
 18 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 21 
     | 
    
         
            +
                    # Executes Leaderboard retrieval
         
     | 
| 
      
 22 
     | 
    
         
            +
                    #
         
     | 
| 
      
 23 
     | 
    
         
            +
                    #  @param [Hash] params
         
     | 
| 
      
 24 
     | 
    
         
            +
                    #    request params
         
     | 
| 
      
 25 
     | 
    
         
            +
                    #
         
     | 
| 
      
 26 
     | 
    
         
            +
                    #  @param [BigDoor::Client] client
         
     | 
| 
      
 27 
     | 
    
         
            +
                    #    Initialized BigDoor::Client object
         
     | 
| 
      
 28 
     | 
    
         
            +
                    #
         
     | 
| 
      
 29 
     | 
    
         
            +
                    #  @return [Array] array of Hashes representing Leaderboard
         
     | 
| 
      
 30 
     | 
    
         
            +
                    #
         
     | 
| 
      
 31 
     | 
    
         
            +
                    def execute( params, client )
         
     | 
| 
      
 32 
     | 
    
         
            +
                        $log.debug('execute leaderboard');
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                        uri = sprintf '%s/execute', end_point
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                        $log.debug( sprintf 'execute uri = %s', uri )
         
     | 
| 
      
 37 
     | 
    
         
            +
                        result = client.get( uri , params )
         
     | 
| 
      
 38 
     | 
    
         
            +
                        $log.debug(sprintf 'result = %s', result.inspect );
         
     | 
| 
      
 39 
     | 
    
         
            +
                    end
         
     | 
| 
      
 40 
     | 
    
         
            +
                end
         
     | 
| 
      
 41 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides Level Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /end_user/{id}/level BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class Level < ResourceEndUser
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new Level object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "Level init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'transaction_group_id' => 0,
         
     | 
| 
      
 17 
     | 
    
         
            +
                            'end_user_login'       => nil,
         
     | 
| 
      
 18 
     | 
    
         
            +
                            'named_level_id'       => nil,
         
     | 
| 
      
 19 
     | 
    
         
            +
                        }
         
     | 
| 
      
 20 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 21 
     | 
    
         
            +
                        $log.debug( "Level default_values = #{default_values.inspect}")
         
     | 
| 
      
 22 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides NamedAward Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /named_award BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class NamedAward < ResourceWithParent
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new NamedAward object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "NamedAward init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'named_award_collection_id'          => nil,
         
     | 
| 
      
 17 
     | 
    
         
            +
                            'relative_weight'                    => 0,
         
     | 
| 
      
 18 
     | 
    
         
            +
                        }
         
     | 
| 
      
 19 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 20 
     | 
    
         
            +
                        $log.debug( "NamedAward default_values = #{default_values.inspect}")
         
     | 
| 
      
 21 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides NamedAwardCollection Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /named_award_collection BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class NamedAwardCollection < Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new NamedAwardCollection object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "NamedAwardCollection init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = { }
         
     | 
| 
      
 16 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 17 
     | 
    
         
            +
                        $log.debug( "NamedAwardCollection default_values = #{default_values.inspect}")
         
     | 
| 
      
 18 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides NamedGood Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /named_good BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class NamedGood < ResourceWithParent
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new NamedGood object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "NamedGood init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'named_good_collection_id'           => nil,
         
     | 
| 
      
 17 
     | 
    
         
            +
                            'relative_weight'                    => 0,
         
     | 
| 
      
 18 
     | 
    
         
            +
                        }
         
     | 
| 
      
 19 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 20 
     | 
    
         
            +
                        $log.debug( "NamedGood default_values = #{default_values.inspect}")
         
     | 
| 
      
 21 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides NamedGoodCollection Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /named_good_collection BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class NamedGoodCollection < Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new NamedGoodCollection object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "NamedGoodCollection init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                        }
         
     | 
| 
      
 17 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 18 
     | 
    
         
            +
                        $log.debug( "NamedGoodCollection default_values = #{default_values.inspect}")
         
     | 
| 
      
 19 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 20 
     | 
    
         
            +
                    end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides NamedLevel Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /named_level BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class NamedLevel < ResourceWithParent
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new NamedLevel object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "NamedLevel init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'named_level_collection_id'          => nil,
         
     | 
| 
      
 17 
     | 
    
         
            +
                            'relative_weight'                    => 0,
         
     | 
| 
      
 18 
     | 
    
         
            +
                            'threshold'                          => 0,
         
     | 
| 
      
 19 
     | 
    
         
            +
                        }
         
     | 
| 
      
 20 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 21 
     | 
    
         
            +
                        $log.debug( "NamedLevel default_values = #{default_values.inspect}")
         
     | 
| 
      
 22 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 23 
     | 
    
         
            +
                    end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides NamedLevelCollection Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /named_level_collection BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class NamedLevelCollection < Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new NamedLevelCollection object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "NamedLevelCollection init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = {
         
     | 
| 
      
 16 
     | 
    
         
            +
                            'currency_id'  => nil,
         
     | 
| 
      
 17 
     | 
    
         
            +
                        }
         
     | 
| 
      
 18 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 19 
     | 
    
         
            +
                        $log.debug( "NamedLevelCollection default_values = #{default_values.inspect}")
         
     | 
| 
      
 20 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 21 
     | 
    
         
            +
                    end
         
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module BigDoor
         
     | 
| 
      
 2 
     | 
    
         
            +
                #
         
     | 
| 
      
 3 
     | 
    
         
            +
                # This module provides NamedTransaction Resource object 
         
     | 
| 
      
 4 
     | 
    
         
            +
                # corresponding to /named_transaction BigDoor API end point
         
     | 
| 
      
 5 
     | 
    
         
            +
                #
         
     | 
| 
      
 6 
     | 
    
         
            +
                class NamedTransaction < Resource
         
     | 
| 
      
 7 
     | 
    
         
            +
                    ##
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initialize new NamedTransaction object with optional Hash 
         
     | 
| 
      
 9 
     | 
    
         
            +
                    #
         
     | 
| 
      
 10 
     | 
    
         
            +
                    # @param [Hash] hash 
         
     | 
| 
      
 11 
     | 
    
         
            +
                    #   Optional fields to assign to object
         
     | 
| 
      
 12 
     | 
    
         
            +
                    #
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def initialize( hash = {} ) 
         
     | 
| 
      
 14 
     | 
    
         
            +
                        $log.debug( "NamedTransaction init with hash = #{hash.inspect}")
         
     | 
| 
      
 15 
     | 
    
         
            +
                        default_values = { }
         
     | 
| 
      
 16 
     | 
    
         
            +
                        default_values.merge!( hash )
         
     | 
| 
      
 17 
     | 
    
         
            +
                        $log.debug( "NamedTransaction default_values = #{default_values.inspect}")
         
     | 
| 
      
 18 
     | 
    
         
            +
                        super( default_values )
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
      
 21 
     | 
    
         
            +
            end
         
     |