Class: Attune::Model::RankingParams

Inherits:
Object
  • Object
show all
Defined in:
lib/attune/models/ranking_params.rb

Overview

Inputs for ranking a set of ids for a particular user.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#anonymousString

Returns the current value of anonymous.

Returns:

  • (String)

    the current value of anonymous



13
14
15
# File 'lib/attune/models/ranking_params.rb', line 13

def anonymous
  @anonymous
end

#customerString

Returns the current value of customer.

Returns:

  • (String)

    the current value of customer



13
14
15
# File 'lib/attune/models/ranking_params.rb', line 13

def customer
  @customer
end

#entity_typeString

Returns the current value of entity_type.

Returns:

  • (String)

    the current value of entity_type



13
14
15
# File 'lib/attune/models/ranking_params.rb', line 13

def entity_type
  @entity_type
end

#idsArray<String>

Returns the current value of ids.

Returns:

  • (Array<String>)

    the current value of ids



13
14
15
# File 'lib/attune/models/ranking_params.rb', line 13

def ids
  @ids
end

#ipString

Returns the current value of ip.

Returns:

  • (String)

    the current value of ip



13
14
15
# File 'lib/attune/models/ranking_params.rb', line 13

def ip
  @ip
end

#scopeArray<Attune::Model::ScopeEntry>

Returns the current value of scope.

Returns:



13
14
15
# File 'lib/attune/models/ranking_params.rb', line 13

def scope
  @scope
end

#user_agentString

Returns the current value of user_agent.

Returns:

  • (String)

    the current value of user_agent



13
14
15
# File 'lib/attune/models/ranking_params.rb', line 13

def user_agent
  @user_agent
end

#viewString

Returns the current value of view.

Returns:

  • (String)

    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_bodyObject



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(options = {})
  to_body.to_json
end