notion_to_md 2.3.1 → 2.4.1

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: 26fb275bacfb3f94bc62bf1f15de2de6636f043a2a7d11b66ecba0f5df2a39ec
4
- data.tar.gz: 53308f1bc92d17a1125969e030f6a070cc82384808b34787f6ed0c853fdbaca9
3
+ metadata.gz: d2c563b14bee2d927bd6f37cbbc18f59f52545bdc02bcb74e865657231a8d926
4
+ data.tar.gz: e99d9b5e01e3c042e26818ea5eb8b7652701fca9d3a1d94f1c4b5cc41efdca8b
5
5
  SHA512:
6
- metadata.gz: b0522c546ae98279d0a20aff3a8bf5d225dc74eea6c5504a0f35bdf6bb692e870c6719ea088251556fb49ad3318031f200754ac2691254fa3d0d4287035e4045
7
- data.tar.gz: 2430ca47d1fe39e9f73cc9aad187d6457440edb94cd60dea9d1d82d562a057339acdef9c85ac8b1db79d34acd9db754493a62876643deab50af310472e125b06
6
+ metadata.gz: 0f523319dad22eeae015ab2e52bbd24f04d34acf9f654e4d92a9dcebed1e3a0255f08d8492af371347d2fc81d3acf24d0ef0e51d3a0708a2d143485056e783b9
7
+ data.tar.gz: 8d01b8e6d570da473aa38eb32391f26841ec49e75809ea5733f94974a37a495d731200f3c24a2e3909579ee9ffc1d7d3fcb8b1523fb3070a9d87a711af2be8d9
data/README.md CHANGED
@@ -102,6 +102,10 @@ created_time: 2022-01-23T12:31:00.000Z
102
102
  last_edited_time: 2022-01-23T12:31:00.000Z
103
103
  icon: 💥
104
104
  archived: false
105
+ created_by_id: db313571-0280-411f-a6de-70e826421d16
106
+ created_by_object: user
107
+ last_edited_by_id: db313571-0280-411f-a6de-70e826421d16
108
+ last_edited_by_object: user
105
109
  ---
106
110
  ```
107
111
 
@@ -5,7 +5,7 @@ module NotionToMd
5
5
  class Types
6
6
  class << self
7
7
  def paragraph(block)
8
- return blank if block.rich_text.empty?
8
+ return blank if block[:rich_text].empty?
9
9
 
10
10
  convert_text(block)
11
11
  end
@@ -124,7 +124,7 @@ module NotionToMd
124
124
  href = text[:href]
125
125
  return content if href.nil?
126
126
 
127
- "[#{content}](#{href})"
127
+ "[#{content}](#{CGI.unescape(href)})"
128
128
  end
129
129
 
130
130
  def add_annotations(text, content)
@@ -31,11 +31,27 @@ module NotionToMd
31
31
  end
32
32
 
33
33
  def created_time
34
- DateTime.parse(page['created_time'])
34
+ page['created_time']
35
+ end
36
+
37
+ def created_by_object
38
+ page.dig(:created_by, :object)
39
+ end
40
+
41
+ def created_by_id
42
+ page.dig(:created_by, :id)
35
43
  end
36
44
 
37
45
  def last_edited_time
38
- DateTime.parse(page['last_edited_time'])
46
+ page['last_edited_time']
47
+ end
48
+
49
+ def last_edited_by_object
50
+ page.dig(:last_edited_by, :object)
51
+ end
52
+
53
+ def last_edited_by_id
54
+ page.dig(:last_edited_by, :id)
39
55
  end
40
56
 
41
57
  def url
@@ -83,8 +99,12 @@ module NotionToMd
83
99
  'created_time' => created_time,
84
100
  'cover' => cover,
85
101
  'icon' => icon,
86
- 'last_edited_time' => last_edited_time.to_s.dump,
87
- 'archived' => archived
102
+ 'last_edited_time' => last_edited_time,
103
+ 'archived' => archived,
104
+ 'created_by_object' => created_by_object,
105
+ 'created_by_id' => created_by_id,
106
+ 'last_edited_by_object' => last_edited_by_object,
107
+ 'last_edited_by_id' => last_edited_by_id
88
108
  }
89
109
  end
90
110
 
@@ -75,7 +75,16 @@ module NotionToMd
75
75
  # - end
76
76
  # - time_zone
77
77
  def date(prop)
78
- prop.dig(:date, :start)
78
+ date = prop.dig(:date, :start)
79
+
80
+ case date
81
+ when Date
82
+ date.to_time
83
+ when String
84
+ Time.parse(date)
85
+ else
86
+ date # Time or nil
87
+ end
79
88
  rescue NoMethodError
80
89
  nil
81
90
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NotionToMd
4
- VERSION = '2.3.1'
4
+ VERSION = '2.4.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notion_to_md
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Enrique Arias