tilia-vobject 4.0.0.pre.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rubocop.yml +32 -0
- data/.simplecov +4 -0
- data/.travis.yml +3 -0
- data/CHANGELOG.sabre.md +626 -0
- data/CONTRIBUTING.md +25 -0
- data/Gemfile +17 -0
- data/Gemfile.lock +68 -0
- data/LICENSE +27 -0
- data/LICENSE.sabre +27 -0
- data/README.md +63 -0
- data/Rakefile +17 -0
- data/bin/vobject +7 -0
- data/lib/tilia/v_object/birthday_calendar_generator.rb +142 -0
- data/lib/tilia/v_object/cli.rb +582 -0
- data/lib/tilia/v_object/component/available.rb +107 -0
- data/lib/tilia/v_object/component/v_alarm.rb +114 -0
- data/lib/tilia/v_object/component/v_availability.rb +128 -0
- data/lib/tilia/v_object/component/v_calendar.rb +468 -0
- data/lib/tilia/v_object/component/v_card.rb +457 -0
- data/lib/tilia/v_object/component/v_event.rb +127 -0
- data/lib/tilia/v_object/component/v_free_busy.rb +81 -0
- data/lib/tilia/v_object/component/v_journal.rb +75 -0
- data/lib/tilia/v_object/component/v_time_zone.rb +51 -0
- data/lib/tilia/v_object/component/v_todo.rb +147 -0
- data/lib/tilia/v_object/component.rb +591 -0
- data/lib/tilia/v_object/date_time_parser.rb +486 -0
- data/lib/tilia/v_object/document.rb +218 -0
- data/lib/tilia/v_object/element_list.rb +18 -0
- data/lib/tilia/v_object/eof_exception.rb +8 -0
- data/lib/tilia/v_object/free_busy_data.rb +149 -0
- data/lib/tilia/v_object/free_busy_generator.rb +465 -0
- data/lib/tilia/v_object/i_tip/broker.rb +909 -0
- data/lib/tilia/v_object/i_tip/i_tip_exception.rb +9 -0
- data/lib/tilia/v_object/i_tip/message.rb +109 -0
- data/lib/tilia/v_object/i_tip/same_organizer_for_all_components_exception.rb +13 -0
- data/lib/tilia/v_object/i_tip.rb +10 -0
- data/lib/tilia/v_object/node.rb +192 -0
- data/lib/tilia/v_object/parameter.rb +327 -0
- data/lib/tilia/v_object/parse_exception.rb +7 -0
- data/lib/tilia/v_object/parser/json.rb +149 -0
- data/lib/tilia/v_object/parser/mime_dir.rb +543 -0
- data/lib/tilia/v_object/parser/parser.rb +61 -0
- data/lib/tilia/v_object/parser/xml/element/key_value.rb +60 -0
- data/lib/tilia/v_object/parser/xml/element.rb +11 -0
- data/lib/tilia/v_object/parser/xml.rb +322 -0
- data/lib/tilia/v_object/parser.rb +10 -0
- data/lib/tilia/v_object/property/binary.rb +96 -0
- data/lib/tilia/v_object/property/boolean.rb +57 -0
- data/lib/tilia/v_object/property/flat_text.rb +52 -0
- data/lib/tilia/v_object/property/float_value.rb +107 -0
- data/lib/tilia/v_object/property/i_calendar/cal_address.rb +49 -0
- data/lib/tilia/v_object/property/i_calendar/date.rb +15 -0
- data/lib/tilia/v_object/property/i_calendar/date_time.rb +330 -0
- data/lib/tilia/v_object/property/i_calendar/duration.rb +65 -0
- data/lib/tilia/v_object/property/i_calendar/period.rb +124 -0
- data/lib/tilia/v_object/property/i_calendar/recur.rb +173 -0
- data/lib/tilia/v_object/property/i_calendar.rb +14 -0
- data/lib/tilia/v_object/property/integer_value.rb +60 -0
- data/lib/tilia/v_object/property/text.rb +352 -0
- data/lib/tilia/v_object/property/time.rb +85 -0
- data/lib/tilia/v_object/property/unknown.rb +30 -0
- data/lib/tilia/v_object/property/uri.rb +78 -0
- data/lib/tilia/v_object/property/utc_offset.rb +56 -0
- data/lib/tilia/v_object/property/v_card/date.rb +31 -0
- data/lib/tilia/v_object/property/v_card/date_and_or_time.rb +343 -0
- data/lib/tilia/v_object/property/v_card/date_time.rb +22 -0
- data/lib/tilia/v_object/property/v_card/language_tag.rb +41 -0
- data/lib/tilia/v_object/property/v_card/time_stamp.rb +74 -0
- data/lib/tilia/v_object/property/v_card.rb +13 -0
- data/lib/tilia/v_object/property.rb +532 -0
- data/lib/tilia/v_object/reader.rb +73 -0
- data/lib/tilia/v_object/recur/event_iterator.rb +417 -0
- data/lib/tilia/v_object/recur/no_instances_exception.rb +11 -0
- data/lib/tilia/v_object/recur/r_date_iterator.rb +138 -0
- data/lib/tilia/v_object/recur/r_rule_iterator.rb +717 -0
- data/lib/tilia/v_object/recur.rb +10 -0
- data/lib/tilia/v_object/settings.rb +32 -0
- data/lib/tilia/v_object/splitter/i_calendar.rb +95 -0
- data/lib/tilia/v_object/splitter/splitter_interface.rb +31 -0
- data/lib/tilia/v_object/splitter/v_card.rb +56 -0
- data/lib/tilia/v_object/splitter.rb +9 -0
- data/lib/tilia/v_object/string_util.rb +58 -0
- data/lib/tilia/v_object/time_zone_data/exchange_zones.rb +96 -0
- data/lib/tilia/v_object/time_zone_data/lotus_zones.rb +104 -0
- data/lib/tilia/v_object/time_zone_data/php_zones.rb +49 -0
- data/lib/tilia/v_object/time_zone_data/windows_zones.rb +121 -0
- data/lib/tilia/v_object/time_zone_data.rb +10 -0
- data/lib/tilia/v_object/time_zone_util.rb +213 -0
- data/lib/tilia/v_object/uuid_util.rb +51 -0
- data/lib/tilia/v_object/v_card_converter.rb +354 -0
- data/lib/tilia/v_object/version.rb +9 -0
- data/lib/tilia/v_object/writer.rb +56 -0
- data/lib/tilia/v_object.rb +45 -0
- data/lib/tilia/vobject.rb +1 -0
- data/resources/schema/xcal.rng +1192 -0
- data/resources/schema/xcard.rng +388 -0
- data/test/test_helper.rb +56 -0
- data/test/v_object/attach_issue_test.rb +19 -0
- data/test/v_object/birthday_calendar_generator_test.rb +463 -0
- data/test/v_object/cli_mock.rb +19 -0
- data/test/v_object/cli_test.rb +460 -0
- data/test/v_object/component/available_test.rb +59 -0
- data/test/v_object/component/v_alarm_test.rb +160 -0
- data/test/v_object/component/v_availability_test.rb +388 -0
- data/test/v_object/component/v_calendar_test.rb +646 -0
- data/test/v_object/component/v_card_test.rb +258 -0
- data/test/v_object/component/v_event_test.rb +85 -0
- data/test/v_object/component/v_free_busy_test.rb +59 -0
- data/test/v_object/component/v_journal_test.rb +85 -0
- data/test/v_object/component/v_time_zone_test.rb +47 -0
- data/test/v_object/component/v_todo_test.rb +172 -0
- data/test/v_object/component_test.rb +419 -0
- data/test/v_object/date_time_parser_test.rb +526 -0
- data/test/v_object/document_test.rb +71 -0
- data/test/v_object/element_list_test.rb +27 -0
- data/test/v_object/em_client_test.rb +53 -0
- data/test/v_object/empty_parameter_test.rb +65 -0
- data/test/v_object/empty_value_issue_test.rb +25 -0
- data/test/v_object/fake_component.rb +21 -0
- data/test/v_object/free_busy_data_test.rb +285 -0
- data/test/v_object/free_busy_generator_test.rb +637 -0
- data/test/v_object/google_colon_escaping_test.rb +27 -0
- data/test/v_object/i_calendar/attach_parse_test.rb +24 -0
- data/test/v_object/i_tip/broker_attendee_reply_test.rb +1042 -0
- data/test/v_object/i_tip/broker_delete_event_test.rb +175 -0
- data/test/v_object/i_tip/broker_new_event_test.rb +440 -0
- data/test/v_object/i_tip/broker_process_message_test.rb +153 -0
- data/test/v_object/i_tip/broker_process_reply_test.rb +402 -0
- data/test/v_object/i_tip/broker_tester.rb +71 -0
- data/test/v_object/i_tip/broker_update_event_test.rb +763 -0
- data/test/v_object/i_tip/evolution_test.rb +2644 -0
- data/test/v_object/i_tip/message_test.rb +25 -0
- data/test/v_object/issue153.vcf +352 -0
- data/test/v_object/issue153_test.rb +12 -0
- data/test/v_object/issue26_test.rb +25 -0
- data/test/v_object/issue36_work_around_test.rb +37 -0
- data/test/v_object/issue40_test.rb +26 -0
- data/test/v_object/issue64.vcf +351 -0
- data/test/v_object/issue64_test.rb +17 -0
- data/test/v_object/issue96_test.rb +22 -0
- data/test/v_object/issue_undefined_index_test.rb +24 -0
- data/test/v_object/j_cal_test.rb +150 -0
- data/test/v_object/j_card_test.rb +192 -0
- data/test/v_object/line_folding_issue_test.rb +19 -0
- data/test/v_object/mock_document.rb +6 -0
- data/test/v_object/parameter_test.rb +109 -0
- data/test/v_object/parser/json_test.rb +370 -0
- data/test/v_object/parser/mime_dir_test.rb +14 -0
- data/test/v_object/parser/quoted_printable_test.rb +78 -0
- data/test/v_object/parser/xml_test.rb +2563 -0
- data/test/v_object/property/binary_test.rb +12 -0
- data/test/v_object/property/boolean_test.rb +18 -0
- data/test/v_object/property/compound_test.rb +43 -0
- data/test/v_object/property/float_test.rb +20 -0
- data/test/v_object/property/i_calendar/cal_address_test.rb +26 -0
- data/test/v_object/property/i_calendar/date_time_test.rb +303 -0
- data/test/v_object/property/i_calendar/duration_test.rb +14 -0
- data/test/v_object/property/i_calendar/recur_test.rb +39 -0
- data/test/v_object/property/text_test.rb +81 -0
- data/test/v_object/property/v_card/date_and_or_time_test.rb +205 -0
- data/test/v_object/property/v_card/language_tag_test.rb +35 -0
- data/test/v_object/property_test.rb +338 -0
- data/test/v_object/reader_test.rb +403 -0
- data/test/v_object/recur/event_iterator/by_month_in_daily_test.rb +52 -0
- data/test/v_object/recur/event_iterator/by_set_pos_hang_test.rb +55 -0
- data/test/v_object/recur/event_iterator/expand_floating_times_test.rb +109 -0
- data/test/v_object/recur/event_iterator/fifth_tuesday_problem_test.rb +45 -0
- data/test/v_object/recur/event_iterator/incorrect_expand_test.rb +53 -0
- data/test/v_object/recur/event_iterator/infinite_loop_problem_test.rb +75 -0
- data/test/v_object/recur/event_iterator/issue48_test.rb +43 -0
- data/test/v_object/recur/event_iterator/issue50_test.rb +123 -0
- data/test/v_object/recur/event_iterator/main_test.rb +1222 -0
- data/test/v_object/recur/event_iterator/missing_overridden_test.rb +55 -0
- data/test/v_object/recur/event_iterator/no_instances_test.rb +32 -0
- data/test/v_object/recur/event_iterator/override_first_event_test.rb +106 -0
- data/test/v_object/recur/r_date_iterator_test.rb +44 -0
- data/test/v_object/recur/r_rule_iterator_test.rb +608 -0
- data/test/v_object/recurrence_iterator/UntilRespectsTimezoneTest.ics +39 -0
- data/test/v_object/slash_r_test.rb +15 -0
- data/test/v_object/splitter/i_calendar_test.rb +299 -0
- data/test/v_object/splitter/v_card_test.rb +173 -0
- data/test/v_object/string_util_test.rb +37 -0
- data/test/v_object/test_case.rb +42 -0
- data/test/v_object/time_zone_util_test.rb +271 -0
- data/test/v_object/uuid_util_test.rb +18 -0
- data/test/v_object/v_card21_test.rb +43 -0
- data/test/v_object/v_card_converter_test.rb +419 -0
- data/test/v_object/version_test.rb +15 -0
- data/test/v_object/writer_test.rb +33 -0
- data/tilia-vobject.gemspec +17 -0
- metadata +308 -0
@@ -0,0 +1,388 @@
|
|
1
|
+
# RELAX NG Schema for vCard in XML
|
2
|
+
# Extract from RFC6351.
|
3
|
+
# Erratum 2994 applied.
|
4
|
+
# Erratum 3047 applied.
|
5
|
+
# Erratum 3008 applied.
|
6
|
+
# Erratum 4247 applied.
|
7
|
+
|
8
|
+
default namespace = "urn:ietf:params:xml:ns:vcard-4.0"
|
9
|
+
|
10
|
+
### Section 3.3: vCard Format Specification
|
11
|
+
#
|
12
|
+
# 3.3
|
13
|
+
iana-token = xsd:string { pattern = "[a-zA-Z0-9\-]+" }
|
14
|
+
x-name = xsd:string { pattern = "x-[a-zA-Z0-9\-]+" }
|
15
|
+
|
16
|
+
### Section 4: Value types
|
17
|
+
#
|
18
|
+
# 4.1
|
19
|
+
value-text = element text { text }
|
20
|
+
value-text-list = value-text+
|
21
|
+
|
22
|
+
# 4.2
|
23
|
+
value-uri = element uri { xsd:anyURI }
|
24
|
+
|
25
|
+
# 4.3.1
|
26
|
+
value-date = element date {
|
27
|
+
xsd:string { pattern = "\d{8}|\d{4}-\d\d|--\d\d(\d\d)?|---\d\d" }
|
28
|
+
}
|
29
|
+
|
30
|
+
# 4.3.2
|
31
|
+
value-time = element time {
|
32
|
+
xsd:string { pattern = "(\d\d(\d\d(\d\d)?)?|-\d\d(\d\d)?|--\d\d)"
|
33
|
+
~ "(Z|[+\-]\d\d(\d\d)?)?" }
|
34
|
+
}
|
35
|
+
|
36
|
+
# 4.3.3
|
37
|
+
value-date-time = element date-time {
|
38
|
+
xsd:string { pattern = "(\d{8}|--\d{4}|---\d\d)T\d\d(\d\d(\d\d)?)?"
|
39
|
+
~ "(Z|[+\-]\d\d(\d\d)?)?" }
|
40
|
+
}
|
41
|
+
|
42
|
+
# 4.3.4
|
43
|
+
value-date-and-or-time = value-date | value-date-time | value-time
|
44
|
+
|
45
|
+
# 4.3.5
|
46
|
+
value-timestamp = element timestamp {
|
47
|
+
xsd:string { pattern = "\d{8}T\d{6}(Z|[+\-]\d\d(\d\d)?)?" }
|
48
|
+
}
|
49
|
+
|
50
|
+
# 4.4
|
51
|
+
value-boolean = element boolean { xsd:boolean }
|
52
|
+
|
53
|
+
# 4.5
|
54
|
+
value-integer = element integer { xsd:integer }
|
55
|
+
|
56
|
+
# 4.6
|
57
|
+
value-float = element float { xsd:float }
|
58
|
+
|
59
|
+
# 4.7
|
60
|
+
value-utc-offset = element utc-offset {
|
61
|
+
xsd:string { pattern = "[+\-]\d\d(\d\d)?" }
|
62
|
+
}
|
63
|
+
|
64
|
+
# 4.8
|
65
|
+
value-language-tag = element language-tag {
|
66
|
+
xsd:string { pattern = "([a-z]{2,3}((-[a-z]{3}){0,3})?|[a-z]{4,8})"
|
67
|
+
~ "(-[a-z]{4})?(-([a-z]{2}|\d{3}))?"
|
68
|
+
~ "(-([0-9a-z]{5,8}|\d[0-9a-z]{3}))*"
|
69
|
+
~ "(-[0-9a-wyz](-[0-9a-z]{2,8})+)*"
|
70
|
+
~ "(-x(-[0-9a-z]{1,8})+)?|x(-[0-9a-z]{1,8})+|"
|
71
|
+
~ "[a-z]{1,3}(-[0-9a-z]{2,8}){1,2}" }
|
72
|
+
}
|
73
|
+
|
74
|
+
### Section 5: Parameters
|
75
|
+
#
|
76
|
+
# 5.1
|
77
|
+
param-language = element language { value-language-tag }?
|
78
|
+
|
79
|
+
# 5.2
|
80
|
+
param-pref = element pref {
|
81
|
+
element integer {
|
82
|
+
xsd:integer { minInclusive = "1" maxInclusive = "100" }
|
83
|
+
}
|
84
|
+
}?
|
85
|
+
|
86
|
+
# 5.4
|
87
|
+
param-altid = element altid { value-text }?
|
88
|
+
|
89
|
+
# 5.5
|
90
|
+
param-pid = element pid {
|
91
|
+
element text { xsd:string { pattern = "\d+(\.\d+)?" } }+
|
92
|
+
}?
|
93
|
+
|
94
|
+
# 5.6
|
95
|
+
param-type = element type { element text { "work" | "home" }+ }?
|
96
|
+
|
97
|
+
# 5.7
|
98
|
+
param-mediatype = element mediatype { value-text }?
|
99
|
+
|
100
|
+
# 5.8
|
101
|
+
param-calscale = element calscale { element text { "gregorian" } }?
|
102
|
+
|
103
|
+
# 5.9
|
104
|
+
param-sort-as = element sort-as { value-text+ }?
|
105
|
+
|
106
|
+
# 5.10
|
107
|
+
param-geo = element geo { value-uri }?
|
108
|
+
|
109
|
+
# 5.11
|
110
|
+
param-tz = element tz { value-text | value-uri }?
|
111
|
+
|
112
|
+
### Section 6: Properties
|
113
|
+
#
|
114
|
+
# 6.1.3
|
115
|
+
property-source = element source {
|
116
|
+
element parameters { param-altid, param-pid, param-pref,
|
117
|
+
param-mediatype }?,
|
118
|
+
value-uri
|
119
|
+
}
|
120
|
+
|
121
|
+
# 6.1.4
|
122
|
+
property-kind = element kind {
|
123
|
+
element text { "individual" | "group" | "org" | "location" |
|
124
|
+
x-name | iana-token }*
|
125
|
+
}
|
126
|
+
|
127
|
+
# 6.2.1
|
128
|
+
property-fn = element fn {
|
129
|
+
element parameters { param-language, param-altid, param-pid,
|
130
|
+
param-pref, param-type }?,
|
131
|
+
value-text
|
132
|
+
}
|
133
|
+
|
134
|
+
# 6.2.2
|
135
|
+
property-n = element n {
|
136
|
+
element parameters { param-language, param-sort-as, param-altid }?,
|
137
|
+
element surname { text }+,
|
138
|
+
element given { text }+,
|
139
|
+
element additional { text }+,
|
140
|
+
element prefix { text }+,
|
141
|
+
element suffix { text }+
|
142
|
+
}
|
143
|
+
|
144
|
+
# 6.2.3
|
145
|
+
property-nickname = element nickname {
|
146
|
+
element parameters { param-language, param-altid, param-pid,
|
147
|
+
param-pref, param-type }?,
|
148
|
+
value-text-list
|
149
|
+
}
|
150
|
+
|
151
|
+
# 6.2.4
|
152
|
+
property-photo = element photo {
|
153
|
+
element parameters { param-altid, param-pid, param-pref, param-type,
|
154
|
+
param-mediatype }?,
|
155
|
+
value-uri
|
156
|
+
}
|
157
|
+
|
158
|
+
# 6.2.5
|
159
|
+
property-bday = element bday {
|
160
|
+
element parameters { param-altid, param-calscale }?,
|
161
|
+
(value-date-and-or-time | value-text)
|
162
|
+
}
|
163
|
+
|
164
|
+
# 6.2.6
|
165
|
+
property-anniversary = element anniversary {
|
166
|
+
element parameters { param-altid, param-calscale }?,
|
167
|
+
(value-date-and-or-time | value-text)
|
168
|
+
}
|
169
|
+
|
170
|
+
# 6.2.7
|
171
|
+
property-gender = element gender {
|
172
|
+
element sex { "" | "M" | "F" | "O" | "N" | "U" },
|
173
|
+
element identity { text }?
|
174
|
+
}
|
175
|
+
|
176
|
+
# 6.3.1
|
177
|
+
param-label = element label { value-text }?
|
178
|
+
property-adr = element adr {
|
179
|
+
element parameters { param-language, param-altid, param-pid,
|
180
|
+
param-pref, param-type, param-geo, param-tz,
|
181
|
+
param-label }?,
|
182
|
+
element pobox { text }+,
|
183
|
+
element ext { text }+,
|
184
|
+
element street { text }+,
|
185
|
+
element locality { text }+,
|
186
|
+
element region { text }+,
|
187
|
+
element code { text }+,
|
188
|
+
element country { text }+
|
189
|
+
}
|
190
|
+
|
191
|
+
# 6.4.1
|
192
|
+
property-tel = element tel {
|
193
|
+
element parameters {
|
194
|
+
param-altid,
|
195
|
+
param-pid,
|
196
|
+
param-pref,
|
197
|
+
element type {
|
198
|
+
element text { "work" | "home" | "text" | "voice"
|
199
|
+
| "fax" | "cell" | "video" | "pager"
|
200
|
+
| "textphone" | x-name | iana-token }+
|
201
|
+
}?,
|
202
|
+
param-mediatype
|
203
|
+
}?,
|
204
|
+
(value-text | value-uri)
|
205
|
+
}
|
206
|
+
|
207
|
+
# 6.4.2
|
208
|
+
property-email = element email {
|
209
|
+
element parameters { param-altid, param-pid, param-pref,
|
210
|
+
param-type }?,
|
211
|
+
value-text
|
212
|
+
}
|
213
|
+
|
214
|
+
# 6.4.3
|
215
|
+
property-impp = element impp {
|
216
|
+
element parameters { param-altid, param-pid, param-pref,
|
217
|
+
param-type, param-mediatype }?,
|
218
|
+
value-uri
|
219
|
+
}
|
220
|
+
|
221
|
+
# 6.4.4
|
222
|
+
property-lang = element lang {
|
223
|
+
element parameters { param-altid, param-pid, param-pref,
|
224
|
+
param-type }?,
|
225
|
+
value-language-tag
|
226
|
+
}
|
227
|
+
|
228
|
+
# 6.5.1
|
229
|
+
property-tz = element tz {
|
230
|
+
element parameters { param-altid, param-pid, param-pref,
|
231
|
+
param-type, param-mediatype }?,
|
232
|
+
(value-text | value-uri | value-utc-offset)
|
233
|
+
}
|
234
|
+
|
235
|
+
# 6.5.2
|
236
|
+
property-geo = element geo {
|
237
|
+
element parameters { param-altid, param-pid, param-pref,
|
238
|
+
param-type, param-mediatype }?,
|
239
|
+
value-uri
|
240
|
+
}
|
241
|
+
|
242
|
+
# 6.6.1
|
243
|
+
property-title = element title {
|
244
|
+
element parameters { param-language, param-altid, param-pid,
|
245
|
+
param-pref, param-type }?,
|
246
|
+
value-text
|
247
|
+
}
|
248
|
+
|
249
|
+
# 6.6.2
|
250
|
+
property-role = element role {
|
251
|
+
element parameters { param-language, param-altid, param-pid,
|
252
|
+
param-pref, param-type }?,
|
253
|
+
value-text
|
254
|
+
}
|
255
|
+
|
256
|
+
# 6.6.3
|
257
|
+
property-logo = element logo {
|
258
|
+
element parameters { param-language, param-altid, param-pid,
|
259
|
+
param-pref, param-type, param-mediatype }?,
|
260
|
+
value-uri
|
261
|
+
}
|
262
|
+
|
263
|
+
# 6.6.4
|
264
|
+
property-org = element org {
|
265
|
+
element parameters { param-language, param-altid, param-pid,
|
266
|
+
param-pref, param-type, param-sort-as }?,
|
267
|
+
value-text-list
|
268
|
+
}
|
269
|
+
|
270
|
+
# 6.6.5
|
271
|
+
property-member = element member {
|
272
|
+
element parameters { param-altid, param-pid, param-pref,
|
273
|
+
param-mediatype }?,
|
274
|
+
value-uri
|
275
|
+
}
|
276
|
+
|
277
|
+
# 6.6.6
|
278
|
+
property-related = element related {
|
279
|
+
element parameters {
|
280
|
+
param-altid,
|
281
|
+
param-pid,
|
282
|
+
param-pref,
|
283
|
+
element type {
|
284
|
+
element text {
|
285
|
+
"work" | "home" | "contact" | "acquaintance" |
|
286
|
+
"friend" | "met" | "co-worker" | "colleague" | "co-resident" |
|
287
|
+
"neighbor" | "child" | "parent" | "sibling" | "spouse" |
|
288
|
+
"kin" | "muse" | "crush" | "date" | "sweetheart" | "me" |
|
289
|
+
"agent" | "emergency"
|
290
|
+
}+
|
291
|
+
}?,
|
292
|
+
param-mediatype
|
293
|
+
}?,
|
294
|
+
(value-uri | value-text)
|
295
|
+
}
|
296
|
+
|
297
|
+
# 6.7.1
|
298
|
+
property-categories = element categories {
|
299
|
+
element parameters { param-altid, param-pid, param-pref,
|
300
|
+
param-type }?,
|
301
|
+
value-text-list
|
302
|
+
}
|
303
|
+
|
304
|
+
# 6.7.2
|
305
|
+
property-note = element note {
|
306
|
+
element parameters { param-language, param-altid, param-pid,
|
307
|
+
param-pref, param-type }?,
|
308
|
+
value-text
|
309
|
+
}
|
310
|
+
|
311
|
+
# 6.7.3
|
312
|
+
property-prodid = element prodid { value-text }
|
313
|
+
|
314
|
+
# 6.7.4
|
315
|
+
property-rev = element rev { value-timestamp }
|
316
|
+
|
317
|
+
# 6.7.5
|
318
|
+
property-sound = element sound {
|
319
|
+
element parameters { param-language, param-altid, param-pid,
|
320
|
+
param-pref, param-type, param-mediatype }?,
|
321
|
+
value-uri
|
322
|
+
}
|
323
|
+
|
324
|
+
# 6.7.6
|
325
|
+
property-uid = element uid { value-uri }
|
326
|
+
|
327
|
+
# 6.7.7
|
328
|
+
property-clientpidmap = element clientpidmap {
|
329
|
+
element sourceid { xsd:positiveInteger },
|
330
|
+
value-uri
|
331
|
+
}
|
332
|
+
|
333
|
+
# 6.7.8
|
334
|
+
property-url = element url {
|
335
|
+
element parameters { param-altid, param-pid, param-pref,
|
336
|
+
param-type, param-mediatype }?,
|
337
|
+
value-uri
|
338
|
+
}
|
339
|
+
|
340
|
+
# 6.8.1
|
341
|
+
property-key = element key {
|
342
|
+
element parameters { param-altid, param-pid, param-pref,
|
343
|
+
param-type, param-mediatype }?,
|
344
|
+
(value-uri | value-text)
|
345
|
+
}
|
346
|
+
|
347
|
+
# 6.9.1
|
348
|
+
property-fburl = element fburl {
|
349
|
+
element parameters { param-altid, param-pid, param-pref,
|
350
|
+
param-type, param-mediatype }?,
|
351
|
+
value-uri
|
352
|
+
}
|
353
|
+
|
354
|
+
# 6.9.2
|
355
|
+
property-caladruri = element caladruri {
|
356
|
+
element parameters { param-altid, param-pid, param-pref,
|
357
|
+
param-type, param-mediatype }?,
|
358
|
+
value-uri
|
359
|
+
}
|
360
|
+
|
361
|
+
# 6.9.3
|
362
|
+
property-caluri = element caluri {
|
363
|
+
element parameters { param-altid, param-pid, param-pref,
|
364
|
+
param-type, param-mediatype }?,
|
365
|
+
value-uri
|
366
|
+
}
|
367
|
+
|
368
|
+
# Top-level grammar
|
369
|
+
property = property-adr | property-anniversary | property-bday
|
370
|
+
| property-caladruri | property-caluri | property-categories
|
371
|
+
| property-clientpidmap | property-email | property-fburl
|
372
|
+
| property-fn | property-geo | property-impp | property-key
|
373
|
+
| property-kind | property-lang | property-logo
|
374
|
+
| property-member | property-n | property-nickname
|
375
|
+
| property-note | property-org | property-photo
|
376
|
+
| property-prodid | property-related | property-rev
|
377
|
+
| property-role | property-gender | property-sound
|
378
|
+
| property-source | property-tel | property-title
|
379
|
+
| property-tz | property-uid | property-url
|
380
|
+
start = element vcards {
|
381
|
+
element vcard {
|
382
|
+
(property
|
383
|
+
| element group {
|
384
|
+
attribute name { text },
|
385
|
+
property*
|
386
|
+
})+
|
387
|
+
}+
|
388
|
+
}
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'minitest/autorun'
|
3
|
+
|
4
|
+
# # Extend the matchers
|
5
|
+
# require 'rspec/expectations'
|
6
|
+
# RSpec::Matchers.define :vobject_eq do |expected|
|
7
|
+
#
|
8
|
+
# # This method tests wether two vcards or icalendar objects are
|
9
|
+
# # semantically identical.
|
10
|
+
# #
|
11
|
+
# # It supports objects being supplied as strings, streams or
|
12
|
+
# # Sabre\VObject\Component instances.
|
13
|
+
# #
|
14
|
+
# # PRODID is removed from both objects as this is often changes and would
|
15
|
+
# # just get in the way.
|
16
|
+
# #
|
17
|
+
# # CALSCALE will automatically get removed if it's set to GREGORIAN.
|
18
|
+
# #
|
19
|
+
# # @param resource|string|Component expected
|
20
|
+
# # @param resource|string|Component actual
|
21
|
+
# # @param string message
|
22
|
+
# self.obj = lambda do |input|
|
23
|
+
# if input.respond_to?(:readlines)
|
24
|
+
# input = input.readlines.join("\n")
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# if input.is_a?(String)
|
28
|
+
# input = Tilia::VObject::Reader.read(input)
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# unless input.is_a?(Tilia::VObject::Component)
|
32
|
+
# fail ArgumentError, 'Input must be a string, stream or VObject component'
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# input.delete('PRODID')
|
36
|
+
# if input.is_a?(Tilia::VObject::Component::VCalendar) && input['CALSCALE'].to_s == 'GREGORIAN'
|
37
|
+
# input.delete('CALSCALE')
|
38
|
+
# end
|
39
|
+
# input
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# expected = self.obj.call(expected)
|
43
|
+
# match do |actual|
|
44
|
+
# actual = self.obj.call(actual)
|
45
|
+
# actual.serialize == expected.serialize
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# failure_message do |actual|
|
49
|
+
# ">>> expected:\n#{expected.serialize}\n<<<\n>>> got:\n#{actual.serialize}\n<<<"
|
50
|
+
# end
|
51
|
+
# end
|
52
|
+
|
53
|
+
# require our lib
|
54
|
+
require 'tilia/vobject'
|
55
|
+
|
56
|
+
Time.zone = 'UTC'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Tilia
|
4
|
+
module VObject
|
5
|
+
class AttachIssueTest < Minitest::Test
|
6
|
+
def test_read
|
7
|
+
event = <<ICS
|
8
|
+
BEGIN:VCALENDAR\r
|
9
|
+
BEGIN:VEVENT\r
|
10
|
+
ATTACH;FMTTYPE=;ENCODING=:Zm9v\r
|
11
|
+
END:VEVENT\r
|
12
|
+
END:VCALENDAR\r
|
13
|
+
ICS
|
14
|
+
obj = Tilia::VObject::Reader.read(event)
|
15
|
+
assert_equal(event, obj.serialize)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|