notion_ruby_mapping 0.5.1 → 0.5.2

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: 68d4b404cfe0798695934594f05049482f5436f15e0f2eb7c82125031ce3f340
4
- data.tar.gz: b179b7d3530ec7f323023f5ec3ada9057f7e402f87a87c65579482c015184c62
3
+ metadata.gz: 6958b79feeac5556e9eec4fcfac214099d81319f85249db07ad7e7d5ef326359
4
+ data.tar.gz: 8fb970d28b42a5c0354ad6caf3aee0165362c76b1c3b0786548eafd654019255
5
5
  SHA512:
6
- metadata.gz: 35b3b4ec135b729ba8f93e5d583f0e717e75cb6f0bd75779433948ef671b4bfa9cf22346e1a222d473f506b90a1a24efaa4fca856cd533448d773a710160f421
7
- data.tar.gz: 92ef1a7218a0551195dae18a9bbbb3f82f440ba6fd2b8af49bcb578c5f21bf9417644750bc5297133d0ddd789987123f5e6dbd024bb7cb8b5b19a3a4c0764758
6
+ metadata.gz: 755b7031ff208823d9434bbe5850845f2b4bfe0b8bf4585418fe8ef42b5095df080d7461ff0788c3ddb0a500a9c4017fa5e287d63721c6a34e9c7baea4a55884
7
+ data.tar.gz: 4227d5ac411aa5dc48f46a6d9bab1f4b097f17ba6fb9a1f9eb47b4b34167a5dc36a2e44d8f5df359a1f0ab1afeb256423ec7fe37603685df010f3891c4feaf2d
@@ -25,7 +25,7 @@ module NotionRubyMapping
25
25
  assign.each_slice(2) { |(klass, key)| assign_property(klass, key) }
26
26
  @json ||= {}
27
27
  end
28
- attr_reader :json, :id
28
+ attr_reader :json, :id, :archived
29
29
 
30
30
  # @param [Hash, Notion::Messages] json
31
31
  # @return [NotionRubyMapping::Base]
@@ -22,6 +22,13 @@ module NotionRubyMapping
22
22
  end
23
23
  end
24
24
 
25
+ # @param [Date] date
26
+ def self.start_end_time(date)
27
+ ds = date.iso8601
28
+ tz = Time.now.strftime "%:z"
29
+ %w[00:00:00 23:59:59].map {|t| [ds, "T", t, tz].join("") }
30
+ end
31
+
25
32
  # @param [Date, Time, DateTime, String, nil] obj
26
33
  # @return [Date, nil] iso8601 format string
27
34
  def self.date_from_obj(obj)
@@ -34,14 +41,34 @@ module NotionRubyMapping
34
41
  # @return [NotionRubyMapping::Query] generated Query object
35
42
  # @see https://www.notion.so/hkob/CheckboxProperty-ac1edbdb8e264af5ad1432b522b429fd#5f07c4ebc4744986bfc99a43827349fc
36
43
  def filter_equals(date, rollup = nil, rollup_type = nil)
37
- make_filter_query "equals", value_str(date), rollup, rollup_type
44
+ if date.is_a? Date
45
+ start_date, end_date = self.class.start_end_time date
46
+ if rollup
47
+ filter_after(start_date, rollup, rollup_type)
48
+ .and(filter_before(end_date, rollup, rollup_type))
49
+ else
50
+ filter_after(start_date).and(filter_before end_date)
51
+ end
52
+ else
53
+ make_filter_query "equals", value_str(date), rollup, rollup_type
54
+ end
38
55
  end
39
56
 
40
57
  # @param [String] rollup Rollup name
41
58
  # @param [String] rollup_type Rollup type
42
59
  # @return [NotionRubyMapping::Query] generated Query object
43
60
  def filter_does_not_equal(date, rollup = nil, rollup_type = nil)
44
- make_filter_query "does_not_equal", value_str(date), rollup, rollup_type
61
+ if date.is_a? Date
62
+ start_date, end_date = self.class.start_end_time date
63
+ if rollup
64
+ filter_before(start_date, rollup, rollup_type)
65
+ .or(filter_after(end_date, rollup, rollup_type))
66
+ else
67
+ filter_before(start_date).or(filter_after(end_date))
68
+ end
69
+ else
70
+ make_filter_query "does_not_equal", value_str(date), rollup, rollup_type
71
+ end
45
72
  end
46
73
 
47
74
  # @param [String] rollup Rollup name
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NotionRubyMapping
4
- VERSION = "0.5.1"
4
+ VERSION = "0.5.2"
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.1
4
+ version: 0.5.2
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-05 00:00:00.000000000 Z
11
+ date: 2022-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday