notion_ruby_mapping 0.5.2 → 0.5.3

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: 6958b79feeac5556e9eec4fcfac214099d81319f85249db07ad7e7d5ef326359
4
- data.tar.gz: 8fb970d28b42a5c0354ad6caf3aee0165362c76b1c3b0786548eafd654019255
3
+ metadata.gz: 0e14368364e3adabb6320d81c9347e876161d3836fa3502045c3d2313dbe5edd
4
+ data.tar.gz: 8cfa770324e6782b94465f19de2547cc0001010811e3e8883cb6296d95ad75f9
5
5
  SHA512:
6
- metadata.gz: 755b7031ff208823d9434bbe5850845f2b4bfe0b8bf4585418fe8ef42b5095df080d7461ff0788c3ddb0a500a9c4017fa5e287d63721c6a34e9c7baea4a55884
7
- data.tar.gz: 4227d5ac411aa5dc48f46a6d9bab1f4b097f17ba6fb9a1f9eb47b4b34167a5dc36a2e44d8f5df359a1f0ab1afeb256423ec7fe37603685df010f3891c4feaf2d
6
+ metadata.gz: '064994efd6460e35b6e1d65589d4f05cb8e7030e0dcd32237ddd6e19d89564cf272d9d3e147a703bde6739dd88a1794ed8d2613471c1d91acfc872d6e6766b51'
7
+ data.tar.gz: cd2009ce47f76dff7fc03ca5687fb1262a1fb713896975e30ba02088fb18b5b8492b76c04fda5fc4f66cdf87f480be2a06246ef9c8766864dac3aee8fadc3b63
@@ -9,10 +9,18 @@ module NotionRubyMapping
9
9
 
10
10
  # @param [Date, Time, DateTime, String, nil] obj
11
11
  # @return [String, nil] iso8601 format string
12
- def self.value_str(obj)
12
+ def self.value_str(obj, start_time: false, end_time: false)
13
13
  case obj
14
14
  when Date
15
- obj.iso8601
15
+ tz = Time.now.strftime "%:z"
16
+ ds = obj.iso8601
17
+ if start_time
18
+ "#{ds}T00:00:00#{tz}"
19
+ elsif end_time
20
+ "#{ds}T23:59:59#{tz}"
21
+ else
22
+ ds
23
+ end
16
24
  when Time
17
25
  obj.strftime("%Y-%m-%dT%H:%M:%S%:z")
18
26
  when DateTime
@@ -76,7 +84,7 @@ module NotionRubyMapping
76
84
  # @return [NotionRubyMapping::Query] generated Query object
77
85
  # @see https://www.notion.so/hkob/CreatedTimeProperty-bb979ff02dc04efa9733da1003efa871#841815bfaf684964bebf3fa6712ae26c
78
86
  def filter_before(date, rollup = nil, rollup_type = nil)
79
- make_filter_query "before", value_str(date), rollup, rollup_type
87
+ make_filter_query "before", value_str(date, start_time: true), rollup, rollup_type
80
88
  end
81
89
 
82
90
  # @param [String] rollup Rollup name
@@ -84,7 +92,7 @@ module NotionRubyMapping
84
92
  # @return [NotionRubyMapping::Query] generated Query object
85
93
  # @see https://www.notion.so/hkob/CreatedTimeProperty-bb979ff02dc04efa9733da1003efa871#c0ea140866ea46f9a746b24773dc821c
86
94
  def filter_after(date, rollup = nil, rollup_type = nil)
87
- make_filter_query "after", value_str(date), rollup, rollup_type
95
+ make_filter_query "after", value_str(date, end_time: true), rollup, rollup_type
88
96
  end
89
97
 
90
98
  # @param [String] rollup Rollup name
@@ -92,7 +100,7 @@ module NotionRubyMapping
92
100
  # @return [NotionRubyMapping::Query] generated Query object
93
101
  # @see https://www.notion.so/hkob/CreatedTimeProperty-bb979ff02dc04efa9733da1003efa871#6a20ade0ee964aad81aae4c08ea29d6b
94
102
  def filter_on_or_before(date, rollup = nil, rollup_type = nil)
95
- make_filter_query "on_or_before", value_str(date), rollup, rollup_type
103
+ make_filter_query "on_or_before", value_str(date, end_time: true), rollup, rollup_type
96
104
  end
97
105
 
98
106
  # @param [String] rollup Rollup name
@@ -100,7 +108,7 @@ module NotionRubyMapping
100
108
  # @return [NotionRubyMapping::Query] generated Query object
101
109
  # @see https://www.notion.so/hkob/CreatedTimeProperty-bb979ff02dc04efa9733da1003efa871#1469e3fb3068426a8ea8492d191d1563
102
110
  def filter_on_or_after(date, rollup = nil, rollup_type = nil)
103
- make_filter_query "on_or_after", value_str(date), rollup, rollup_type
111
+ make_filter_query "on_or_after", value_str(date, start_time: true), rollup, rollup_type
104
112
  end
105
113
 
106
114
  # @param [String] rollup Rollup name
@@ -151,12 +159,10 @@ module NotionRubyMapping
151
159
  make_filter_query "next_year", {}, rollup, rollup_type
152
160
  end
153
161
 
154
- protected
155
-
156
162
  # @param [Date, Time, DateTime, String, nil] obj
157
163
  # @return [String, nil] iso8601 format string
158
- def value_str(obj)
159
- self.class.value_str(obj)
164
+ def value_str(obj, start_time: false, end_time: false)
165
+ self.class.value_str(obj, start_time: start_time, end_time: end_time)
160
166
  end
161
167
  end
162
168
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NotionRubyMapping
4
- VERSION = "0.5.2"
4
+ VERSION = "0.5.3"
5
5
  NOTION_VERSION = "2022-02-22"
6
6
  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.5.2
4
+ version: 0.5.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-06-08 00:00:00.000000000 Z
11
+ date: 2022-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday