-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcard.rb
66 lines (60 loc) · 2.17 KB
/
card.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
require 'json_schemer'
module Card
extend self
def schema
JSONSchemer.new do |card|
card.description "A representation of a person, company, organization, or place"
card.string :fn, :optional => true do |fn|
fn.description "Formatted Name"
end
card.string :familyName
card.string :givenName
card.array :additionalName, :optional => true do |additionalName|
additionalName.items "string"
end
card.array :honorificPrefix, :optional => true do |honorificPrefix|
honorificPrefix.items "string"
end
card.array :honorificSuffix, :optional => true do |honorificSuffix|
honorificSuffix.items "string"
end
card.string :sound, :optional => true, :format => :attachment
card.string :nickname, :optional => true
card.string :url, :format => :url, :optional => true
card.object :email, :optional => true do |email|
email.string :type
email.string :value, :format => :email
end
card.object :tel, :optional => true do |tel|
tel.string :type
tel.string :value, :format => :phone
end
card.object :adr, :optional => true, :ref => "http://json-schema.org/address"
card.string :tz, :optional => true
card.object :geo, :optional => true, :ref => "http://json-schema.org/geo"
card.string :photo, :format => :image, :optional => true
card.string :logo, :format => :image, :optional => true
card.string :bday, :format => :date, :optional => true
card.string :title, :optional => true
card.string :role, :optional => true
card.object :org do |org|
org.string :organizationName
org.string :organizationUnit
org.object :event, :ref => "http://json-schema.org/calendar"
end
card.array :children, :optional => true do |children|
children.items do |items|
items.string
items.object :name do |name|
name.string :first_name
name.string :last_name
end
end
end
card.number :height_in_meters
card.integer :age
card.boolean :male
card.null :nil
end
end
end