Class: NotionRb::Operations::SetBlockTitle

Inherits:
Object
  • Object
show all
Defined in:
lib/notion_rb/operations/set_block_title.rb

Constant Summary collapse

COMMAND_TYPE =
:set
OPERATION_NAME =
:set_block_title
TABLE =
'block'
DEFAULT_PATH =
%w[properties title].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, title = nil, opts = {}) ⇒ SetBlockTitle

Returns a new instance of SetBlockTitle.



13
14
15
16
17
# File 'lib/notion_rb/operations/set_block_title.rb', line 13

def initialize(id, title = nil, opts = {})
  @id = id
  @title = title
  @path = opts.fetch(:path, DEFAULT_PATH)
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



11
12
13
# File 'lib/notion_rb/operations/set_block_title.rb', line 11

def id
  @id
end

#pathObject (readonly)

Returns the value of attribute path.



11
12
13
# File 'lib/notion_rb/operations/set_block_title.rb', line 11

def path
  @path
end

#titleObject (readonly)

Returns the value of attribute title.



11
12
13
# File 'lib/notion_rb/operations/set_block_title.rb', line 11

def title
  @title
end

Instance Method Details

#argsObject



31
32
33
# File 'lib/notion_rb/operations/set_block_title.rb', line 31

def args
  return [] if title.nil?
end

#commandsObject



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/notion_rb/operations/set_block_title.rb', line 19

def commands
  [
    Commands::Factory.build(
      COMMAND_TYPE,
      id,
      args: args,
      table: TABLE,
      path: path
    )
  ]
end