notion 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/notion_api/core.rb +11 -3
- data/lib/notion_api/notion_types/collection_view_blocks.rb +15 -0
- data/lib/notion_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b63efe4325f07f105d8c2efb29e5037737651d330723a745d78bdc66bc02e32
|
4
|
+
data.tar.gz: 7e32f2d257d3d58ee3b29f6cbfdc3f901c88985a20e6980927265932afdb6e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 970d6921cbe05fc19a5c610c24cd995832adc45c95bb6a1710ad2a22be86a7c6c8ec3078e7d95b6a042cd0e732fc293e70a0cacd97410c1d111ee7c4a3a99880
|
7
|
+
data.tar.gz: 72bc8e752d9f2aad62a9eeb5b91322bb623ee42b21370392285ffaf4ac16c5b8c795584c5dc0682f905a11cdb13b3f9803148ec3f9f784299cb7f004bd95bf30
|
data/README.md
CHANGED
@@ -114,7 +114,7 @@ For example:
|
|
114
114
|
```
|
115
115
|
For example:
|
116
116
|
![move a block](https://github.com/danmurphy1217/notion-ruby/blob/master/gifs/move_before_and_after.gif)
|
117
|
-
### Get a Collection View
|
117
|
+
### Get a Collection View
|
118
118
|
To retrieve a collection, you use the `get_collection` method. This method is designed to work with Table collections, but the codebase is actively being updated to support others:
|
119
119
|
```ruby
|
120
120
|
>>> @page = @client.get_page("https://www.notion.so/danmurphy/TEST-PAGE-d2ce338f19e847f586bd17679f490e66")
|
data/lib/notion_api/core.rb
CHANGED
@@ -42,13 +42,21 @@ module NotionAPI
|
|
42
42
|
end
|
43
43
|
|
44
44
|
block_id = clean_id
|
45
|
-
block_title = extract_title(clean_id, jsonified_record_response)
|
46
45
|
block_type = extract_type(clean_id, jsonified_record_response)
|
47
46
|
block_parent_id = extract_parent_id(clean_id, jsonified_record_response)
|
48
47
|
|
49
|
-
raise 'the URL or ID passed to the get_page method must be that of a Page Block.' if
|
48
|
+
raise 'the URL or ID passed to the get_page method must be that of a Page Block.' if !['collection_view_page', 'page'].include?(block_type)
|
50
49
|
|
51
|
-
|
50
|
+
if block_type == "page"
|
51
|
+
block_title = extract_title(clean_id, jsonified_record_response)
|
52
|
+
PageBlock.new(block_id, block_title, block_parent_id)
|
53
|
+
elsif block_type == "collection_view_page"
|
54
|
+
collection_id = extract_collection_id(block_id, jsonified_record_response)
|
55
|
+
block_title = extract_collection_title(clean_id, collection_id, jsonified_record_response)
|
56
|
+
view_id = extract_view_ids(block_id, jsonified_record_response)[0]
|
57
|
+
|
58
|
+
CollectionViewPage.new(block_id, block_title, block_parent_id, collection_id, view_id)
|
59
|
+
end
|
52
60
|
end
|
53
61
|
|
54
62
|
def children(url_or_id = @id)
|
@@ -225,4 +225,19 @@ module NotionAPI
|
|
225
225
|
@view_id = view_id
|
226
226
|
end
|
227
227
|
end
|
228
|
+
|
229
|
+
class CollectionViewPage < CollectionView
|
230
|
+
@notion_type = 'collection_view_page'
|
231
|
+
@type = 'collection_view_page'
|
232
|
+
|
233
|
+
def type
|
234
|
+
NotionAPI::CollectionViewRow.notion_type
|
235
|
+
end
|
236
|
+
|
237
|
+
class << self
|
238
|
+
attr_reader :notion_type, :type, :parent_id
|
239
|
+
end
|
240
|
+
|
241
|
+
attr_reader :parent_id, :id
|
242
|
+
end
|
228
243
|
end
|
data/lib/notion_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Murphy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-11-
|
11
|
+
date: 2020-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|