Class: Attune::Model::BatchRankingRequest
- Inherits:
-
Object
- Object
- Attune::Model::BatchRankingRequest
- Defined in:
- lib/attune/models/batch_ranking_request.rb
Overview
Array of the parameters specified for a ranking request
Instance Attribute Summary collapse
-
#requests ⇒ Array<Attune::Model::RankingParams>
The current value of requests.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ BatchRankingRequest
constructor
A new instance of BatchRankingRequest.
- #to_body ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ BatchRankingRequest
Returns a new instance of BatchRankingRequest.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/attune/models/batch_ranking_request.rb', line 10 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 |
Instance Attribute Details
#requests ⇒ Array<Attune::Model::RankingParams>
Returns the current value of requests.
6 7 8 |
# File 'lib/attune/models/batch_ranking_request.rb', line 6 def requests @requests end |
Instance Method Details
#to_body ⇒ Object
21 22 23 24 25 26 |
# File 'lib/attune/models/batch_ranking_request.rb', line 21 def to_body Hash[ATTRIBUTE_MAP.map do |internal, external| next unless value = send(internal) [external, value] end.compact] end |
#to_json(options = {}) ⇒ Object
28 29 30 |
# File 'lib/attune/models/batch_ranking_request.rb', line 28 def to_json( = {}) to_body.to_json end |