myuniversaljobsmatch 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9aa5f6b90e8b5767466dffc713be7ec0292c3412
4
- data.tar.gz: 26e96baa046bb40cb29e56e1fea21e2097876034
3
+ metadata.gz: 51b06cb74f5610ee5f670f9cc07b6a2092957dc5
4
+ data.tar.gz: a692634d9a195f1a00f0ec3c9d80b4392f861750
5
5
  SHA512:
6
- metadata.gz: 97b6bd231e57d6bccd8985db59a15cc8ecab0133cc846acaf99dff2f0303a78156ad872d2bd013632340b3dc1a868646fe81f260f02eb0976654d03b657fd140
7
- data.tar.gz: ae4b8503ac5ef3549f3b42d5c693638aedaa2d013d9a886edcf2061ffcdb253e172297c42466eea26be54c56668f0b3b8df04fb8293fa4f2df5c3024318de9aa
6
+ metadata.gz: 79ca20c095f73204be96f10dd6b1d06d4c22ba62ebe016166adb10f77f0d29626f409a2f18d110584bb69d3f9ff1462847ef5fe56f1b321a3821dc5e85d8efbb
7
+ data.tar.gz: f119fd90a9442fc23b5dff218e1af3cd3cf5d86915e254538de711b7bbb6bb548721299afc08a90d3702063ad99bc9d2a3265e18e316c9555fd8a9a68ad983d2
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -10,15 +10,21 @@ class MyUniversalJobsMatch
10
10
  def initialize(filepath: '')
11
11
 
12
12
  @filepath = filepath
13
+ @url_base = 'https://jobsearch.direct.gov.uk/'
14
+
15
+ @dx = Dynarex.new 'ujm[title,tags]/item(job_id, title, ' + \
16
+ 'description, posting_date, company, location, industries, job_type)'
13
17
 
14
18
  end
19
+
20
+ def dynarex()
21
+ @dx
22
+ end
15
23
 
16
24
  def search(title: '', where: '')
17
25
 
18
-
19
- url = "https://jobsearch.direct.gov.uk/jobsearch/" + \
20
- "powersearch.aspx?qt=2&rad=20&tm=-1&where=#{where}" + \
21
- "&tjt=#{title}"
26
+ url = @url_base + "jobsearch/powersearch.aspx?qt=2&rad=20&tm=-1&" + \
27
+ "where=#{where}&tjt=#{title}"
22
28
  doc = Nokorexi.new(url).to_doc
23
29
 
24
30
  table = doc.root.at_css('.JSresults')
@@ -27,30 +33,46 @@ class MyUniversalJobsMatch
27
33
  # get the date
28
34
  date = row.element('td/span/text()')
29
35
  link = row.element('td[3]/a')
36
+ jobid = link.attributes[:href][/JobID=(\d+)/,1]
30
37
  title = link.text
31
38
  url = link.attributes[:href]
32
39
  company = row.element('td[4]/span/text()')
33
40
  location = row.element('td[5]/span/text()')
34
41
 
35
- [date, title, url, company, location]
42
+ [jobid, date, title, url, company, location]
36
43
 
37
44
  end
38
45
 
39
- dx = Dynarex.new('vacancies[title, desc, date, time, tags, xslt]/vacancy' \
40
- + '(date, title, url, company, location, created_at)')
41
-
42
- dx.default_key = 'uid'
46
+ dx = Dynarex.new('vacancies[title, desc, date, time, tags, xslt]/' + \
47
+ 'vacancy(jobid, date, title, url, company, location, created_at)')
43
48
 
44
49
  dx.title = "Universal Jobmatch jobs - Search results for '#{title}'"
45
- dx.desc = "generated from web scrape of jobsearch.direct.gov.uk; source: " + url
50
+ dx.desc = "generated from web scrape of jobsearch." + \
51
+ "direct.gov.uk; source: " + url
46
52
  dx.tags = 'jobs vacancies jobmatch ' + title.split.first
47
53
  dx.date = Time.now.strftime("%Y-%b-%s")
48
54
  dx.time = Time.now.strftime("%H:%M")
49
55
 
50
56
  a.each do |row|
51
- dx.create Hash[%i(date title url company location created_at).zip(row)]
57
+ dx.create Hash[%i(jobid date title url company location created_at).\
58
+ zip(row)]
52
59
  end
53
60
 
54
61
  return dx
55
62
  end
56
- end
63
+
64
+ def query(id)
65
+
66
+ url = @url_base + 'GetJob.aspx?JobID=' + id
67
+ doc = Nokorexi.new(url).to_doc
68
+ content = doc.root.at_css '.jobViewContent'
69
+ description = content.element('div')
70
+
71
+ raw_summary = doc.root.at_css('.jobViewSummary').xpath('dl/dd/text()')
72
+ job_id, posting_date, company, location, industries, job_type = raw_summary
73
+
74
+ fields = %i(job_id posting_date company location industries job_type description)
75
+ Hash[fields.zip(raw_summary + [description])]
76
+
77
+ end
78
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myuniversaljobsmatch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file