Sha256: 86f713d9c0bbfbfe0df42a13d0d47f92fbd7499deb642cfa250a2fb47e5eda34

Contents?: true

Size: 893 Bytes

Versions: 15

Compression:

Stored size: 893 Bytes

Contents

module Attune
  module Model
    # Array of ranking results.
    #
    # @attr [Array<Attune::Model::RankedEntities>] results Array of rankings in order of the parameters provided as input.
    class BatchRankingResult
      attr_accessor :results
      

      def initialize(attributes = {})
        return if attributes.empty?
        value = attributes["results"] || attributes[:"results"]
        if value.is_a?(Array)
          @results = value.map{ |v| RankedEntities.new(v) }

        end
        

      end

      def to_body
        Hash[ATTRIBUTE_MAP.map do |internal, external|
          next unless value = send(internal)
          [external, value]
        end.compact]
      end

      def to_json(options = {})
        to_body.to_json
      end

      private
      # :internal => :external
      ATTRIBUTE_MAP = {
          :results => :results

        }
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
attune-1.0.21 lib/attune/models/batch_ranking_result.rb
attune-1.0.20 lib/attune/models/batch_ranking_result.rb
attune-1.0.19 lib/attune/models/batch_ranking_result.rb
attune-1.0.18 lib/attune/models/batch_ranking_result.rb
attune-1.0.17 lib/attune/models/batch_ranking_result.rb
attune-1.0.16 lib/attune/models/batch_ranking_result.rb
attune-1.0.15 lib/attune/models/batch_ranking_result.rb
attune-1.0.14 lib/attune/models/batch_ranking_result.rb
attune-1.0.13 lib/attune/models/batch_ranking_result.rb
attune-1.0.12 lib/attune/models/batch_ranking_result.rb
attune-1.0.11 lib/attune/models/batch_ranking_result.rb
attune-1.0.10 lib/attune/models/batch_ranking_result.rb
attune-1.0.9 lib/attune/models/batch_ranking_result.rb
attune-1.0.8 lib/attune/models/batch_ranking_result.rb
attune-1.0.7 lib/attune/models/batch_ranking_result.rb