simplevpim 0.5.0 → 0.5.4
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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/simplevpim.rb +91 -10
- data.tar.gz.sig +0 -0
- metadata +25 -4
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c64a906a46262925ae97e53b4183fa9676e84203993cf25b06853f7a031b873
|
4
|
+
data.tar.gz: e5339040fa708cffaad3a5798ff77bf742ddace8d4664ce2b52cfd1a7ab339e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 348c5891cbc99b82be316829e787a3ffd4225981be0ae35bafaad28e6e7f49dcc122e448f4cd30e9cfb843ac3ff239a4000c1d1d23ab309747bf6dd9062c5bfd
|
7
|
+
data.tar.gz: bc0068f15c03f2416a47f6b46769c7878d804029c7441315eac3b288a84cbd8d1a7d4c928b1de21f00cf8491246e6781ca331867c169ad4f2c9cfbfc5c1204a3
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/simplevpim.rb
CHANGED
@@ -11,20 +11,53 @@ require 'unichron'
|
|
11
11
|
|
12
12
|
|
13
13
|
class SimpleVpim
|
14
|
+
using ColouredText
|
14
15
|
|
15
16
|
attr_reader :to_vcard, :to_vevent, :to_xml
|
17
|
+
|
18
|
+
a = %i(firstname lastname name tel addr email)
|
19
|
+
Contact = Struct.new(*a)
|
20
|
+
Event = Struct.new(*%i(title summary start end location description))
|
21
|
+
|
22
|
+
def initialize(rawobj, debug: false)
|
23
|
+
|
24
|
+
@debug = debug
|
16
25
|
|
17
|
-
|
26
|
+
obj = if block_given? then
|
27
|
+
|
28
|
+
if rawobj == :event then
|
29
|
+
|
30
|
+
e = Event.new
|
31
|
+
yield e
|
32
|
+
e.to_h
|
33
|
+
|
34
|
+
elsif rawobj == :contact then
|
18
35
|
|
19
|
-
|
36
|
+
puts 'inside contact' if @debug
|
37
|
+
c = Contact.new
|
38
|
+
yield c
|
39
|
+
c.to_h
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
else
|
44
|
+
|
45
|
+
rawobj
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
puts 'obj: ' + obj.inspect if @debug
|
50
|
+
|
51
|
+
kvx = Kvx.new(obj, debug: false)
|
52
|
+
|
20
53
|
@h = kvx.to_h
|
21
54
|
|
22
|
-
if
|
55
|
+
if @h[:name] or @h[:firstname] or @h[:lastname] then
|
23
56
|
|
24
57
|
@to_vcard = make_vcard @h
|
25
58
|
@to_xml = vcard_xml @h
|
26
59
|
|
27
|
-
elsif @h[:
|
60
|
+
elsif @h[:start]
|
28
61
|
|
29
62
|
@to_vevent = make_vevent @h
|
30
63
|
@to_xml = vevent_xml kvx.to_xml
|
@@ -70,6 +103,11 @@ class SimpleVpim
|
|
70
103
|
end
|
71
104
|
|
72
105
|
def make_vcard(h)
|
106
|
+
|
107
|
+
if @debug then
|
108
|
+
puts 'inside make_vcard'.info
|
109
|
+
puts 'h: ' + h.inspect
|
110
|
+
end
|
73
111
|
|
74
112
|
card = Vpim::Vcard::Maker.make2 do |maker|
|
75
113
|
|
@@ -82,8 +120,23 @@ class SimpleVpim
|
|
82
120
|
|
83
121
|
prefix = h[:prefix]
|
84
122
|
suffix = h[:suffix]
|
85
|
-
|
86
|
-
|
123
|
+
|
124
|
+
if h[:name] then
|
125
|
+
|
126
|
+
firstname, middlename, surname, fullname = extract_names(h[:name])
|
127
|
+
|
128
|
+
elsif h[:firstname] or h[:lastname]
|
129
|
+
|
130
|
+
firstname = h[:firstname] if h[:firstname]
|
131
|
+
surname = h[:lastname] if h[:lastname]
|
132
|
+
|
133
|
+
fullname = if h[:fullname] then
|
134
|
+
h[:fullname]
|
135
|
+
else
|
136
|
+
[firstname, surname].compact.join(' ')
|
137
|
+
end
|
138
|
+
|
139
|
+
end
|
87
140
|
|
88
141
|
maker.add_name do |name|
|
89
142
|
name.prefix = prefix if prefix
|
@@ -108,6 +161,17 @@ class SimpleVpim
|
|
108
161
|
maker.add_email(eh) { |e| e.location = 'home' } if eh
|
109
162
|
end
|
110
163
|
end
|
164
|
+
|
165
|
+
|
166
|
+
# -- address ------------------------------
|
167
|
+
|
168
|
+
adr = h[:addr]
|
169
|
+
puts ('adr: ' + adr.inspect).debug if @debug
|
170
|
+
if adr then
|
171
|
+
maker.add_addr do |addr|
|
172
|
+
addr.street = adr
|
173
|
+
end
|
174
|
+
end
|
111
175
|
|
112
176
|
# -- urls ---------------------------------
|
113
177
|
|
@@ -320,12 +384,14 @@ EOF
|
|
320
384
|
end
|
321
385
|
|
322
386
|
def make_xcard(xml)
|
323
|
-
|
324
|
-
lib =
|
325
|
-
xsl =
|
387
|
+
|
388
|
+
lib = File.dirname(__FILE__)
|
389
|
+
xsl = File.read File.join(lib,'xcard.xsl')
|
390
|
+
|
326
391
|
doc = Nokogiri::XML(xml)
|
327
392
|
xslt = Nokogiri::XSLT(xsl)
|
328
393
|
xslt.transform(doc).to_s
|
394
|
+
|
329
395
|
end
|
330
396
|
|
331
397
|
def vcard_xml(h)
|
@@ -333,7 +399,22 @@ EOF
|
|
333
399
|
prefix = h[:prefix]
|
334
400
|
suffix = h[:suffix]
|
335
401
|
|
336
|
-
|
402
|
+
if h[:name] then
|
403
|
+
|
404
|
+
firstname, middlename, surname, fullname = extract_names(h[:name])
|
405
|
+
|
406
|
+
elsif h[:firstname] or h[:lastname]
|
407
|
+
|
408
|
+
firstname = h[:firstname] if h[:firstname]
|
409
|
+
surname = h[:lastname] if h[:lastname]
|
410
|
+
|
411
|
+
fullname = if h[:fullname] then
|
412
|
+
h[:fullname]
|
413
|
+
else
|
414
|
+
[firstname, surname].compact.join(' ')
|
415
|
+
end
|
416
|
+
|
417
|
+
end
|
337
418
|
|
338
419
|
xml = RexleBuilder.new
|
339
420
|
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simplevpim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
dBpGyLXPFeCV5Z8rWY+S891OLL3UPvcmIiolU7aaNSwvXBGLesCCH6TrIdhw4q2z
|
36
36
|
pM4lNlA3G8w+xUHw/9AE8V6p
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2021-
|
38
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: hlt
|
@@ -77,6 +77,26 @@ dependencies:
|
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
79
|
version: 13.11.11
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: unichron
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 0.4.0
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.4'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.4.0
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.4'
|
80
100
|
- !ruby/object:Gem::Dependency
|
81
101
|
name: rexle-builder
|
82
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,8 +143,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
143
|
- !ruby/object:Gem::Version
|
124
144
|
version: '0'
|
125
145
|
requirements: []
|
126
|
-
|
146
|
+
rubyforge_project:
|
147
|
+
rubygems_version: 2.7.10
|
127
148
|
signing_key:
|
128
149
|
specification_version: 4
|
129
|
-
summary: A simple wrapper for the vPim gem
|
150
|
+
summary: A simple wrapper for the vPim gem.
|
130
151
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|