Class: NotionRb::RequestParams
- Inherits:
-
Object
- Object
- NotionRb::RequestParams
- Defined in:
- lib/notion_rb/request_params.rb
Instance Attribute Summary collapse
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#transactions ⇒ Object
readonly
Returns the value of attribute transactions.
Instance Method Summary collapse
- #add_transaction ⇒ Object
-
#initialize ⇒ RequestParams
constructor
A new instance of RequestParams.
- #to_h ⇒ Object
Constructor Details
#initialize ⇒ RequestParams
Returns a new instance of RequestParams.
7 8 9 10 |
# File 'lib/notion_rb/request_params.rb', line 7 def initialize @request_id = SecureRandom.uuid @transactions = [] end |
Instance Attribute Details
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
5 6 7 |
# File 'lib/notion_rb/request_params.rb', line 5 def request_id @request_id end |
#transactions ⇒ Object (readonly)
Returns the value of attribute transactions.
5 6 7 |
# File 'lib/notion_rb/request_params.rb', line 5 def transactions @transactions end |
Instance Method Details
#add_transaction ⇒ Object
12 13 14 |
# File 'lib/notion_rb/request_params.rb', line 12 def add_transaction Transaction.new.tap { |t| @transactions.push(t) } end |
#to_h ⇒ Object
16 17 18 19 20 21 |
# File 'lib/notion_rb/request_params.rb', line 16 def to_h { requestId: request_id, transactions: transactions.map(&:to_h) } end |