jobparser 0.8.0 → 0.9.0

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.
@@ -1,18 +1,37 @@
1
1
  # encoding: utf-8
2
+ require "active_support/core_ext/string/inflections.rb"
2
3
  module JobParser
3
4
  class ParseSchema < Parser
4
5
 
6
+ EXTRA_SCHEMA_TEXT_FIELDS = %w{
7
+ benefits educationRequirements incentives industry
8
+ occupationalCategory qualifications responsibilities skills specialCommitments workHours
9
+ }
10
+
11
+ EXTRA_SCHEMA_TEXT_FIELDS.each do |field|
12
+ define_method("job_#{field.underscore}") {
13
+ get_content_at_prop(field)
14
+ }
15
+
16
+ private "job_#{field.underscore}".to_sym
17
+ end
18
+
5
19
  def initialize(html, from_url)
6
20
  Parser::ACCEPTED_ELEMENTS.push("span")
7
21
  super(html, from_url)
8
22
  end
23
+
9
24
  def job
10
25
  res = super
11
26
  res[:schema] = true
12
- res[:benefits] = job_benefits
13
- res[:education_requirements] = job_education_requirements
27
+ EXTRA_SCHEMA_TEXT_FIELDS.each do |field|
28
+ underscore_name = field.underscore.to_sym
29
+ result = send("job_#{underscore_name}")
30
+ res[underscore_name] = result unless result.nil?
31
+ end
14
32
  res
15
33
  end
34
+
16
35
  private
17
36
 
18
37
  def job_salary
@@ -30,14 +49,6 @@ module JobParser
30
49
  Facets::Apply.new(@doc, @url, @plain_text).parse
31
50
  end
32
51
 
33
- def job_benefits
34
- get_content_at_prop("benefits")
35
- end
36
-
37
- def job_education_requirements
38
- get_content_at_prop("educationRequirements")
39
- end
40
-
41
52
  def job_salary_string
42
53
  get_content_at_prop("baseSalary")
43
54
  end
@@ -1,3 +1,3 @@
1
1
  module JobParser
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-07 00:00:00.000000000 Z
12
+ date: 2013-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -123,6 +123,22 @@ dependencies:
123
123
  - - ! '>='
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: activesupport
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :runtime
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
126
142
  description: A parser for Job sites
127
143
  email:
128
144
  - jack@jackfranklin.net