berklee-valencia 0.2.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: 8f285d72b0611c1f7668b8c7e0280fd614c38409dea17fe4dfa683fe6910d27e
4
- data.tar.gz: 933831281bdb32e0382c6dff11834af2ee39c68170fc23283f5aa0ae5e8a2748
3
+ metadata.gz: eafbb386ffe054edb73abbb91ed4f522d5b5a613b31b521c3df9a56c2cf5cd84
4
+ data.tar.gz: 59a22587e6c466537fdeee522a3fe05ebe01d9b920fea132ab0819c07c1a4d10
5
5
  SHA512:
6
- metadata.gz: a6265963d483e171c9825adc4ac76934b5c6d0e7ae32925c187353482050a7b305c06fac20418995de72903d2fa1fdc20871881d2b60aceeed48fb477443fec4
7
- data.tar.gz: e60d265bb275b9d37743d5257ebc58c56f774fd7ab1fb4e3952750cb1e21f7e694f67cb220f169ef22dba4d24ffe16933fca18a3f5837bd186fae1a414d45206
6
+ metadata.gz: 2e9401d049d1ead5b2dbbba092ba0c067d108be9f107782ac62c822dc3764e55c995c8347c61789a371379e8112300462fffdaa6b291fac2b5f5805df62ff970
7
+ data.tar.gz: 41ee797c9ff72becd71f6bbbfc03ccbeffa0bd66b64d590ded839485bf2b863b11e39623915b8d044e1ab4065b1a438cef0f42a03bee35156f19aa5955cebd6b
@@ -33,9 +33,7 @@ class BerkleeValencia::CLI
33
33
 
34
34
  def programs_or_news
35
35
  input = gets.strip.downcase
36
- if input.match(/hasta luego|exit|bye|ciao/)
37
- goodbye
38
- elsif input == "1" || input == "2"
36
+ if input.to_i.between?(1,2)
39
37
  please_wait
40
38
  case input
41
39
  when "1"
@@ -44,7 +42,7 @@ class BerkleeValencia::CLI
44
42
  list_programs
45
43
  end
46
44
  else
47
- say_what
45
+ if_not_that_then_this(input)
48
46
  end
49
47
  end
50
48
 
@@ -63,10 +61,8 @@ class BerkleeValencia::CLI
63
61
  show_program(input)
64
62
  elsif input == "news"
65
63
  list_article_categories
66
- elsif input.match(/hasta luego|exit|bye|ciao/)
67
- goodbye
68
64
  else
69
- say_what
65
+ if_not_that_then_this(input)
70
66
  end
71
67
  end
72
68
 
@@ -96,10 +92,8 @@ class BerkleeValencia::CLI
96
92
  list_articles(input)
97
93
  elsif input == "programs"
98
94
  list_programs
99
- elsif input.match(/hasta luego|exit|bye|ciao/)
100
- goodbye
101
95
  else
102
- say_what
96
+ if_not_that_then_this(input)
103
97
  end
104
98
  end
105
99
 
@@ -117,10 +111,8 @@ class BerkleeValencia::CLI
117
111
  show_article(category, input)
118
112
  elsif input == "menu"
119
113
  programs_or_news
120
- elsif input.match(/hasta luego|exit|bye|ciao/)
121
- goodbye
122
114
  else
123
- say_what
115
+ if_not_that_then_this(input)
124
116
  end
125
117
  end
126
118
 
@@ -154,6 +146,14 @@ class BerkleeValencia::CLI
154
146
  programs_or_news
155
147
  end
156
148
 
149
+ def if_not_that_then_this(input)
150
+ if input.match(/hasta luego|exit|bye|ciao/)
151
+ goodbye
152
+ else
153
+ say_what
154
+ end
155
+ end
156
+
157
157
  def say_what
158
158
  puts ""
159
159
  puts "Sorry, I didn't understand that!"
@@ -3,7 +3,7 @@ class BerkleeValencia::SCRAPER
3
3
  @@bv_programs = "https://valencia.berklee.edu/academic-programs/"
4
4
 
5
5
  def self.make_programs
6
- course_types = Nokogiri::HTML(open(@@bv_programs)).css("div.col-3-5")
6
+ course_types = Nokogiri::HTML(open(@@bv_programs, :allow_redirections => :all)).css("div.col-3-5")
7
7
  course_types.each do |type|
8
8
  type.css("ul a").each do |program|
9
9
  attributes = {
@@ -18,7 +18,7 @@ class BerkleeValencia::SCRAPER
18
18
  end
19
19
 
20
20
  def self.make_articles
21
- articles = Nokogiri::HTML(open(@@bv_news))
21
+ articles = Nokogiri::HTML(open(@@bv_news, :allow_redirections => :all))
22
22
  articles.css("div#news_container div.content").each do |article|
23
23
  attributes = {
24
24
  title: article.css("div.news_excerpt h3 a").text,
@@ -32,7 +32,7 @@ class BerkleeValencia::SCRAPER
32
32
  end
33
33
 
34
34
  def self.get_article_extended_info(url)
35
- article = Nokogiri::HTML(open(url))
35
+ article = Nokogiri::HTML(open(url, :allow_redirections => :all))
36
36
  extended_info = {
37
37
  author: article.css("span.author").text,
38
38
  related_links: [],
@@ -1,3 +1,3 @@
1
1
  module BerkleeValencia
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: berklee-valencia
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gingertonic