Class: Attune::Model::ScopeEntry

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

Overview

Name/value pairs that provide additional context to the request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ScopeEntry

Returns a new instance of ScopeEntry.



14
15
16
17
18
19
20
21
22
# File 'lib/attune/models/scope_entry.rb', line 14

def initialize(attributes = {})
  return if attributes.empty?
  # Workaround since JSON.parse has accessors as strings rather than symbols
  @name = attributes["name"] || attributes[:"name"]
  # Workaround since JSON.parse has accessors as strings rather than symbols
  @value = attributes["value"] || attributes[:"value"]
  

end

Instance Attribute Details

#nameString

Returns the current value of name.

Returns:

  • (String)

    the current value of name



7
8
9
# File 'lib/attune/models/scope_entry.rb', line 7

def name
  @name
end

#valueString

Returns the current value of value.

Returns:

  • (String)

    the current value of value



7
8
9
# File 'lib/attune/models/scope_entry.rb', line 7

def value
  @value
end

Instance Method Details

#to_bodyObject



24
25
26
27
28
29
# File 'lib/attune/models/scope_entry.rb', line 24

def to_body
  Hash[ATTRIBUTE_MAP.map do |internal, external|
    next unless value = send(internal)
    [external, value]
  end.compact]
end

#to_json(options = {}) ⇒ Object



31
32
33
# File 'lib/attune/models/scope_entry.rb', line 31

def to_json(options = {})
  to_body.to_json
end