Class: Attune::Model::ScopeEntry
- Inherits:
-
Object
- Object
- Attune::Model::ScopeEntry
- Defined in:
- lib/attune/models/scope_entry.rb
Overview
Name/value pairs that provide additional context to the request
Instance Attribute Summary collapse
-
#name ⇒ String
The current value of name.
-
#value ⇒ String
The current value of value.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ ScopeEntry
constructor
A new instance of ScopeEntry.
- #to_body ⇒ Object
- #to_json(options = {}) ⇒ Object
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
#name ⇒ String
Returns the current value of name.
7 8 9 |
# File 'lib/attune/models/scope_entry.rb', line 7 def name @name end |
#value ⇒ String
Returns 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_body ⇒ Object
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( = {}) to_body.to_json end |