notion_ruby_mapping 0.8.1 → 0.8.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d5ecb543438b351d894b9f20d2b9ea0f10ebdacf3dd3b01c20bafae1d07f84d
4
- data.tar.gz: e1463b904bba8cf73e41113754b9aed7492b45500321dd80b4660ba210cdb722
3
+ metadata.gz: 6b33d27349a0f3c21fd44074b802ffad42aa18706798b242417300f52fba74a8
4
+ data.tar.gz: 5b09661f6de503b7c706fc98de0dc283bdc5864d237f08e79004c18191cc57f5
5
5
  SHA512:
6
- metadata.gz: 82a8330b58a7a6edb675a03640f3c8a324fd7e3f58e124f184f4806c80a15c07d9f62fa92adfd31cfd21a7fa5db0ade83cd987baa48950f95076b021259abb2d
7
- data.tar.gz: 86d1738c9a54021b5122435b77e93faff510294330217db44c748ebfaf8e37e3f821bd7fc18a62869200f6054a9b4d3f3b42f184d4f41724ca28eb8002368cf8
6
+ metadata.gz: 894920b70a06e10c88996310c8e6b0c26c4e027f2f1038bd2edf612a5835af87abaf74d24c6dedf66766ad37a60b63f85a07c114c634ad0af3bdc9c446d067ae
7
+ data.tar.gz: db29bd093a59da26a90433e5a97f1a414b8d651c4238344859ef5f63aa6e74787ce0c87e33852cdbeea35d30f46df0d16ba7a493858181889ce0291e81fe43ce
data/README.md CHANGED
@@ -127,6 +127,7 @@ NotionRubyMapping.configuration { |c| c.notion_token = ENV["NOTION_API_TOKEN"] }
127
127
 
128
128
  ## 3. ChangeLog
129
129
 
130
+ - 2023/7/13 [v0.8.2] add 'after' option to append_block_chidren, 'append_after' method to block, and 'public_url' method to page
130
131
  - 2023/7/10 [v0.8.1] Automatically change type to external when file object is updated
131
132
  - 2023/6/4 [v0.8.0] add unique_id properties, filter_properties
132
133
  - 2023/4/14 [v0.7.7] add token= method for Notion API book typo
@@ -118,11 +118,12 @@ module NotionRubyMapping
118
118
  end
119
119
 
120
120
  # @param [Array<Block>] blocks
121
+ # @param [String, nil] after block id of previous block
121
122
  # @param [Boolean] dry_run true if dry_run
122
123
  # @return [NotionRubyMapping::Block, String]
123
124
  # @see https://www.notion.so/hkob/Page-d359650e3ca94424af8359a24147b9a0#44bbf83d852c419485c5efe9fe1558fb
124
125
  # @see https://www.notion.so/hkob/Block-689ad4cbff50404d8a1baf67b6d6d78d#2c47f7fedae543cf8566389ba1677132
125
- def append_block_children(*blocks, dry_run: false)
126
+ def append_block_children(*blocks, after: nil, dry_run: false)
126
127
  raise StandardError, "This block can have no children." unless page? || (block? && can_have_children)
127
128
 
128
129
  only_one = blocks.length == 1
@@ -132,6 +133,7 @@ module NotionRubyMapping
132
133
  block.block_json
133
134
  end,
134
135
  }
136
+ json["after"] = after if after
135
137
  if dry_run
136
138
  path = @nc.append_block_children_page_path(id)
137
139
  self.class.dry_run_script :patch, path, json
@@ -76,6 +76,13 @@ module NotionRubyMapping
76
76
  end
77
77
  end
78
78
 
79
+ # @param [Boolean] dry_run true if dry_run
80
+ # @return [NotionRubyMapping::Block, String]
81
+ # @param [Array<Block>] blocks
82
+ def append_after(*blocks, dry_run: false)
83
+ parent.append_block_children *blocks, after: id, dry_run: dry_run
84
+ end
85
+
79
86
  # @param [Boolean] not_update false when update
80
87
  # @return [Hash{String (frozen)->Hash}]
81
88
  def block_json(not_update: true)
@@ -59,6 +59,11 @@ module NotionRubyMapping
59
59
  db.save dry_run: dry_run
60
60
  end
61
61
 
62
+ # @return [String] 公開URL
63
+ def public_url
64
+ @json["public_url"]
65
+ end
66
+
62
67
  # @return [String] title
63
68
  # @see https://www.notion.so/hkob/Page-d359650e3ca94424af8359a24147b9a0#2ff7209055f346fbbda454cdbb40b1c8
64
69
  def title
@@ -66,6 +71,11 @@ module NotionRubyMapping
66
71
  tp.map(&:full_text).join ""
67
72
  end
68
73
 
74
+ # @return [String] URL
75
+ def url
76
+ @json["url"]
77
+ end
78
+
69
79
  protected
70
80
 
71
81
  # @param [Boolean] dry_run true if dry_run
@@ -93,5 +103,6 @@ module NotionRubyMapping
93
103
  update_json @nc.update_page_request(@id, property_values_json)
94
104
  end
95
105
  end
106
+
96
107
  end
97
108
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NotionRubyMapping
4
- VERSION = "0.8.1"
4
+ VERSION = "0.8.2"
5
5
  NOTION_VERSION = "2022-06-28"
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notion_ruby_mapping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki KOBAYASHI
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-10 00:00:00.000000000 Z
11
+ date: 2023-07-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday