promoted-ruby-client 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/dev.md +1 -1
- data/lib/promoted/ruby/client/request_builder.rb +13 -16
- data/lib/promoted/ruby/client/version.rb +1 -1
- data/lib/promoted/ruby/client.rb +8 -4
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 99f637dce3d3f85f13e8937bf586e6e9f5a11891b262e84a6e66d57a44bc6b09
         | 
| 4 | 
            +
              data.tar.gz: 0c517b9e7b0049c6ae873c90db9536eae6b153367114cc50af887f36efcf79f2
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 640878d97d82424619a60ebf451db0f1501d15e625adfc2c53f3a47511e2661cb4d61bc8788d5b42f93c11f778411bc3bad59d5bab3fd787270a9b015f9968c3
         | 
| 7 | 
            +
              data.tar.gz: e4a99864846f7d542e773d84897f9ce3ff9db842115d0ebd835f604a7763bebfa7c875656377e22f57442637f71a7d0663b098379e2603c5b6852f9696e626ce
         | 
    
        data/Gemfile.lock
    CHANGED
    
    
    
        data/dev.md
    CHANGED
    
    | @@ -4,5 +4,5 @@ | |
| 4 4 | 
             
            2. Get credentials for deployment from 1password.
         | 
| 5 5 | 
             
            3. Modify `promoted-ruby-client.gemspec`'s push block.
         | 
| 6 6 | 
             
            4. Run `gem build promoted-ruby-client.gemspec` to generate `gem`.
         | 
