lib/promoted/ruby/client/request_builder.rb
def fill_details_from_response response_insertions
          if !response_insertions then
            response_insertions = []
          end

          props = @full_insertion.each_with_object({}) do |insertion, hash|
            if insertion.has_key?(:properties)
              # Don't add nil properties to response insertions.
              hash[insertion[:content_id]] = insertion[:properties]
            end
          end

          filled_in_copy = []
          response_insertions.each do |resp_insertion|
            copied_insertion = resp_insertion.clone
            if copied_insertion.has_key?(:content_id) && props.has_key?(copied_insertion[:content_id])
              copied_insertion[:properties] = props[resp_insertion[:content_id]]
            end
            filled_in_copy << copied_insertion
          end

          filled_in_copy
        end
# Only used in delivery
# Maps the response insertions to the full insertions and re-insert the properties bag
# to the responses.
Only used in delivery
Maps the response insertions to the full insertions and re-insert the properties bag
to the responses.
Only used in delivery Maps the response insertions to the full insertions and re - insert the properties bag to the responses .
def fill_details_from_response response_insertions
          if !response_insertions then
            response_insertions = []
          end
          props = @full_insertion.each_with_object({}) do |insertion, hash|
            if insertion.has_key?(:properties)
              hash[insertion[:content_id]] = insertion[:properties]
            end
          end
          filled_in_copy = []
          response_insertions.each do |resp_insertion|
            copied_insertion = resp_insertion.clone
            if copied_insertion.has_key?(:content_id) && props.has_key?(copied_insertion[:content_id])
              copied_insertion[:properties] = props[resp_insertion[:content_id]]
            end
            filled_in_copy << copied_insertion
          end
          filled_in_copy
        end
def fill_details_from_response response_insertions if ! response_insertions then response_insertions = [ ] end props = @full_insertion . each_with_object ( { } ) do | insertion , hash | if insertion . has_key? ( :properties ) hash [ insertion [ :content_id ] ] = insertion [ :properties ] end end filled_in_copy = [ ] response_insertions . each do | resp_insertion | copied_insertion = resp_insertion . clone if copied_insertion . has_key? ( :content_id ) && props . has_key? ( copied_insertion [ :content_id ] ) copied_insertion [ :properties ] = props [ resp_insertion [ :content_id ] ] end filled_in_copy << copied_insertion end filled_in_copy end
Only used in delivery
Maps the response insertions to the full insertions and re-insert the properties bag
to the responses.
Only used in delivery Maps the response insertions to the full insertions and re - insert the properties bag to the responses .
# Don't add nil properties to response insertions.
response_insertions