vpim 0.619 → 0.658

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -840,5 +840,134 @@ END:VCARD
840
840
  utf_name_test(le(dat.downcase))
841
841
  end
842
842
 
843
+ # Broken output from Highrise. Report to support@highrisehq.com
844
+ def test_highrises_invalid_google_talk_field
845
+ c = <<'__'
846
+ BEGIN:VCARD
847
+ VERSION:3.0
848
+ REV:20080409T095515Z
849
+ X-YAHOO;TYPE=HOME:yahoo.john
850
+ X-GOOGLE TALK;TYPE=WORK:gtalk.john
851
+ X-SAMETIME;TYPE=WORK:sametime.john
852
+ X-SKYPE;TYPE=WORK:skype.john
853
+ X-MSN;TYPE=WORK:msn.john
854
+ X-JABBER;TYPE=WORK:jabber.john
855
+ N:Doe;John;;;
856
+ ADR;TYPE=WORK:;;456 Grandview Building\, Wide Street;San Diego;CA;90204;
857
+ United States
858
+ ADR;TYPE=HOME:;;123 Sweet Home\, Narrow Street;New York;NY;91102;United
859
+ States
860
+ URL;TYPE=OTHER:http\://www.homepage.com
861
+ URL;TYPE=HOME:http\://www.home.com
862
+ URL;TYPE=WORK:http\://www.work.com
863
+ URL;TYPE=OTHER:http\://www.other.com
864
+ URL;TYPE=OTHER:http\://www.custom.com
865
+ ORG:John Doe & Partners Limited;;
866
+ TEL;TYPE=WORK:11111111
867
+ TEL;TYPE=CELL:22222222
868
+ TEL;TYPE=HOME:33333333
869
+ TEL;TYPE=OTHER:44444444
870
+ TEL;TYPE=FAX:55555555
871
+ TEL;TYPE=FAX:66666666
872
+ TEL;TYPE=PAGER:77777777
873
+ TEL;TYPE=OTHER:88888888
874
+ TEL;TYPE=OTHER:99999999
875
+ UID:cc548e11-569e-3bf5-a9aa-722de4571f4a
876
+ X-ICQ;TYPE=HOME:icq.john
877
+ EMAIL;TYPE=WORK,INTERNET:john.doe@work.com
878
+ EMAIL;TYPE=HOME,INTERNET:john.doe@home.com
879
+ EMAIL;TYPE=OTHER,INTERNET:john.doe@other.com
880
+ EMAIL;TYPE=OTHER,INTERNET:john.doe@custom.com
881
+ TITLE:Sales Manager
882
+ X-OTHER;TYPE=WORK:other.john
883
+ X-AIM;TYPE=WORK:aim.john
884
+ X-QQ;TYPE=WORK:qq.john
885
+ FN:John Doe
886
+ END:VCARD
887
+ __
888
+
889
+ card = Vpim::Vcard.decode(c).first
890
+ assert_equal("Doe", card.name.family)
891
+ assert_equal("456 Grandview Building, Wide Street", card.address('work').street)
892
+ assert_equal("123 Sweet Home, Narrow Street", card.address('home').street)
893
+ assert_equal("John Doe & Partners Limited", card.org.first)
894
+ assert_equal("gtalk.john", card.value("x-google talk"))
895
+ assert_equal("http\\://www.homepage.com", card.url.uri)
896
+
897
+ end
898
+
899
+ def _test_gmail_vcard_export
900
+ # GOOGLE BUG - Whitespace before the LABEL field values is a broken
901
+ # line continuation.
902
+ # GOOGLE BUG - vCards are being exported with embedded "=" in them, so
903
+ # become unparseable.
904
+ c = <<'__'
905
+ BEGIN:VCARD
906
+ VERSION:3.0
907
+ FN:Stepcase TestUser
908
+ N:TestUser;Stepcase;;;
909
+ EMAIL;TYPE=INTERNET:testuser@stepcase.com
910
+ X-GTALK:gtalk.step
911
+ X-AIM:aim.step
912
+ X-YAHOO:yahoo.step
913
+ X-MSN:msn.step
914
+ X-ICQ:icq.step
915
+ X-JABBER:jabber.step
916
+ TEL;TYPE=FAX:44444444
917
+ TEL;TYPE=PAGER:66666666
918
+ TEL;TYPE=HOME:22222222
919
+ TEL;TYPE=CELL:11111111
920
+ TEL;TYPE=FAX:55555555
921
+ TEL;TYPE=WORK:33333333
922
+ LABEL;TYPE=HOME;ENCODING=QUOTED-PRINTABLE:123 Home, Home Street=0D=0A=
923
+ Kowloon, N/A=0D=0A=
924
+ Hong Kong
925
+ LABEL;TYPE=HOME;ENCODING=QUOTED-PRINTABLE:321 Office, Work Road=0D=0A=
926
+ Tsuen Wan NT=0D=0A=
927
+ Hong Kong
928
+ TITLE:CTO
929
+ ORG:Stepcase.com
930
+ NOTE:Stepcase test user is a robot.
931
+ END:VCARD
932
+ __
933
+ card = Vpim::Vcard.decode(c).first
934
+ assert_equal("123 Home, Home Street\r\n Kowloon, N/A\r\n Hong Kong", card.value("label"))
935
+ end
936
+
937
+ def test_title
938
+ title = "She Who Must Be Obeyed"
939
+ card = Vpim::Vcard::Maker.make2 do |m|
940
+ m.name do |n|
941
+ n.given = "Hilda"
942
+ n.family = "Rumpole"
943
+ end
944
+ m.title = title
945
+ end
946
+ assert_equal(title, card.title)
947
+ card = Vpim::Vcard.decode(card.encode).first
948
+ assert_equal(title, card.title)
949
+ end
950
+
951
+ def _test_org(*org)
952
+ card = Vpim::Vcard::Maker.make2 do |m|
953
+ m.name do |n|
954
+ n.given = "Hilda"
955
+ n.family = "Rumpole"
956
+ end
957
+ m.org = org
958
+ end
959
+ assert_equal(org, card.org)
960
+ card = Vpim::Vcard.decode(card.encode).first
961
+ assert_equal(org, card.org)
962
+ end
963
+
964
+ def test_org_single
965
+ _test_org("Megamix Corp.")
966
+ end
967
+
968
+ def test_org_multiple
969
+ _test_org("Megamix Corp.", "Marketing")
970
+ end
971
+
843
972
  end