| 7 | 
            -
            5. Run (using new output) `gem push promoted-ruby-client-0.1. | 
| 7 | 
            +
            5. Run (using new output) `gem push promoted-ruby-client-0.1.24.gem`
         | 
| 8 8 | 
             
            6. Update README with new version.
         | 
| @@ -100,17 +100,12 @@ module Promoted | |
| 100 100 | 
             
                      filled_in_copy
         | 
| 101 101 | 
             
                    end
         | 
| 102 102 |  | 
| 103 | 
            -
                    def log_request_params( | 
| 103 | 
            +
                    def log_request_params(include_delivery_log:, exec_server:)
         | 
| 104 104 | 
             
                      params = {
         | 
| 105 105 | 
             
                        user_info: user_info,
         | 
| 106 106 | 
             
                        timing: timing,
         | 
| 107 107 | 
             
                        client_info: merge_client_info_defaults,
         | 
| 108 108 | 
             
                        device: @device,
         | 
| 109 | 
            -
                        delivery_log: [{
         | 
| 110 | 
            -
                          execution: {
         | 
| 111 | 
            -
                            execution_server: Promoted::Ruby::Client::EXECUTION_SERVER['SDK']
         | 
| 112 | 
            -
                          }
         | 
| 113 | 
            -
                        }]
         | 
| 114 109 | 
             
                      }
         | 
| 115 110 |  | 
| 116 111 | 
             
                      if @experiment
         | 
| @@ -118,17 +113,19 @@ module Promoted | |
| 118 113 | 
             
                      end
         | 
| 119 114 |  | 
| 120 115 | 
             
                      # Log request allows for multiple requests but here we only send one.
         | 
| 121 | 
            -
                      if  | 
| 116 | 
            +
                      if include_delivery_log
         | 
| 122 117 | 
             
                        request[:request_id] = request[:request_id] || @id_generator.newID
         | 
| 123 | 
            -
                        # Set request on delivery log.
         | 
| 124 | 
            -
                        params[:delivery_log][0][:request] = request
         | 
| 125 | 
            -
                      end
         | 
| 126 118 |  | 
| 127 | 
            -
             | 
| 128 | 
            -
             | 
| 129 | 
            -
             | 
| 130 | 
            -
                           | 
| 131 | 
            -
             | 
| 119 | 
            +
                        params[:delivery_log] = [{
         | 
| 120 | 
            +
                          execution: {
         | 
| 121 | 
            +
                            execution_server: exec_server
         | 
| 122 | 
            +
                          },
         | 
| 123 | 
            +
                          request: request,
         | 
| 124 | 
            +
                          response: {
         | 
| 125 | 
            +
                            insertion: insertions_with_compact_metrics_properties
         | 
| 126 | 
            +
                          }
         | 
| 127 | 
            +
                        }]
         | 
| 128 | 
            +
             | 
| 132 129 | 
             
                        add_missing_ids_on_insertions! request, params[:delivery_log][0][:response][:insertion]
         | 
| 133 130 | 
             
                      end
         | 
| 134 131 |  | 
| @@ -170,7 +167,7 @@ module Promoted | |
| 170 167 | 
             
                    end
         | 
| 171 168 |  | 
| 172 169 | 
             
                    # TODO: This looks overly complicated.
         | 
| 173 | 
            -
                    def  | 
| 170 | 
            +
                    def insertions_with_compact_metrics_properties
         | 
| 174 171 | 
             
                      @insertion            = [] # insertion should be set according to the compact insertion
         | 
| 175 172 | 
             
                      paging                = request[:paging] || {}
         | 
| 176 173 | 
             
                      size                  = paging[:size] ? paging[:size].to_i : 0
         | 
    
        data/lib/promoted/ruby/client.rb
    CHANGED
    
    | @@ -194,6 +194,8 @@ module Promoted | |
| 194 194 | 
             
                      end
         | 
| 195 195 |  | 
| 196 196 | 
             
                      log_req = nil
         | 
| 197 | 
            +
                      exec_server = (insertions_from_delivery ? Promoted::Ruby::Client::EXECUTION_SERVER['API'] : Promoted::Ruby::Client::EXECUTION_SERVER['SDK'])
         | 
| 198 | 
            +
                      
         | 
| 197 199 | 
             
                      # We only return a log request if there's a request or cohort to log.
         | 
| 198 200 | 
             
                      if request_to_log || cohort_membership_to_log
         | 
| 199 201 | 
             
                        log_request_builder = RequestBuilder.new
         | 
| @@ -212,14 +214,14 @@ module Promoted | |
| 212 214 | 
             
                        # On a successful delivery request, we don't log the insertions
         | 
| 213 215 | 
             
                        # or the request since they are logged on the server-side.
         | 
| 214 216 | 
             
                        log_req = log_request_builder.log_request_params(
         | 
| 215 | 
            -
                           | 
| 216 | 
            -
                           | 
| 217 | 
            +
                          include_delivery_log: !insertions_from_delivery, 
         | 
| 218 | 
            +
                          exec_server: exec_server)
         | 
| 217 219 | 
             
                      end
         | 
| 218 220 |  | 
| 219 221 | 
             
                      client_response = {
         | 
| 220 222 | 
             
                        insertion: response_insertions,
         | 
| 221 223 | 
             
                        log_request: log_req,
         | 
| 222 | 
            -
                        execution_server:  | 
| 224 | 
            +
                        execution_server: exec_server,
         | 
| 223 225 | 
             
                        client_request_id: delivery_request_builder.client_request_id
         | 
| 224 226 | 
             
                      }
         | 
| 225 227 | 
             
                      return client_response
         | 
| @@ -258,7 +260,9 @@ module Promoted | |
| 258 260 | 
             
                        deliver_shadow_traffic args, headers
         | 
| 259 261 | 
             
                      end
         | 
| 260 262 |  | 
| 261 | 
            -
                      log_request_builder.log_request_params
         | 
| 263 | 
            +
                      log_request_builder.log_request_params(
         | 
| 264 | 
            +
                        include_delivery_log: true, 
         | 
| 265 | 
            +
                        exec_server: Promoted::Ruby::Client::EXECUTION_SERVER['SDK'])
         | 
| 262 266 | 
             
                    end
         | 
| 263 267 |  | 
| 264 268 | 
             
                    ##
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: promoted-ruby-client
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.1. | 
| 4 | 
            +
              version: 0.1.24
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - scottmcmaster
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2021-10- | 
| 11 | 
            +
            date: 2021-10-22 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: faraday
         |