vcard 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6307d7602ea69f08816e8c2666c9768005e37cfc
4
+ data.tar.gz: d04fa18f2746450c6aeaad0b1086622d92659534
5
+ SHA512:
6
+ metadata.gz: 016cabfb8c0234fc6309c3e653d53fe99ecafe5f54e32e264c65d2ebc2be7c6f2eb10eb2c0b4409c84407a9a102ae733868dda0cc0a40dd1b8eee519da9b5e81
7
+ data.tar.gz: 439946643206f6409bd9afdbb452d71cc82682b434df25bc6e71093e17faeca4b5a89d914860cd2153721f5201cfbd01cb4ad3f6e8f728d49660cfb886fc19c6
@@ -531,7 +531,7 @@ module Vcard
531
531
  "TITLE" => :decode_text,
532
532
  "UID" => :decode_text,
533
533
  "URL" => :decode_uri,
534
- "VERSION" => :decode_version,
534
+ "VERSION" => :decode_version
535
535
  }
536
536
 
537
537
  @@decode.default = :decode_default
@@ -950,6 +950,10 @@ module Vcard
950
950
  v
951
951
  end
952
952
 
953
+ def role
954
+ value("ROLE")
955
+ end
956
+
953
957
  # Make changes to a vCard.
954
958
  #
955
959
  # Yields a Vcard::Vcard::Maker that can be used to modify this vCard.
@@ -1314,6 +1318,14 @@ module Vcard
1314
1318
  @card << ::Vcard::DirectoryInfo::Field.create( "ORG", org );
1315
1319
  end
1316
1320
 
1321
+ # Set the role field, ROLE.
1322
+ #
1323
+ # It can be set to a single String.
1324
+ def role=(role)
1325
+ delete_if { |l| l.name == "ROLE" }
1326
+
1327
+ @card << ::Vcard::DirectoryInfo::Field.create( "ROLE", ::Vcard.encode_text(role));
1328
+ end
1317
1329
 
1318
1330
  # Add a URL field, URL.
1319
1331
  def add_url(url)
@@ -1,3 +1,3 @@
1
1
  module Vcard
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -6,4 +6,5 @@ n:Jensen;Bj=F8rn
6
6
  email;type=internet:bjorn@umich.edu
7
7
  tel;type=work,voice,msg:+1 313 747-4454
8
8
  key;type=x509;encoding=B:dGhpcyBjb3VsZCBiZSAKbXkgY2VydGlmaWNhdGUK
9
+ role:Office Manager\;Something Else
9
10
  end:VCARD
@@ -30,6 +30,7 @@ class VcardTest < Test::Unit::TestCase
30
30
  assert_equal("Jensen", card.name.family)
31
31
  assert_equal("Bj=F8rn", card.name.given)
32
32
  assert_equal("", card.name.prefix)
33
+ assert_equal('Office Manager;Something Else', card.role)
33
34
 
34
35
  assert_equal("Bj=F8rn Jensen", card[ "fn" ])
35
36
  assert_equal("+1 313 747-4454", card[ "tEL" ])
@@ -482,4 +483,20 @@ EOF
482
483
  def test_org_multiple
483
484
  _test_org("Megamix Corp.", "Marketing")
484
485
  end
486
+
487
+ def test_role
488
+ role = 'Office Manager;Something Else'
489
+
490
+ card = Vcard::Vcard::Maker.make2 do |m|
491
+ m.name do |n|
492
+ n.given = "John"
493
+ n.family = "Woe"
494
+ end
495
+ m.role = 'Office Manager;Something Else'
496
+ end
497
+ assert_equal(role, card.role)
498
+ assert(card.to_s['Office Manager\;Something Else'])
499
+ card = Vcard::Vcard.decode(card.encode).first
500
+ assert_equal(role, card.role)
501
+ end
485
502
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vcard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
5
- prerelease:
4
+ version: 0.2.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - Kuba Kuźma
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-14 00:00:00.000000000 Z
11
+ date: 2013-06-18 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: Vcard extracted from Vpim
15
14
  email:
@@ -66,27 +65,26 @@ files:
66
65
  - vcard.gemspec
67
66
  homepage: http://github.com/qoobaa/vcard
68
67
  licenses: []
68
+ metadata: {}
69
69
  post_install_message:
70
70
  rdoc_options: []
71
71
  require_paths:
72
72
  - lib
73
73
  required_ruby_version: !ruby/object:Gem::Requirement
74
- none: false
75
74
  requirements:
76
- - - ! '>='
75
+ - - '>='
77
76
  - !ruby/object:Gem::Version
78
77
  version: '0'
79
78
  required_rubygems_version: !ruby/object:Gem::Requirement
80
- none: false
81
79
  requirements:
82
- - - ! '>='
80
+ - - '>='
83
81
  - !ruby/object:Gem::Version
84
82
  version: '0'
85
83
  requirements: []
86
84
  rubyforge_project:
87
- rubygems_version: 1.8.24
85
+ rubygems_version: 2.0.2
88
86
  signing_key:
89
- specification_version: 3
87
+ specification_version: 4
90
88
  summary: Vcard extracted from Vpim
91
89
  test_files:
92
90
  - test/field_test.rb