Class: NotionRubyMapping::DiscussionThread
- Inherits:
-
Object
- Object
- NotionRubyMapping::DiscussionThread
- Defined in:
- lib/notion_ruby_mapping/controllers/discussion_thread.rb
Overview
DiscussionThread
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#discussion_id ⇒ Object
readonly
Returns the value of attribute discussion_id.
Instance Method Summary collapse
- #append_comment(text_objects, dry_run: false) ⇒ String, NotionRubyMapping::CommentObject
-
#initialize(discussion_id) ⇒ DiscussionThread
constructor
A new instance of DiscussionThread.
Constructor Details
#initialize(discussion_id) ⇒ DiscussionThread
Returns a new instance of DiscussionThread.
7 8 9 10 |
# File 'lib/notion_ruby_mapping/controllers/discussion_thread.rb', line 7 def initialize(discussion_id) @discussion_id = discussion_id @comments = [] end |
Instance Attribute Details
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
11 12 13 |
# File 'lib/notion_ruby_mapping/controllers/discussion_thread.rb', line 11 def comments @comments end |
#discussion_id ⇒ Object (readonly)
Returns the value of attribute discussion_id.
11 12 13 |
# File 'lib/notion_ruby_mapping/controllers/discussion_thread.rb', line 11 def discussion_id @discussion_id end |
Instance Method Details
#append_comment(text_objects, dry_run: false) ⇒ String, NotionRubyMapping::CommentObject
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/notion_ruby_mapping/controllers/discussion_thread.rb', line 16 def append_comment(text_objects, dry_run: false) rto = RichTextArray.new "rich_text", text_objects: text_objects, will_update: true nc = NotionCache.instance json = rto.property_schema_json.merge({discussion_id: @discussion_id}) if dry_run Base.dry_run_script :post, nc.comments_path, json else CommentObject.new json: (nc.append_comment_request json) end end |