class Attune::Model::RankedEntities
List of ids in ranked order. If an error occurs, returns message and status code.
@attr [String] message Error message if ranking failed @attr [String] cell Cell assignment @attr [Array<String>] ranking List of ids in ranked order @attr [Integer] status HTTP status code if ranking failed
Constants
- ATTRIBUTE_MAP
:internal => :external
Attributes
cell[RW]
message[RW]
ranking[RW]
status[RW]
Public Class Methods
new(attributes = {})
click to toggle source
# File lib/attune/models/ranked_entities.rb, line 22 def initialize(attributes = {}) return if attributes.empty? # Workaround since JSON.parse has accessors as strings rather than symbols @message = attributes["message"] || attributes[:"message"] # Workaround since JSON.parse has accessors as strings rather than symbols @cell = attributes["cell"] || attributes[:"cell"] value = attributes["ranking"] || attributes[:"ranking"] if value.is_a?(Array) @ranking = value end # Workaround since JSON.parse has accessors as strings rather than symbols @status = attributes["status"] || attributes[:"status"] end
Public Instance Methods
to_body()
click to toggle source
# File lib/attune/models/ranked_entities.rb, line 39 def to_body Hash[ATTRIBUTE_MAP.map do |internal, external| next unless value = send(internal) [external, value] end.compact] end
to_json(options = {})
click to toggle source
# File lib/attune/models/ranked_entities.rb, line 46 def to_json(options = {}) to_body.to_json end