notion 1.0.7 → 1.1.0

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: 260bf00a0f7ffc3dec1cbf364c69815e5dcbf829677710e5b740bd58476ca9f7
4
- data.tar.gz: 7220c9399aca9756e4773dda4b5fbdd573bd3decfe32758797ea11e309e6f0e0
3
+ metadata.gz: c99389e680f113f6288c7809f95c3c4b86b894c7c0b741dd774d5738b398b241
4
+ data.tar.gz: 1f995b8c4d27874a248bf99023efe02a96198231e0a7cfb51d139bbae45f6cac
5
5
  SHA512:
6
- metadata.gz: d5933ae50944a7f77e6c68410d4291935b769869b59f71817dabd98df2e5a50f86f6200c4b7bc9800249e274c4e3ecd1e5d339df66cb08e258c50c25308e3bba
7
- data.tar.gz: e01f29a16242b81b586d7852062efe030a760f30620096a691be6ee47c45de3d5f1b1ef7ce0f166a6c3328e3972ca470aaffd51b235f8d9f2f6c8b6ead69c193
6
+ metadata.gz: 65d7e7713162c1ca4e694972715d904b927dada01eb3c679f9470119bb7c35afa801ffc2894cba5485348a6ae1beb4b6df931af3fada0f74317d0ae1bd27d94d
7
+ data.tar.gz: 375a2c1357cd5a56064a86fe650e523ddaee2834d7d0e3039b6a73d17b5157e418a4f2fa298562748e1bee350fcf5221efe1880db8b60970f2462556c4bc8468
@@ -61,7 +61,7 @@ module NotionAPI
61
61
  data.keys.each_with_index do |col_name, j|
62
62
  unless col_map.keys.include?(col_name.to_s); raise ArgumentError, "Column '#{col_name.to_s}' does not exist." end
63
63
  if %q[select multi_select].include?(schema[col_map[col_name.to_s]]["type"])
64
- options = schema[col_map[col_name.to_s]]["options"].map {|option| option["value"]}
64
+ options = schema[col_map[col_name.to_s]]["options"].nil? ? [] : schema[col_map[col_name.to_s]]["options"].map {|option| option["value"]}
65
65
  if !options.include?(data[col_name])
66
66
  create_new_option = Utils::CollectionViewComponents.add_new_option(col_map[col_name.to_s], data[col_name], @collection_id)
67
67
  operations.push(create_new_option)
@@ -491,6 +491,8 @@ module Utils
491
491
  end
492
492
 
493
493
  def self.add_new_option(column, value, collection_id)
494
+ colors = ["default", "gray", "brown", "orange", "yellow", "green", "blue", "purple", "pink", "red"]
495
+ random_color = colors[rand(0...colors.length)]
494
496
  table = "collection"
495
497
  path = ["schema", column, "options"]
496
498
  command = "keyedObjectListAfter"
@@ -498,7 +500,7 @@ module Utils
498
500
  "value": {
499
501
  "id": SecureRandom.hex(16),
500
502
  "value": value,
501
- "color": "green"
503
+ "color": random_color
502
504
  }
503
505
  }
504
506
 
@@ -1,3 +1,3 @@
1
1
  module NotionAPI
2
- VERSION = '1.0.7'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notion
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Murphy