Class: NotionRb::Operations::Commands::Base

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

Direct Known Subclasses

ListAfter, Set, Update

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, opts = {}) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
15
16
17
# File 'lib/notion_rb/operations/commands/base.rb', line 9

def initialize(id, opts = {})
  @id = id
  @command = opts.fetch(:command) do
    raise ArgumentError, 'Commands must specify command action key'
  end
  @table = opts[:table]
  @args = opts[:args]
  @path = opts.fetch(:path, [])
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



7
8
9
# File 'lib/notion_rb/operations/commands/base.rb', line 7

def args
  @args
end

#commandObject (readonly)

Returns the value of attribute command.



7
8
9
# File 'lib/notion_rb/operations/commands/base.rb', line 7

def command
  @command
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/notion_rb/operations/commands/base.rb', line 7

def id
  @id
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/notion_rb/operations/commands/base.rb', line 7

def path
  @path
end

#tableObject (readonly)

Returns the value of attribute table.



7
8
9
# File 'lib/notion_rb/operations/commands/base.rb', line 7

def table
  @table
end

Instance Method Details

#to_hObject



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

def to_h
  {
    id: id,
    table: table,
    path: path,
    command: command,
    args: args
  }
end