Class: SirenClient::Field
- Inherits:
-
Object
- Object
- SirenClient::Field
- Defined in:
- lib/siren_client/field.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(data) ⇒ Field
constructor
A new instance of Field.
Constructor Details
#initialize(data) ⇒ Field
Returns a new instance of Field.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/siren_client/field.rb', line 5 def initialize(data) if data.class != Hash raise ArgumentError, "You must pass in a Hash to SirenClient::Action.new" end @payload = data @name = @payload['name'] || '' @type = @payload['type'] || 'text' @value = @payload['value'] || '' @title = @payload['title'] || '' end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/siren_client/field.rb', line 3 def name @name end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
3 4 5 |
# File 'lib/siren_client/field.rb', line 3 def payload @payload end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/siren_client/field.rb', line 3 def title @title end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/siren_client/field.rb', line 3 def type @type end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
3 4 5 |
# File 'lib/siren_client/field.rb', line 3 def value @value end |