Class: Rerout::UpdateTagInput

Inherits:
Object
  • Object
show all
Defined in:
lib/rerout/update_tag_input.rb

Overview

Request body for ‘PATCH /v1/projects/me/tags/:tag_id`. Both fields are optional; an omitted field is left unchanged. Unlike UpdateLinkInput, there is no client-side empty-payload check — mirroring the reference SDKs, the server returns `400` for a fully empty patch. Neither field is nullable, so there is no `Rerout::CLEAR` handling here.

Examples:

Rerout::UpdateTagInput.new(name: 'Renamed')
Rerout::UpdateTagInput.new(color: 'red')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: OMIT, color: OMIT) ⇒ UpdateTagInput

Returns a new instance of UpdateTagInput.

Parameters:

  • name (String, nil) (defaults to: OMIT)

    new label. Omitted when not set.

  • color (String, nil) (defaults to: OMIT)

    new color. Omitted when not set.



18
19
20
21
22
# File 'lib/rerout/update_tag_input.rb', line 18

def initialize(name: OMIT, color: OMIT)
  @name = name
  @color = color
  freeze
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



14
15
16
# File 'lib/rerout/update_tag_input.rb', line 14

def color
  @color
end

#nameObject (readonly)

Returns the value of attribute name.



14
15
16
# File 'lib/rerout/update_tag_input.rb', line 14

def name
  @name
end

Instance Method Details

#empty?Boolean

Returns true when no field was set.

Returns:

  • (Boolean)

    true when no field was set.



33
34
35
# File 'lib/rerout/update_tag_input.rb', line 33

def empty?
  to_h.empty?
end

#to_hObject

Serialize for the wire. Only fields that were set are included.



25
26
27
28
29
30
# File 'lib/rerout/update_tag_input.rb', line 25

def to_h
  hash = {}
  hash['name'] = name unless name.equal?(OMIT)
  hash['color'] = color unless color.equal?(OMIT)
  hash
end