25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
# File 'lib/notion_ruby_mapping/objects/mention_object.rb', line 25
def partial_property_values_json
if @options.key? "user_id"
{
"type" => "user",
"user" => {
"object" => "user",
"id" => @options["user_id"],
},
}
elsif @options.key? "page_id"
{
"type" => "page",
"page" => {
"id" => @options["page_id"],
},
}
elsif @options.key? "database_id"
{
"type" => "database",
"database" => {
"id" => @options["database_id"],
},
}
elsif @options.key? "start"
{
"type" => "date",
"date" => @options.slice("start", "end", "time_zone"),
}
elsif @options.key? "template_mention"
sub = case @options["template_mention"]
when "today"
@options["plain_text"] = "@Today"
{
"type" => "template_mention_date",
"template_mention_date" => "today",
}
when "now"
@options["plain_text"] = "@Now"
{
"type" => "template_mention_date",
"template_mention_date" => "now",
}
else
@options["plain_text"] = "@Me"
{
"type" => "template_mention_user",
"template_mention_user" => "me",
}
end
{
"type" => "template_mention",
"template_mention" => sub,
}
elsif @options.key? "link_preview"
{
"type" => "link_preview",
"link_preview" => {
"url" => @options["link_preview"],
},
}
elsif @options.key? "href"
{
"type" => "link_mention",
"link_mention" => @options.slice("href", "icon_url", "link_provider", "thumbnail_url", "title"),
}
else
raise StandardError, "Irregular mention type: #{@options.keys}"
end
end
|