resume_exporter 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,178 @@
1
+ module Extractor
2
+ class JsonResume
3
+ def initialize(doc)
4
+ @doc = doc
5
+ end
6
+
7
+ def meta
8
+ {
9
+ version: @doc.dig(:meta, :version)
10
+ }
11
+ end
12
+
13
+ def basics
14
+ {
15
+ name: @doc.dig(:basics, :name),
16
+ label: @doc.dig(:basics, :label),
17
+ image: @doc.dig(:basics, :image),
18
+ summary: @doc.dig(:basics, :summary),
19
+ location: @doc.dig(:basics, :location),
20
+ contact: {
21
+ email: @doc.dig(:basics, :email),
22
+ phone: @doc.dig(:basics, :phone),
23
+ website: @doc.dig(:basics, :url),
24
+ location: @doc.dig(:basics, :location, :address),
25
+ social: @doc.dig(:basics, :profiles).map do |p|
26
+ {
27
+ network: p[:network],
28
+ user: p[:username],
29
+ url: p[:url]
30
+ }
31
+ end
32
+ }
33
+ }
34
+ end
35
+
36
+ def employment
37
+ {
38
+ history: @doc.dig(:work).map do |job|
39
+ {
40
+ employer: job[:name],
41
+ position: job[:position],
42
+ description: job[:description],
43
+ url: job[:url],
44
+ startDate: job[:startDate],
45
+ endDate: job[:endDate],
46
+ summary: job[:summary],
47
+ highlights: job[:highlights]
48
+ }
49
+ end
50
+ }
51
+ end
52
+
53
+ def education
54
+ {
55
+ history: @doc.dig(:education).map do |education|
56
+ {
57
+ institution: education[:institution],
58
+ fieldOfStudy: education[:area],
59
+ degree: education[:studyType],
60
+ startDate: education[:startDate],
61
+ endDate: education[:endDate],
62
+ grade: education[:gpa],
63
+ curriculum: education[:courses]
64
+ }
65
+ end
66
+ }
67
+ end
68
+
69
+ def projects
70
+ {
71
+ history: @doc.dig(:projects).map do |project|
72
+ {
73
+ title: project[:name],
74
+ description: project[:description],
75
+ url: project[:url],
76
+ startDate: project[:startDate],
77
+ endDate: project[:endDate],
78
+ roles: project[:roles],
79
+ category: project[:type],
80
+ entity: project[:entity],
81
+ highlights: project[:highlights],
82
+ keywords: project[:keywords]
83
+ }
84
+ end
85
+ }
86
+ end
87
+
88
+ def skills
89
+ {
90
+ sets: @doc.dig(:skills).map do |skill|
91
+ {
92
+ name: skill[:name],
93
+ level: skill[:level],
94
+ keywords: skill[:keywords]
95
+ }
96
+ end
97
+ }
98
+ end
99
+
100
+ def recognition
101
+ {
102
+ history: @doc.dig(:awards).map do |award|
103
+ {
104
+ title: award[:title],
105
+ category: "Award",
106
+ startDate: award[:date],
107
+ from: award[:awarder],
108
+ summary: award[:summary]
109
+ }
110
+ end
111
+ }
112
+ end
113
+
114
+ def writing
115
+ {
116
+ history: @doc.dig(:publications).map do |publication|
117
+ {
118
+ title: publication[:name],
119
+ publisher: publication[:publisher],
120
+ date: publication[:releaseDate],
121
+ url: publication[:url],
122
+ summary: publication[:summary]
123
+ }
124
+ end
125
+ }
126
+ end
127
+
128
+ def languages
129
+ {
130
+ list: @doc.dig(:languages).map do |language|
131
+ {
132
+ language: language[:language],
133
+ level: language[:fluency]
134
+ }
135
+ end
136
+ }
137
+ end
138
+
139
+ def interests
140
+ {
141
+ list: @doc.dig(:interests).map do |interest|
142
+ {
143
+ name: interest[:name],
144
+ keywords: interest[:keywords]
145
+ }
146
+ end
147
+ }
148
+ end
149
+
150
+ def service
151
+ {
152
+ history: @doc.dig(:volunteer).map do |volunteer|
153
+ {
154
+ category: "Volunteer Work",
155
+ organization: volunteer[:organization],
156
+ roles: [volunteer[:position]],
157
+ url: volunteer[:url],
158
+ startDate: volunteer[:startDate],
159
+ endDate: volunteer[:endDate],
160
+ summary: volunteer[:summary],
161
+ highlights: volunteer[:highlights]
162
+ }
163
+ end
164
+ }
165
+ end
166
+
167
+ def references
168
+ {
169
+ history: @doc.dig(:references).map do |reference|
170
+ {
171
+ name: reference[:name],
172
+ summary: reference[:reference]
173
+ }
174
+ end
175
+ }
176
+ end
177
+ end
178
+ end
@@ -0,0 +1,91 @@
1
+ module Extractor
2
+ class Prtflio
3
+ def initialize(doc)
4
+ @doc = doc
5
+ end
6
+
7
+ def meta
8
+ @doc.dig(:meta)
9
+ end
10
+
11
+ def basics
12
+ @doc.dig(:basics)
13
+ end
14
+
15
+ def employment
16
+ @doc.dig(:employment)
17
+ end
18
+
19
+ def education
20
+ @doc.dig(:education)
21
+ end
22
+
23
+ def projects
24
+ @doc.dig(:projects)
25
+ end
26
+
27
+ def openSource
28
+ @doc.dig(:openSource)
29
+ end
30
+
31
+ def skills
32
+ @doc.dig(:skills)
33
+ end
34
+
35
+ def qualifications
36
+ @doc.dig(:qualifications)
37
+ end
38
+
39
+ def recognition
40
+ @doc.dig(:recognition)
41
+ end
42
+
43
+ def writing
44
+ @doc.dig(:writing)
45
+ end
46
+
47
+ def reading
48
+ @doc.dig(:reading)
49
+ end
50
+
51
+ def speaking
52
+ @doc.dig(:speaking)
53
+ end
54
+
55
+ def patents
56
+ @doc.dig(:patents)
57
+ end
58
+
59
+ def languages
60
+ @doc.dig(:languages)
61
+ end
62
+
63
+ def interests
64
+ @doc.dig(:interests)
65
+ end
66
+
67
+ def extracurriculars
68
+ @doc.dig(:extracurriculars)
69
+ end
70
+
71
+ def affiliations
72
+ @doc.dig(:affiliations)
73
+ end
74
+
75
+ def governance
76
+ @doc.dig(:governance)
77
+ end
78
+
79
+ def service
80
+ @doc.dig(:service)
81
+ end
82
+
83
+ def references
84
+ @doc.dig(:references)
85
+ end
86
+
87
+ def disposition
88
+ @doc.dig(:disposition)
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,40 @@
1
+ require "extractors/factory"
2
+ require "exporters/json"
3
+ require "exporters/xml"
4
+ require "exporters/md"
5
+ require "exporters/txt"
6
+ require "exporters/yaml"
7
+
8
+ class ResumeExporter
9
+ def initialize(input)
10
+ if input.is_a?(String) || input.is_a?(Pathname)
11
+ # TODO: allow Json string
12
+ @data = Extractor::Factory.extractor_for(input).extract
13
+ elsif input.is_a?(Hash)
14
+ @data = input
15
+ end
16
+ end
17
+
18
+ def export(options = {})
19
+ format = options[:format] || "json"
20
+
21
+ case format.downcase
22
+ when "json"
23
+ Exporter::Json.export(data: @data)
24
+ when "fresh", "fresca"
25
+ Exporter::Json.export(data: @data, template: "fresh")
26
+ when "jsonresume", "json_resume", "json-resume"
27
+ Exporter::Json.export(data: @data, template: "json_resume")
28
+ when "xml"
29
+ Exporter::Xml.export(data: @data)
30
+ when "md"
31
+ Exporter::Md.export(data: @data)
32
+ when "yaml"
33
+ Exporter::Yaml.export(data: @data)
34
+ when "txt"
35
+ Exporter::Txt.export(data: @data)
36
+ when "hash"
37
+ @data
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,289 @@
1
+ json.meta do
2
+ json.format "PRTFLIO@0.0.1"
3
+ json.version "0.0.1"
4
+ end
5
+
6
+
7
+ json.basics do
8
+ json.name @data.dig(:basics, :name)
9
+ json.label @data.dig(:basics, :label)
10
+ json.image @data.dig(:basics, :image)
11
+ json.summary @data.dig(:basics, :summary)
12
+ json.contact do
13
+ json.email @data.dig(:basics, :contact, :email)
14
+ json.phone @data.dig(:basics, :contact, :phone)
15
+ json.website @data.dig(:basics, :contact, :website)
16
+ json.location @data.dig(:basics, :contact, :location)
17
+ json.social @data.dig(:basics, :contact, :social) do |social|
18
+ json.network social[:network]
19
+ json.user social[:user]
20
+ json.url social[:url]
21
+ end
22
+ end
23
+ end
24
+
25
+ json.employment do
26
+ json.summary @data.dig(:employment, :summary)
27
+ json.history @data.dig(:employment, :history) do |job|
28
+ json.employer job[:employer]
29
+ json.position job[:position]
30
+ json.url job[:url]
31
+ json.startDate job[:startDate]
32
+ json.endDate job[:endDate]
33
+ json.summary job[:summary]
34
+ json.location job[:location]
35
+ json.highlights job[:highlights]
36
+ json.keywords job[:keywords]
37
+ end
38
+ end
39
+
40
+ json.education do
41
+ json.summary @data.dig(:education, :summary)
42
+ json.history @data.dig(:education, :history) do |entry|
43
+ json.institution entry[:institution]
44
+ json.fieldOfStudy entry[:fieldOfStudy]
45
+ json.degree entry[:degree]
46
+ json.startDate entry[:startDate]
47
+ json.endDate entry[:endDate]
48
+ json.grade entry[:grade]
49
+ json.url entry[:url]
50
+ json.summary entry[:summary]
51
+ json.location entry[:location]
52
+ json.curriculum entry[:curriculum]
53
+ json.highlights entry[:highlights]
54
+ json.keywords entry[:keywords]
55
+ end
56
+ end
57
+
58
+ json.projects do
59
+ json.summary @data.dig(:projects, :summary)
60
+ json.history @data.dig(:projects, :history) do |project|
61
+ json.title project[:title]
62
+ json.description project[:description]
63
+ json.url project[:url]
64
+ json.repo project[:repo]
65
+ json.startDate project[:startDate]
66
+ json.endDate project[:endDate]
67
+ json.category project[:category]
68
+ json.images project[:images] do |image|
69
+ json.thumbnail image[:thumbnail]
70
+ json.big image[:big]
71
+ end
72
+ json.roles project[:roles]
73
+ json.highlights project[:highlights]
74
+ json.keywords project[:keywords]
75
+ end
76
+ end
77
+
78
+ json.openSource do
79
+ json.summary @data.dig(:openSource, :summary)
80
+ json.history @data.dig(:openSource, :history) do |project|
81
+ json.title project[:title]
82
+ json.description project[:description]
83
+ json.role project[:role]
84
+ json.url project[:url]
85
+ json.repo project[:repo]
86
+ json.startDate project[:startDate]
87
+ json.endDate project[:endDate]
88
+ json.category project[:category]
89
+ json.roles project[:roles]
90
+ json.highlights project[:highlights]
91
+ json.keywords project[:keywords]
92
+ end
93
+ end
94
+
95
+ json.skills do
96
+ json.summary @data.dig(:skills, :summary)
97
+ json.sets @data.dig(:skills, :sets) do |skill|
98
+ json.name skill[:name]
99
+ json.description skill[:description]
100
+ json.keywords skill[:keywords]
101
+ end
102
+ end
103
+
104
+ json.qualifications do
105
+ json.summary @data.dig(:qualifications, :summary)
106
+ json.history @data.dig(:qualifications, :history) do |qualification|
107
+ json.category qualification[:category]
108
+ json.title qualification[:title]
109
+ json.startDate qualification[:startDate]
110
+ json.endDate qualification[:endDate]
111
+ json.from qualification[:from]
112
+ json.summary qualification[:summary]
113
+ json.url qualification[:url]
114
+ json.highlights qualification[:highlights]
115
+ json.keywords qualification[:keywords]
116
+ end
117
+ end
118
+
119
+ json.recognition do
120
+ json.summary @data.dig(:recognition, :summary)
121
+ json.history @data.dig(:recognition, :history) do |entry|
122
+ json.category entry[:category]
123
+ json.title entry[:title]
124
+ json.startDate entry[:startDate]
125
+ json.endDate entry[:endDate]
126
+ json.from entry[:from]
127
+ json.summary entry[:summary]
128
+ json.url entry[:url]
129
+ json.highlights entry[:highlights]
130
+ json.keywords entry[:keywords]
131
+ end
132
+ end
133
+
134
+ json.writing do
135
+ json.summary @data.dig(:writing, :summary)
136
+ json.history @data.dig(:writing, :history) do |entry|
137
+ json.title entry[:title]
138
+ json.category entry[:category]
139
+ json.publisher entry[:publisher]
140
+ json.date entry[:date]
141
+ json.url entry[:url]
142
+ json.summary entry[:summary]
143
+ json.highlights entry[:highlights]
144
+ json.keywords entry[:keywords]
145
+ end
146
+ end
147
+
148
+ json.reading do
149
+ json.summary @data.dig(:reading, :summary)
150
+ json.history @data.dig(:reading, :history) do |entry|
151
+ json.title entry[:title]
152
+ json.category entry[:category]
153
+ json.url entry[:url]
154
+ json.author entry[:author]
155
+ json.date entry[:date]
156
+ json.summary entry[:summary]
157
+ json.highlights entry[:highlights]
158
+ json.keywords entry[:keywords]
159
+ end
160
+ end
161
+
162
+ json.speaking do
163
+ json.summary @data.dig(:speaking, :summary)
164
+ json.history @data.dig(:speaking, :history) do |entry|
165
+ json.title entry[:title]
166
+ json.event entry[:event]
167
+ json.location entry[:location]
168
+ json.url entry[:url]
169
+ json.date entry[:date]
170
+ json.summary entry[:summary]
171
+ json.highlights entry[:highlights]
172
+ json.keywords entry[:keywords]
173
+ end
174
+ end
175
+
176
+ json.patents do
177
+ json.summary @data.dig(:patents, :summary)
178
+ json.history @data.dig(:patents, :history) do |patent|
179
+ json.title patent[:title]
180
+ json.url patent[:url]
181
+ json.number patent[:number]
182
+ json.status patent[:status]
183
+ json.description patent[:description]
184
+ json.date patent[:date]
185
+ json.highlights patent[:highlights]
186
+ json.keywords patent[:keywords]
187
+ end
188
+ end
189
+
190
+ json.languages do
191
+ json.summary @data.dig(:languages, :summary)
192
+ json.list @data.dig(:languages, :list) do |language|
193
+ json.language language[:language]
194
+ json.level language[:level]
195
+ json.years language[:years]
196
+ end
197
+ end
198
+
199
+ json.interests do
200
+ json.summary @data.dig(:interests, :summary)
201
+ json.list @data.dig(:interests, :list) do |interest|
202
+ json.name interest[:name]
203
+ json.description interest[:description]
204
+ end
205
+ end
206
+
207
+ json.extracurriculars do
208
+ json.summary @data.dig(:extracurriculars, :summary)
209
+ json.history @data.dig(:extracurriculars, :history) do |entry|
210
+ json.title entry[:title]
211
+ json.summary entry[:summary]
212
+ json.category entry[:category]
213
+ json.url entry[:url]
214
+ json.location entry[:location]
215
+ json.startDate entry[:startDate]
216
+ json.endDate entry[:endDate]
217
+ json.highlights entry[:highlights]
218
+ json.keywords entry[:keywords]
219
+ end
220
+ end
221
+
222
+ json.affiliations do
223
+ json.summary @data.dig(:affiliations, :summary)
224
+ json.history @data.dig(:affiliations, :history) do |entry|
225
+ json.category entry[:category]
226
+ json.organization entry[:organization]
227
+ json.roles entry[:roles]
228
+ json.url entry[:url]
229
+ json.startDate entry[:startDate]
230
+ json.endDate entry[:endDate]
231
+ json.summary entry[:summary]
232
+ json.location entry[:location]
233
+ json.highlights entry[:highlights]
234
+ json.keywords entry[:keywords]
235
+ end
236
+ end
237
+
238
+ json.governance do
239
+ json.summary @data.dig(:governance, :summary)
240
+ json.history @data.dig(:governance, :history) do |entry|
241
+ json.summary entry[:summary]
242
+ json.category entry[:category]
243
+ json.url entry[:url]
244
+ json.roles entry[:roles]
245
+ json.organization entry[:organization]
246
+ json.startDate entry[:startDate]
247
+ json.endDate entry[:endDate]
248
+ json.keywords entry[:keywords]
249
+ json.highlights entry[:highlights]
250
+ end
251
+ end
252
+
253
+ json.service do
254
+ json.summary @data.dig(:service, :summary)
255
+ json.history @data.dig(:service, :history) do |entry|
256
+ json.category entry[:category]
257
+ json.organization entry[:organization]
258
+ json.roles entry[:roles]
259
+ json.url entry[:url]
260
+ json.startDate entry[:startDate]
261
+ json.endDate entry[:endDate]
262
+ json.summary entry[:summary]
263
+ json.location entry[:location]
264
+ json.highlights entry[:highlights]
265
+ json.keywords entry[:keywords]
266
+ end
267
+ end
268
+
269
+ json.references do
270
+ json.summary @data.dig(:references, :summary)
271
+ json.history @data.dig(:references, :history) do |reference|
272
+ json.name reference[:name]
273
+ json.role reference[:role]
274
+ json.company reference[:company]
275
+ json.summary reference[:summary]
276
+ end
277
+ end
278
+
279
+ json.disposition do
280
+ json.summary @data.dig(:disposition, :summary)
281
+ json.travel @data.dig(:disposition, :travel)
282
+ json.authorization @data.dig(:disposition, :authorization)
283
+ json.commitment @data.dig(:disposition, :commitment)
284
+ json.remote @data.dig(:disposition, :remote)
285
+ json.relocation do
286
+ json.willing @data.dig(:disposition, :relocation, :willing)
287
+ json.destinations @data.dig(:disposition, :relocation, :destinations)
288
+ end
289
+ end