quarterweek 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/quarterweek.rb +21 -6
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35c58ecc26c65a9456cc9baa0a7e50a4be1ff15a
4
- data.tar.gz: a872e1db32a4203b222234d2d771436b167ddf7e
3
+ metadata.gz: 3dcd8e6232662cd608d158b1d2847ebf69dd0254
4
+ data.tar.gz: 0cd06a37458030dda7e39553cab222a5faefbbd0
5
5
  SHA512:
6
- metadata.gz: ab5952d2444aebbe038c787c76545e85d3330525f8525c00d2ceac90c849cfde491439e4dc2a54d5845e1badbf3404aaa4b7f0c34185d19cba0819a115d24bf6
7
- data.tar.gz: f1219ce4a6a2de918c0620773737a58a5b52b382ab755fdf57da63c73b577a4bbe13f8378367fbdce8df1c33c574f0f39b2c292196858332220c25d0427a636d
6
+ metadata.gz: f4cc3e15ab283935fb37220121d21ca14355ce4ce5d1fa6700257546f050023a6bf86daa13cd84ffc1ad9a22a441ffd789b095f0bda6fea9838c6735858c7af8
7
+ data.tar.gz: 7e2855334ca17715c806d7a7ad5716fb342423d48de9e8fdd048496aef7e7a5f6619ee90c9caebebde2975b0b655241da6f878c17a48a0e09f880936474287c8
data/lib/quarterweek.rb CHANGED
@@ -17,8 +17,9 @@ class Quarterweek
17
17
  # write File
18
18
 
19
19
  def self.write_file(code)
20
+ @url = "http://roosters.saxion.nl"
20
21
  @data = [];
21
- @doc = Nokogiri::HTML(open("http://roosters.saxion.nl/teacher/teacher:#{code}"))
22
+ @doc = Nokogiri::HTML(open("#{@url}/teacher/teacher:#{code}"))
22
23
 
23
24
  @nodeSet = @doc.css("div.span6:nth-child(2) > table:nth-child(1) tr")
24
25
  2.times do @nodeSet.delete(@nodeSet[0]) end
@@ -33,25 +34,39 @@ class Quarterweek
33
34
  end
34
35
 
35
36
  @cal = Icalendar::Calendar.new
37
+
36
38
  @cal.timezone do |t|
37
- t.tzid = "Europe/Amsterdam"
39
+ t.tzid = "Europe/Amsterdam"
40
+
41
+ t.daylight do |d|
42
+ d.tzoffsetfrom = "+0100"
43
+ d.tzoffsetto = "+0200"
44
+ d.tzname = "CEST"
45
+ d.dtstart = "19700329T020000"
46
+ d.rrule = "FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU"
47
+ end
48
+
49
+ t.standard do |s|
50
+ s.tzoffsetfrom = "+0200"
51
+ s.tzoffsetto = "+0100"
52
+ s.tzname = "CET"
53
+ s.dtstart = "19701025T030000"
54
+ s.rrule = "FREQ=YEARLY;BYMONTH=11;BYDAY=-1SU"
55
+ end
38
56
  end
39
57
 
40
58
  @data.each do |hash|
41
59
  @cal.event do |e|
42
60
  start_date = Date.commercial(hash[:y], hash[:w], 1).strftime("%Y%m%d")
43
61
  end_date = Date.commercial(hash[:y], hash[:w], 6).strftime("%Y%m%d")
44
- e = Icalendar::Event.new
45
62
  e.dtstart = Icalendar::Values::Date.new(start_date)
46
63
  e.dtend = Icalendar::Values::Date.new(end_date)
47
64
  e.summary = "Kwartielweek: #{hash[:q]}"
48
- e.url = hash[:l]
49
- @cal.add_event(e)
65
+ e.url = @url + hash[:l]
50
66
  end
51
67
  end
52
68
 
53
69
  @cal.publish
54
-
55
70
  File.open("#{code}-quarterweeks.ics", 'w') { |file| file.write(@cal.to_ical)}
56
71
  end
57
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quarterweek
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Janse
@@ -38,7 +38,7 @@ dependencies:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.4.1
41
- description: Builds ical events with quarterweeks
41
+ description: Builds ical week events with quarterweeks
42
42
  email: r.e.janse@saxion.nl
43
43
  executables:
44
44
  - quarterweek
@@ -70,5 +70,5 @@ rubyforge_project:
70
70
  rubygems_version: 2.6.8
71
71
  signing_key:
72
72
  specification_version: 4
73
- summary: Builds ical events with quarterweeks
73
+ summary: Builds ical week events with quarterweeks
74
74
  test_files: []