Class: Attune::Model::RankingParams
- Inherits:
-
Object
- Object
- Attune::Model::RankingParams
- Defined in:
- lib/attune/models/ranking_params.rb
Overview
Inputs for ranking a set of ids for a particular user.
Instance Attribute Summary collapse
-
#anonymous ⇒ String
The current value of anonymous.
-
#customer ⇒ String
The current value of customer.
-
#entity_type ⇒ String
The current value of entity_type.
-
#ids ⇒ Array<String>
The current value of ids.
-
#ip ⇒ String
The current value of ip.
-
#scope ⇒ Array<Attune::Model::ScopeEntry>
The current value of scope.
-
#user_agent ⇒ String
The current value of user_agent.
-
#view ⇒ String
The current value of view.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ RankingParams
constructor
A new instance of RankingParams.
- #to_body ⇒ Object
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ RankingParams
Returns a new instance of RankingParams.
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/attune/models/ranking_params.rb', line 38 def initialize(attributes = {}) return if attributes.empty? # Workaround since JSON.parse has accessors as strings rather than symbols @user_agent = attributes["userAgent"] || attributes[:"user_agent"] # Workaround since JSON.parse has accessors as strings rather than symbols @ip = attributes["ip"] || attributes[:"ip"] value = attributes["ids"] || attributes[:"ids"] if value.is_a?(Array) @ids = value end # Workaround since JSON.parse has accessors as strings rather than symbols @view = attributes["view"] || attributes[:"view"] # Workaround since JSON.parse has accessors as strings rather than symbols @entity_type = attributes["entityType"] || attributes[:"entity_type"] # Workaround since JSON.parse has accessors as strings rather than symbols @customer = attributes["customer"] || attributes[:"customer"] value = attributes["scope"] || attributes[:"scope"] if value.is_a?(Array) @scope = value.map{ |v| ScopeEntry.new(v) } end # Workaround since JSON.parse has accessors as strings rather than symbols @anonymous = attributes["anonymous"] || attributes[:"anonymous"] end |
Instance Attribute Details
#anonymous ⇒ String
Returns the current value of anonymous.
13 14 15 |
# File 'lib/attune/models/ranking_params.rb', line 13 def anonymous @anonymous end |
#customer ⇒ String
Returns the current value of customer.
13 14 15 |
# File 'lib/attune/models/ranking_params.rb', line 13 def customer @customer end |
#entity_type ⇒ String
Returns the current value of entity_type.
13 14 15 |
# File 'lib/attune/models/ranking_params.rb', line 13 def entity_type @entity_type end |
#ids ⇒ Array<String>
Returns the current value of ids.
13 14 15 |
# File 'lib/attune/models/ranking_params.rb', line 13 def ids @ids end |
#ip ⇒ String
Returns the current value of ip.
13 14 15 |
# File 'lib/attune/models/ranking_params.rb', line 13 def ip @ip end |
#scope ⇒ Array<Attune::Model::ScopeEntry>
Returns the current value of scope.
13 14 15 |
# File 'lib/attune/models/ranking_params.rb', line 13 def scope @scope end |
#user_agent ⇒ String
Returns the current value of user_agent.
13 14 15 |
# File 'lib/attune/models/ranking_params.rb', line 13 def user_agent @user_agent end |
#view ⇒ String
Returns the current value of view.
13 14 15 |
# File 'lib/attune/models/ranking_params.rb', line 13 def view @view end |
Instance Method Details
#to_body ⇒ Object
66 67 68 69 70 71 |
# File 'lib/attune/models/ranking_params.rb', line 66 def to_body Hash[ATTRIBUTE_MAP.map do |internal, external| next unless value = send(internal) [external, value] end.compact] end |
#to_json(options = {}) ⇒ Object
73 74 75 |
# File 'lib/attune/models/ranking_params.rb', line 73 def to_json( = {}) to_body.to_json end |