myuniversaljobsmatchfeed 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 73e23740cb159e05714356c27588d31c7992bcb2
4
+ data.tar.gz: f66e906d84ef853b54f38b0527b64599436aa9fe
5
+ SHA512:
6
+ metadata.gz: 74056d95342998f50c3e09a9ae67862ebfc0322432e4f943890161d837e7f44f9b2e2ee79d7b123bf0c8172b4d4baa3a7138a438d9aad0258356d989836fb28d
7
+ data.tar.gz: 391d99d241c5653a0e84f91ddaa02e932e3b764c7ec5ff57838b5239c56fcf177583126057e96ca2ef7b3121b9da75b14638c78e0e32c59af9ce744b1ee2a971
checksums.yaml.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ t�m%�й=�'��1�v�S)V?֣<܃�e D���%�{��J�?B*�)��:�y❻g�9}T�L�ZK>�f���ߟʱR����
2
+ K�%�Y-����7(4��q�S�> �e���Ÿ��I2RSR�E�.ƭ6�ru'7���Oz-�Qz)ſ�Ԇ_yRl&O�S c��c��uW�h���H�T�r�+��b��{�P“�aos�;�ax*_
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: myuniversaljobsmatchfeed.rb
4
+
5
+ require 'daily_notices'
6
+ require 'myuniversaljobsmatch'
7
+
8
+
9
+
10
+ class MyUniversalJobsMatchFeed < DailyNotices
11
+
12
+ def initialize(filepath='', title: nil, where: nil, url_base: '', \
13
+ dx_xslt: '', rss_xslt: '', refreshrate: nil, target_xslt: '')
14
+
15
+ @schema = 'ujm[title,tags]/item(job_id, title, description, ' + \
16
+ 'posting_date, company, location, industries, ' + \
17
+ 'job_type, salary, hours_of_work, job_reference_code,' + \
18
+ 'career_level, education_level, application_methods,' + \
19
+ 'years_of_experience)'
20
+ @default_key = 'job_id'
21
+
22
+ super(filepath, url_base: url_base, dx_xslt: dx_xslt, \
23
+ rss_xslt: rss_xslt, target_page: :record, target_xslt: target_xslt)
24
+
25
+ @title, @where = title, where
26
+
27
+ self.title = "My Universal Jobmatch feed for %s in %s" % [title, where]
28
+ self.description = 'Universal Jobmatch data fetched ' + \
29
+ 'from jobsearch.direct.gov.uk'
30
+
31
+ # set the time last updated in the hidden scratch file if refreshrate set
32
+
33
+ @datafile = File.join(@filepath, '.myuniversaljobsmatchfeed')
34
+ @refreshrate = refreshrate
35
+
36
+
37
+ if @refesh_rate then
38
+
39
+ @h = File.exists?(@datafile) ? Kvx.new(File.read(@datafile)).to_h : \
40
+ {nextrefresh: Time.now.to_s}
41
+ end
42
+
43
+ @ujm = MyUniversalJobsMatch.new filepath: @filepath
44
+
45
+ end
46
+
47
+ def start()
48
+ loop { self.update; sleep((@refreshrate || 1) * 60) }
49
+ end
50
+
51
+ def update()
52
+
53
+ return if @refreshrate and (Time.parse(@h[:nextrefresh]) > Time.now)
54
+
55
+ results = @ujm.search(title: @title, where: @where)
56
+ results_filepath = File.join(@filepath, 'results.xml')
57
+
58
+ capture = ->(result) do
59
+ vacancy = @ujm.query result[:job_id]
60
+
61
+ self.add(vacancy, title: vacancy[:title], \
62
+ description: vacancy[:description], id: vacancy[:job_id]) do |kvx|
63
+ kvx.summary[:title] = vacancy[:title]
64
+ end
65
+ end
66
+
67
+ if File.exists? results_filepath then
68
+
69
+ prev_results = Dynarex.new(results_filepath)
70
+ new_results = results.to_a - prev_results.to_a
71
+
72
+ if new_results.any? then
73
+
74
+ new_results.each(&capture)
75
+
76
+ results.save results_filepath
77
+ on_change()
78
+
79
+ end
80
+
81
+ else
82
+
83
+ results.all.each(&capture)
84
+
85
+ results.save results_filepath
86
+ on_change()
87
+
88
+ end
89
+
90
+ if @refreshrate then
91
+
92
+ @h = {nextrefresh: (Time.now + @refreshrate * 60).to_s}
93
+ File.write @datafile, Kvx.new(@h)
94
+
95
+ end
96
+
97
+ end
98
+
99
+ # override this method for your own custom notifier, callback, or webhook etc.
100
+ #
101
+ def on_change()
102
+
103
+ yield() if block_given?
104
+
105
+ end
106
+
107
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ Bs�/�Gdk,t���x�-C]t'+�RW����Nj$u��~��b7hB<���C�\�G1Y3���gCy#���� ��!�ʫ��� |��=�>9��㇢�����f��Ԟ�y Fo�+͟�74Tܨܹz�G|�y�c�
2
+ ��,G0k�o0�CU ��Gq�6���X�$���rp��M�X`)���$�b��)�b uA�$����R{�2���g� ΐG F�L�S��c
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: myuniversaljobsmatchfeed
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE1MTEwMTEyNDg1MFoXDTE2MTAzMTEyNDg1MFowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAJkpl1Ihy1Emoz/x39uzpSB0D6y4sgn0M+ZYM2GRYa3ZOKkpBfW9CQVY5k53
19
+ XL2ZyOfeU2Z8lUTM4IX/bqlOGJ+UJYS+A8JXJjDXKhI0E9m9nRvRB10kIIXlb5Wa
20
+ lH/5Dbf8lZI6ASf5vfcCd4vooPp2rbeyrtNxamqSaos2GJXOKyMK+N3Im+vdltDg
21
+ +gLr9KPro8onGlwc834TWpeTfNLlMU6/DeZtmYgkpoZGHEEHUPMN4QP7F4fDS7+z
22
+ rblh5HRaL3lrui7xtdnVe6yWNKF4pO3eNx/qk9q1pYBNxKRCqDW6TpPcLXXThp6N
23
+ KutN55bgY7rWLIxoryHafgcf4R8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUlg6D83H/kFEM6pI3lnzaZxbXnrYwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAP27JiixZ
27
+ ZEoRtQwaHaWb1kWqEhWIKUX8IZCLxGhUto51qatxDj+E0vmglHX6KrrChbc/6OW/
28
+ OFDQflfjVr1vKWh9lhpBF8XQxY/S+P10jIam1U9BAwQwtqhxUTMgiRZNQjGAOho3
29
+ FDbr/Cp1NxLzz3WQ5ISLHFe8Gz7Ilq053X7Uy8B+pNQBl/8+pnu4aCaEsxtPpm1X
30
+ pLLMEGuwIzu1dBUrFnjtuM8QYslXQv3dQEx8xC8AafsP016e06arUz0ODN/iwMVM
31
+ hutGID88gCwJmkr087O3V0hW65rNfi60o1Gf2isaXnjWu9oUKQZiaZYCf35sr96m
32
+ 2ts5zHJi+atHJg==
33
+ -----END CERTIFICATE-----
34
+ date: 2015-11-01 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: myuniversaljobsmatch
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.1'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.5
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '0.1'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.1.5
56
+ - !ruby/object:Gem::Dependency
57
+ name: daily_notices
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.3'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 0.3.0
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '0.3'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.3.0
76
+ description:
77
+ email: james@r0bertson.co.uk
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/myuniversaljobsmatchfeed.rb
83
+ homepage: https://github.com/jrobertson/myuniversaljobsmatchfeed
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.4.8
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: Generates an RSS feed for the search results from the myuniversaljobsmatch
107
+ gem
108
+ test_files: []
metadata.gz.sig ADDED
Binary file