notion_ruby_mapping 0.1.2 → 0.1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1a29ab30d2bd0631a41516611cf406c86fc4940b11335b0a3f677b31d4c4ea
|
4
|
+
data.tar.gz: 133ad7c09465c229b0894fd6dcd36e7d722f4f1cffa995c43b87fae4b6362d9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 26ec1318e3df00a79a058798c2bbe5ae722cbe87fcc4191f3e0c00bed5e0a13880906e697d5f5e92d06159625a23c5a0736d91c577edd38c97f512f8a1e22f36
|
7
|
+
data.tar.gz: f09480ff8c3c38af9a7b284b97b903fcea59c99f50815285c93e61127e82b85edecad549442d566a914bcd51884139e05a93588beeeb59683749072ce98a8542
|
@@ -7,7 +7,7 @@ module NotionRubyMapping
|
|
7
7
|
class DateBaseProperty < Property
|
8
8
|
include IsEmptyIsNotEmpty
|
9
9
|
|
10
|
-
# @param [Date, Time, DateTime, String] obj
|
10
|
+
# @param [Date, Time, DateTime, String, nil] obj
|
11
11
|
# @return [String] iso8601 format string
|
12
12
|
def value_str(obj)
|
13
13
|
case obj
|
@@ -3,5 +3,42 @@
|
|
3
3
|
module NotionRubyMapping
|
4
4
|
class DateProperty < DateBaseProperty
|
5
5
|
TYPE = "date"
|
6
|
+
|
7
|
+
# @param [String] name
|
8
|
+
# @param [Hash] json
|
9
|
+
# @param [Array] multi_select
|
10
|
+
def initialize(name, json: nil, start_date: nil, end_date: nil, time_zone: nil)
|
11
|
+
super(name, json: json)
|
12
|
+
@end_date = end_date
|
13
|
+
@start_date = start_date || end_date
|
14
|
+
@time_zone = time_zone
|
15
|
+
end
|
16
|
+
|
17
|
+
# @return [Hash] created json
|
18
|
+
def create_json
|
19
|
+
if @end_date
|
20
|
+
{"date" => {"start" => value_str(@start_date || @end_date), "end" => value_str(@end_date)}}
|
21
|
+
elsif @start_date
|
22
|
+
{"date" => {"start" => value_str(@start_date)}}
|
23
|
+
else
|
24
|
+
{"date" => @json || {}}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
# @param [Hash] multi_select
|
29
|
+
# @return [Array, nil] settled array
|
30
|
+
def start_date=(start_date)
|
31
|
+
@will_update = true
|
32
|
+
@start_date = start_date
|
33
|
+
@end_date = nil if @start_date.class != @end_date.class || @start_date > @end_date
|
34
|
+
end
|
35
|
+
|
36
|
+
# @param [Hash] multi_select
|
37
|
+
# @return [Array, nil] settled array
|
38
|
+
def end_date=(end_date)
|
39
|
+
@will_update = true
|
40
|
+
@end_date = end_date
|
41
|
+
@end_date = nil if @start_date.class != @end_date.class || @start_date > @end_date
|
42
|
+
end
|
6
43
|
end
|
7
44
|
end
|
@@ -37,6 +37,8 @@ module NotionRubyMapping
|
|
37
37
|
SelectProperty.new key, json: input_json["select"]
|
38
38
|
elsif keys.include? "multi_select"
|
39
39
|
MultiSelectProperty.new key, json: input_json["multi_select"]
|
40
|
+
elsif keys.include? "date"
|
41
|
+
DateProperty.new key, json: input_json["date"]
|
40
42
|
else
|
41
43
|
nil
|
42
44
|
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.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hiroyuki KOBAYASHI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: notion-ruby-client
|