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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58ac8026dc81c27d34f42b51e388bd036b03d2338ef9113b43bcaee0bd57f6a2
4
- data.tar.gz: 914d54deb74e73057b6d52f0c7a8227903b501250243f4d61d81c2196e42bc0f
3
+ metadata.gz: 3b63efe4325f07f105d8c2efb29e5037737651d330723a745d78bdc66bc02e32
4
+ data.tar.gz: 7e32f2d257d3d58ee3b29f6cbfdc3f901c88985a20e6980927265932afdb6e02
5
5
  SHA512:
6
- metadata.gz: bdb71d3859daaf1ded2f418cc348a9d3c3fb65cf446efd94df49dc28330355571b078415f8a48f53a31328c7f672f6e0b26f02176e8ec9702810e144c5341535
7
- data.tar.gz: 035343a8e4fe1326b7e735d4a019db969d1c3d356faaf80f56fc861d60e9cdb3ee419fc9c776abaf7ffeaab0572a69dfec19fe42ab6362e600dd014f105c593e
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 - Table
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")
@@ -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 block_type != 'page'
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
- PageBlock.new(block_id, block_title, block_parent_id)
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
@@ -1,3 +1,3 @@
1
1
  module NotionAPI
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
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.3
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-29 00:00:00.000000000 Z
11
+ date: 2020-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty