class NotionRb::Transaction
Attributes
id[R]
operations[R]
Public Class Methods
new()
click to toggle source
# File lib/notion_rb/transaction.rb, line 7 def initialize @id = SecureRandom.uuid @operations = [] end
Public Instance Methods
add_operation(operation_name, *args)
click to toggle source
# File lib/notion_rb/transaction.rb, line 12 def add_operation(operation_name, *args) operations.push( Operations::Factory.build(operation_name, *args) ) self end
to_h()
click to toggle source
# File lib/notion_rb/transaction.rb, line 19 def to_h { id: id, operations: operations.flat_map { |o| o.commands.map(&:to_h) } } end