jobparser 0.11.0 → 0.12.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.
- data/lib/jobparser/cache/mongostore.rb +21 -1
- data/lib/jobparser/parseschema.rb +1 -1
- data/lib/jobparser/version.rb +1 -1
- metadata +1 -1
@@ -9,7 +9,8 @@ module JobParser
|
|
9
9
|
|
10
10
|
def store(hash)
|
11
11
|
Job.where(:url => hash[:url]).delete
|
12
|
-
|
12
|
+
hash = strip_job_fields(hash)
|
13
|
+
Job.create(hash)
|
13
14
|
end
|
14
15
|
|
15
16
|
def cache_expired?(url)
|
@@ -41,6 +42,14 @@ module JobParser
|
|
41
42
|
include Mongoid::Document
|
42
43
|
include Mongoid::Timestamps
|
43
44
|
|
45
|
+
EXTRA_SCHEMA_TEXT_FIELDS = %w{
|
46
|
+
benefits education_requirements incentives industry
|
47
|
+
occupational_category qualifications responsibilities skills special_commitments work_hours
|
48
|
+
}
|
49
|
+
EXTRA_SCHEMA_TEXT_FIELDS.each do |f|
|
50
|
+
field f.to_sym, :type => String
|
51
|
+
end
|
52
|
+
|
44
53
|
field :url, :type => String
|
45
54
|
field :salary, :type => Array
|
46
55
|
field :title, :type => String
|
@@ -48,6 +57,17 @@ module JobParser
|
|
48
57
|
field :salary_string, :type => String
|
49
58
|
field :location, :type => String
|
50
59
|
field :deadline, :type => String
|
60
|
+
field :schema, :type => Boolean, :default => false
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def strip_job_fields(hash)
|
67
|
+
new_hash = {}
|
68
|
+
excluded_fields = [:from_cache]
|
69
|
+
hash.each { |k, v| new_hash[k] = v unless excluded_fields.include?(k) }
|
70
|
+
new_hash
|
51
71
|
end
|
52
72
|
|
53
73
|
end
|
@@ -35,7 +35,7 @@ module JobParser
|
|
35
35
|
EXTRA_SCHEMA_TEXT_FIELDS.each do |field|
|
36
36
|
underscore_name = underscore(field).to_sym
|
37
37
|
result = send("job_#{underscore_name}")
|
38
|
-
res[underscore_name] = result unless result.nil?
|
38
|
+
res[underscore_name] = result unless result.nil? || result.empty?
|
39
39
|
end
|
40
40
|
end
|
41
41
|
cache(res)
|
data/lib/jobparser/version.rb
CHANGED