notion 1.1.1 → 1.1.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: 761cf6b775c714eb4b8eb65710baf3407eaa6061d717b18e59510a048c0edf7f
4
- data.tar.gz: 7f3ba657e798d7e9a24b0aa77ee098462fdb164f958309fdc12ca39d54b78231
3
+ metadata.gz: 3114ccf59f80a17322c559fce61050e7e7f1908a279e8786c4a8fe87e6fa79d8
4
+ data.tar.gz: a7c6fea5eb18a4d962117a4a5120bc357e0bf038640ba39db821d5bc3de230e6
5
5
  SHA512:
6
- metadata.gz: 281bc33e957a074c02bf2866e526aa866d2f75945f7c9dbf9ec0a41a5ac7b5795fe2cedf429e8b2e6220b16550d2bf8c9c7107832672bf4915124fb8c9dae167
7
- data.tar.gz: f02fde242ad8ebfeef9edc3c1850270a8d1459a93b1fafd83ec88eae323ca4dba0ae07bacfc9ef38e053012e81c71b2690c7fe6b68d88e31ca7898e3a4592df7
6
+ metadata.gz: '06202342711853b35c0d694b4de7c89aec269f226d5ceda2c6b4e086f61f6e8f3e7381ca1d0389d85c2b3814d849dd980d9d6b3492a9d2a3d9c8bf9fbad71939'
7
+ data.tar.gz: 7561a58fff0a26b4190a79c713a4f89c3f85c1c5cca4bca21e2c9013ea3fa981f32e8779e9b771b243fe41a65c5b717f9a09e675e9c9590c3a09cf1f344ca02b
@@ -93,7 +93,7 @@ module NotionAPI
93
93
  properties[col_map[col.to_s]] = [[data[col]]]
94
94
  end
95
95
 
96
- collection_data["block"][collection_row.id] = {"role"=>"editor", "value"=>{"id"=> collection_row.id, "version"=>12, "type"=>"page", "properties"=> properties, "created_time"=>1607253360000, "last_edited_time"=>1607253360000, "parent_id"=>"dde513c6-2428-4a5d-a830-7a67fdbf6b48", "parent_table"=>"collection", "alive"=>true, "created_by_table"=>"notion_user", "created_by_id"=>"0c5f02f3-495d-4b73-b1c5-9f6fe03a8c26", "last_edited_by_table"=>"notion_user", "last_edited_by_id"=>"0c5f02f3-495d-4b73-b1c5-9f6fe03a8c26", "shard_id"=>955090, "space_id"=>"f687f7de-7f4c-4a86-b109-941a8dae92d2"}}
96
+ collection_data["block"][collection_row.id] = { "role" => "editor", "value" => { "id" => collection_row.id, "version" => 12, "type" => "page", "properties" => properties, "created_time" => 1607253360000, "last_edited_time" => 1607253360000, "parent_id" => "dde513c6-2428-4a5d-a830-7a67fdbf6b48", "parent_table" => "collection", "alive" => true, "created_by_table" => "notion_user", "created_by_id" => "0c5f02f3-495d-4b73-b1c5-9f6fe03a8c26", "last_edited_by_table" => "notion_user", "last_edited_by_id" => "0c5f02f3-495d-4b73-b1c5-9f6fe03a8c26", "shard_id" => 955090, "space_id" => "f687f7de-7f4c-4a86-b109-941a8dae92d2" } }
97
97
  row_data = collection_data["block"][collection_row.id]
98
98
  create_singleton_methods_and_instance_variables(collection_row, row_data)
99
99
 
@@ -242,7 +242,7 @@ module NotionAPI
242
242
  column_hash.keys.each_with_index do |column, i|
243
243
  # loop over the column names...
244
244
  # set instance variables for each column, allowing the dev to 'read' the column value
245
- cleaned_column = column_hash[column].split(" ").join("_").downcase.to_sym
245
+ cleaned_column = clean_property_names(column_hash, column)
246
246
 
247
247
  # p row_data["value"]["properties"][column_mappings[i]], !(row_data["value"]["properties"][column] or row_data["value"]["properties"][column_mappings[i]])
248
248
  if row_data["value"]["properties"].nil? or row_data["value"]["properties"][column].nil?
@@ -262,9 +262,7 @@ module NotionAPI
262
262
  parsed_method = __method__.to_s[0...-1].split("_").join(" ")
263
263
  cookies = Core.options["cookies"]
264
264
  headers = Core.options["headers"]
265
-
266
- p new_value, column_hash.key(parsed_method), column_names, schema
267
-
265
+
268
266
  request_id = extract_id(SecureRandom.hex(16))
269
267
  transaction_id = extract_id(SecureRandom.hex(16))
270
268
  space_id = extract_id(SecureRandom.hex(16))
@@ -282,7 +280,6 @@ module NotionAPI
282
280
  ]
283
281
 
284
282
  if %q[select multi_select].include?(schema[column_hash.key(parsed_method)]["type"])
285
- p "ENTERED THE ABYSS"
286
283
  options = schema[column_hash.key(parsed_method)]["options"].nil? ? [] : schema[column_hash.key(parsed_method)]["options"].map { |option| option["value"] }
287
284
  multi_select_multi_options = new_value.split(",")
288
285
  multi_select_multi_options.each do |option|
@@ -310,6 +307,15 @@ module NotionAPI
310
307
  end
311
308
  end
312
309
  end
310
+
311
+ def clean_property_names(prop_hash, prop_notion_name)
312
+ # ! standardize property names by splitting the words in the property name into an array, removing non-alphanumeric
313
+ # ! characters, downcasing, and then re-joining the array with underscores.
314
+ # ! prop_hash -> hash of property notion names and property textual names: ``str``
315
+ # ! prop_notion_name -> the four-character long name of the notion property: ``str``
316
+
317
+ prop_hash[prop_notion_name].split(" ").map { |word| word.gsub(/[^a-z0-9]/i, "").downcase }.join("_").to_sym
318
+ end
313
319
  end
314
320
 
315
321
  # class that represents each row in a CollectionView
@@ -1,3 +1,3 @@
1
1
  module NotionAPI
2
- VERSION = '1.1.1'
2
+ VERSION = '1.1.2'
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.1.1
4
+ version: 1.1.2
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-12-08 00:00:00.000000000 Z
11
+ date: 2020-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty