Sha256: fb5a470536850252ad72f6436215cd435ad60643568f78be062f9edceac840c4

Contents?: true

Size: 868 Bytes

Versions: 1

Compression:

Stored size: 868 Bytes

Contents

module Attune
  module Model
    # Wrapper for requesting multiple rankings in a single call.
    #
    # @attr [Array<Attune::Model::RankingParams>] requests
    class BatchRankingRequest
      attr_accessor :requests
      

      def initialize(attributes = {})
        return if attributes.empty?
        value = attributes["requests"] || attributes[:"requests"]
        if value.is_a?(Array)
          @requests = value.map{ |v| RankingParams.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 = {
          :requests => :requests

        }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attune-1.0.6 lib/attune/models/batch_ranking_request.rb