Class: Rerout::CreateTagInput
- Inherits:
-
Object
- Object
- Rerout::CreateTagInput
- Defined in:
- lib/rerout/create_tag_input.rb
Overview
Request body for ‘POST /v1/projects/me/tags`. `name` is required; `color` is optional and omitted from the payload when not set (the server validates it against its palette and defaults to `“teal”`).
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name:, color: nil) ⇒ CreateTagInput
constructor
A new instance of CreateTagInput.
-
#to_h ⇒ Object
Serialize for the wire.
Constructor Details
#initialize(name:, color: nil) ⇒ CreateTagInput
Returns a new instance of CreateTagInput.
12 13 14 15 16 17 18 |
# File 'lib/rerout/create_tag_input.rb', line 12 def initialize(name:, color: nil) raise ArgumentError, 'name is required' if name.nil? || name.to_s.empty? @name = name @color = color freeze end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
8 9 10 |
# File 'lib/rerout/create_tag_input.rb', line 8 def color @color end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/rerout/create_tag_input.rb', line 8 def name @name end |
Instance Method Details
#to_h ⇒ Object
Serialize for the wire. ‘color` is only included when set.
21 22 23 24 25 |
# File 'lib/rerout/create_tag_input.rb', line 21 def to_h hash = { 'name' => name } hash['color'] = color unless color.nil? hash end |