notion_ruby_mapping 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d5001d647004eef3101bd45070294fc461cb257e20a6f2eaf61cbc271491b9cd
4
- data.tar.gz: da78628f7e1ab2c11e176cfa1ec14fa0f5fb1dcdbfdbf37d73ff960bba6b85ab
3
+ metadata.gz: 6b33d27349a0f3c21fd44074b802ffad42aa18706798b242417300f52fba74a8
4
+ data.tar.gz: 5b09661f6de503b7c706fc98de0dc283bdc5864d237f08e79004c18191cc57f5
5
5
  SHA512:
6
- metadata.gz: 3e9ae34abd9f5f59f4920bec6f007ae897d291391a2e8c1148af6d53e206a00cfdb035118e3dae0525bdac3b7140c8b9818312e947b857ff6750a9cad749721c
7
- data.tar.gz: 43b808260694cfa5dd542901e839794309e20a39926aee9328a3976e605affec47170984a79e04bd4965c7d27c671205135ed767c2f956cbc5ff387d6218cd3f
6
+ metadata.gz: 894920b70a06e10c88996310c8e6b0c26c4e027f2f1038bd2edf612a5835af87abaf74d24c6dedf66766ad37a60b63f85a07c114c634ad0af3bdc9c446d067ae
7
+ data.tar.gz: db29bd093a59da26a90433e5a97f1a414b8d651c4238344859ef5f63aa6e74787ce0c87e33852cdbeea35d30f46df0d16ba7a493858181889ce0291e81fe43ce
data/README.md CHANGED
@@ -127,6 +127,8 @@ 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
131
+ - 2023/7/10 [v0.8.1] Automatically change type to external when file object is updated
130
132
  - 2023/6/4 [v0.8.0] add unique_id properties, filter_properties
131
133
  - 2023/4/14 [v0.7.7] add token= method for Notion API book typo
132
134
  - 2023/4/1 [v0.7.6] bug fix Ignore last ? option for page_id
@@ -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
@@ -39,9 +39,9 @@ module NotionRubyMapping
39
39
  # @param [String] url
40
40
  # @see https://www.notion.so/hkob/FileObject-6218c354e985423a90904f47a985be33#6b841f75d0234a1aac93fb54348abb96
41
41
  def url=(url)
42
- raise StandardError "internal file url can't change." if @type == "file"
43
-
44
42
  @url = url
43
+ @type = "external"
44
+ @expiry_time = nil
45
45
  @will_update = true
46
46
  end
47
47
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NotionRubyMapping
4
- VERSION = "0.8.0"
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.0
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-06-04 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