tia-crawler 0.0.1 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd31504cbd760b69af3b4f391fb2db9ca2cd74c3
4
- data.tar.gz: 29de4f16599b89eaf1afda7f553a2dc83c0d141c
3
+ metadata.gz: 369c34b17b1b60f7ab45d25c9d770e1bc29af55b
4
+ data.tar.gz: af70c1f45173d8172212271b93d2031cea7872be
5
5
  SHA512:
6
- metadata.gz: bb3fc8f12106af50de8aa17b0a7dc9ece6f96bf2ff1407418d6aab9f15900829b55acf696cc3251b07e537eb86a543c564d349b4a28d4992e8271665fcbf11b2
7
- data.tar.gz: 1f4c7fae45f0ca6408997c96b827159446270deb05a06d4ee69110ede4a2ef8e856ce2e766a79c6d8eb2748c47b4d9c43b83afd3eebebf495f0d6224d7714b63
6
+ metadata.gz: c2af6e46f27d4f7910b310edd96472ed7091ab7853bbc9392dacf96cd1f48085fef5c26f17e386f571c20f47ddd1fc054f40208217a61dddcb47a5946c57052e
7
+ data.tar.gz: 2c80b0147a8c6ad22cf434cdf6489d36df2a6c42b8ac0573699d094740a0f8c931b296e87e1f833eb77de294bc648ee6cb0c50a1b0fb02a52d510156aab16374
@@ -0,0 +1,19 @@
1
+ require_relative './timetable'
2
+
3
+ module TiaCrawler
4
+ class Subject
5
+ attr_accessor :name, :timetable
6
+
7
+ def initialize(name)
8
+ @name = name
9
+ @timetable = Timetable.new
10
+ end
11
+
12
+ def as_json
13
+ return {
14
+ "name" => @name,
15
+ "timetable" => @timetable.as_json,
16
+ }
17
+ end
18
+ end
19
+ end
@@ -4,6 +4,7 @@ require 'uri'
4
4
  require 'nokogiri'
5
5
 
6
6
  require_relative '../models/tia-url'
7
+ require_relative '../models/subject'
7
8
  require_relative '../models/timetable'
8
9
  require_relative 'networking'
9
10
 
@@ -114,16 +115,17 @@ module TiaCrawler
114
115
 
115
116
  if name != "--"
116
117
  dia = dias[j]
117
- theSubjects[name] = Timetable.new if theSubjects[name].nil?
118
- theSubjects[name].append dia, cols[0].inner_html
118
+
119
+ theSubjects[name] = Subject.new name if theSubjects[name].nil?
120
+ theSubjects[name].timetable.append dia, cols[0].inner_html
119
121
  end
120
122
  end
121
123
  end
122
124
  end
123
125
 
124
- json = {}
126
+ json = []
125
127
  theSubjects.each do |key, val|
126
- json[key] = val.as_json
128
+ json << val.as_json
127
129
  end
128
130
 
129
131
  return json
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tia-crawler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleph Retamal
@@ -20,6 +20,7 @@ files:
20
20
  - bin/tia-crawler
21
21
  - lib/tia-crawler.rb
22
22
  - lib/tia/models/credentials.rb
23
+ - lib/tia/models/subject.rb
23
24
  - lib/tia/models/tia-url.rb
24
25
  - lib/tia/models/timetable.rb
25
26
  - lib/tia/services/networking.rb
@@ -44,7 +45,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
44
45
  version: '0'
45
46
  requirements: []
46
47
  rubyforge_project:
47
- rubygems_version: 2.5.1
48
+ rubygems_version: 2.6.12
48
49
  signing_key:
49
50
  specification_version: 4
50
51
  summary: Tia Crawler