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.
-
#application ⇒ String
The current value of application.
-
#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.
-
#quantities ⇒ Array<Attune::Model::int>
The current value of quantities.
-
#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.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/attune/models/ranking_params.rb', line 46 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["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"] # Workaround since JSON.parse has accessors as strings rather than symbols @entity_type = attributes["entityType"] || attributes[:"entity_type"] value = attributes["ids"] || attributes[:"ids"] if value.is_a?(Array) @ids = value end # Workaround since JSON.parse has accessors as strings rather than symbols @customer = attributes["customer"] || attributes[:"customer"] value = attributes["quantities"] || attributes[:"quantities"] if value.is_a?(Array) @quantities = value end # Workaround since JSON.parse has accessors as strings rather than symbols @application = attributes["application"] || attributes[:"application"] # Workaround since JSON.parse has accessors as strings rather than symbols @view = attributes["view"] || attributes[:"view"] end |
Instance Attribute Details
#anonymous ⇒ String
Returns the current value of anonymous.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def anonymous @anonymous end |
#application ⇒ String
Returns the current value of application.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def application @application end |
#customer ⇒ String
Returns the current value of customer.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def customer @customer end |
#entity_type ⇒ String
Returns the current value of entity_type.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def entity_type @entity_type end |
#ids ⇒ Array<String>
Returns the current value of ids.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def ids @ids end |
#ip ⇒ String
Returns the current value of ip.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def ip @ip end |
#quantities ⇒ Array<Attune::Model::int>
Returns the current value of quantities.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def quantities @quantities end |
#scope ⇒ Array<Attune::Model::ScopeEntry>
Returns the current value of scope.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def scope @scope end |
#user_agent ⇒ String
Returns the current value of user_agent.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def user_agent @user_agent end |
#view ⇒ String
Returns the current value of view.
15 16 17 |
# File 'lib/attune/models/ranking_params.rb', line 15 def view @view end |
Instance Method Details
#to_body ⇒ Object
81 82 83 84 85 86 |
# File 'lib/attune/models/ranking_params.rb', line 81 def to_body Hash[ATTRIBUTE_MAP.map do |internal, external| next unless value = send(internal) [external, value] end.compact] end |
#to_json(options = {}) ⇒ Object
88 89 90 |
# File 'lib/attune/models/ranking_params.rb', line 88 def to_json( = {}) to_body.to_json end |