jobparser 0.13.4 → 0.13.5

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.rb CHANGED
@@ -16,6 +16,7 @@ require "jobparser/facets/location"
16
16
  require "jobparser/facets/apply"
17
17
  require "jobparser/facets/title"
18
18
  require "jobparser/facets/deadline"
19
+ require "jobparser/facets/postcode"
19
20
  require "jobparser/error"
20
21
 
21
22
  require "open-uri"
@@ -61,14 +61,15 @@ module JobParser
61
61
  field f.to_sym, :type => String
62
62
  end
63
63
 
64
- field :url, :type => String
65
- field :salary, :type => Array
66
- field :title, :type => String
67
- field :apply, :type => String
64
+ field :url, :type => String
65
+ field :salary, :type => Array
66
+ field :title, :type => String
67
+ field :apply, :type => String
68
68
  field :salary_string, :type => String
69
- field :location, :type => String
70
- field :deadline, :type => String
71
- field :schema, :type => Boolean, :default => false
69
+ field :location, :type => String
70
+ field :deadline, :type => String
71
+ field :job_postcode, :type => String
72
+ field :schema, :type => Boolean, : default => false
72
73
 
73
74
  end
74
75
 
@@ -0,0 +1,12 @@
1
+ module JobParser
2
+ module Facets
3
+ class Postcode < Facet
4
+ def parse
5
+ postcode_regex = /([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]?\s?[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)/
6
+ postcode_regex.match(@plain_text.gsub("\n", " ")) { |m|
7
+ return m[0]
8
+ }
9
+ end
10
+ end
11
+ end
12
+ end
@@ -32,5 +32,9 @@ module JobParser
32
32
  def deadline
33
33
  Facets::Deadline.new(@doc, @url, @plain_text).parse
34
34
  end
35
+
36
+ def job_postcode
37
+ Facets::Postcode.new(@doc, @url, @plain_text).parse
38
+ end
35
39
  end
36
40
  end
@@ -26,7 +26,8 @@ module JobParser
26
26
  :apply => apply_link,
27
27
  :salary_string => job_salary_string,
28
28
  :location => job_location,
29
- :deadline => deadline
29
+ :deadline => deadline,
30
+ :postcode => job_postcode
30
31
  }
31
32
  result
32
33
  end
@@ -81,6 +81,10 @@ module JobParser
81
81
  end
82
82
  end
83
83
 
84
+ def job_postcode
85
+ get_content_at_prop("postalCode")
86
+ end
87
+
84
88
  def deadline
85
89
  end
86
90
 
@@ -1,3 +1,3 @@
1
1
  module JobParser
2
- VERSION = "0.13.4"
2
+ VERSION = "0.13.5"
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.13.4
4
+ version: 0.13.5
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-16 00:00:00.000000000 Z
12
+ date: 2013-08-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -155,6 +155,7 @@ files:
155
155
  - lib/jobparser/facets/deadline.rb
156
156
  - lib/jobparser/facets/facet.rb
157
157
  - lib/jobparser/facets/location.rb
158
+ - lib/jobparser/facets/postcode.rb
158
159
  - lib/jobparser/facets/salary.rb
159
160
  - lib/jobparser/facets/salarystring.rb
160
161
  - lib/jobparser/facets/title.rb