844
973
 
@@ -0,0 +1,79 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'test/unit'
4
+
5
+ require 'vpim/repo'
6
+ require 'vpim/view'
7
+
8
+ class TestView < Test::Unit::TestCase
9
+ View = Vpim::View
10
+ Icalendar = Vpim::Icalendar
11
+
12
+ def _test_week_events(vc, kind)
13
+ vc = Icalendar.decode(vc.to_s.gsub("EVENT", kind)).first
14
+
15
+ vv = View.week vc
16
+
17
+ reader = kind.downcase + "s"
18
+
19
+ kind = "check against kind=" + kind + "<\n" + vv.to_s + ">\n"
20
+
21
+ assert_no_match(/yesterday/, vv.to_s, kind)
22
+ assert_no_match(/nextweek/, vv.to_s, kind)
23
+
24
+ assert_equal(["starts tomorrow"], vv.send(reader).map{|ve| ve.summary}, kind)
25
+ end
26
+
27
+ def test_week_single
28
+ now = Time.now
29
+ yesterday = now - View::SECSPERDAY
30
+ tomorrow = now + View::SECSPERDAY
31
+ nextweek = now + View::SECSPERDAY * 8
32
+
33
+ vc = Icalendar.create2 do |vc|
34
+ %w{yesterday tomorrow nextweek}.each do |dtstart|
35
+ vc.add_event do |ve|
36
+ ve.dtstart eval(dtstart)
37
+ ve.summary "starts #{dtstart}"
38
+ end
39
+ end
40
+ end
41
+
42
+ _test_week_events(vc, "EVENT")
43
+ _test_week_events(vc, "TODO")
44
+ _test_week_events(vc, "JOURNAL")
45
+ end
46
+
47
+ def test_week_recurring
48
+ now = Time.now
49
+ ago = now - View::SECSPERDAY * 2
50
+
51
+ vc = Icalendar.create2 do |vc|
52
+ vc.add_event do |ve|
53
+ ve.dtstart ago
54
+ ve.dtend ago + View::SECSPERDAY / 2
55
+ ve.add_rrule do |r|
56
+ r.frequency = "daily"
57
+ end
58
+ end
59
+ end
60
+
61
+ vv = View.week vc
62
+
63
+ assert_equal(1, vv.events.to_a.size)
64
+
65
+ ve = vv.events{|e| break e}
66
+
67
+ #p ve
68
+
69
+ #puts "now=" + now.to_s
70
+
71
+ ve.occurrences() do |t|
72
+ p [now, t, t + ve.duration]
73
+ end
74
+
75
+
76
+
77
+ end
78
+ end
79
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vpim
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.619"
4
+ version: "0.658"
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Roberts
@@ -9,18 +9,10 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-03-30 00:00:00 -07:00
12
+ date: 2008-08-14 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: plist
17
- version_requirement:
18
- version_requirements: !ruby/object:Gem::Requirement
19
- requirements:
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: "0"
23
- version:
14
+ dependencies: []
15
+
24
16
  description: This is a pure-ruby library for decoding and encoding vCard and iCalendar data ("personal information") called vPim.
25
17
  email: vieuxtech@gmail.com
26
18
  executables:
@@ -34,6 +26,13 @@ extra_rdoc_files:
34
26
  - COPYING
35
27
  - samples/README.mutt
36
28
  files:
29
+ - lib/atom/pub.rb
30
+ - lib/atom/version.rb
31
+ - lib/atom/xml/parser.rb
32
+ - lib/atom.rb
33
+ - lib/plist/generator.rb
34
+ - lib/plist/parser.rb
35
+ - lib/plist.rb
37
36
  - lib/vpim/address.rb
38
37
  - lib/vpim/attachment.rb
39
38
  - lib/vpim/date.rb
@@ -56,6 +55,7 @@ files:
56
55
  - lib/vpim/vcard.rb
57
56
  - lib/vpim/version.rb
58
57
  - lib/vpim/vevent.rb
58
+ - lib/vpim/view.rb
59
59
  - lib/vpim/vjournal.rb
60
60
  - lib/vpim/vpim.rb
61
61
  - lib/vpim/vtodo.rb
@@ -86,8 +86,10 @@ files:
86
86
  - test/test_dur.rb
87
87
  - test/test_field.rb
88
88
  - test/test_ical.rb
89
+ - test/test_repo.rb
89
90
  - test/test_rrule.rb
90
91
  - test/test_vcard.rb
92
+ - test/test_view.rb
91
93
  - COPYING
92
94
  - README
93
95
  - CHANGES
@@ -123,5 +125,7 @@ test_files:
123
125
  - test/test_dur.rb
124
126
  - test/test_field.rb
125
127
  - test/test_ical.rb
128
+ - test/test_repo.rb
126
129
  - test/test_rrule.rb
127
130
  - test/test_vcard.rb
131
+ - test/test_view.rb