Theatre_Explorer 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5aae833f32fec06731527b8e610052a5e7317a9cd5947c5f8c3397774d685fe7
4
- data.tar.gz: 7aac63df863f03ab521e79d84bbccf319e2f2be766c836db13888e6063af4dda
3
+ metadata.gz: 134109ee7200cac59cad155755d0781e43d65d9ff4c4e965ccb506d6b6388198
4
+ data.tar.gz: 964162f84098cb9aa2ec1b72e2bc5319821227a01b6f223fd4081a897c3c0907
5
5
  SHA512:
6
- metadata.gz: c7a5a604a9c4bb78b40bc5ea2bc2b1dec56a58018c1cc84163dd7ea6fd191d6be29ba0f50e398631e0dadaed3c52ae510da53b976c8386bbf1e46b3bde6831d3
7
- data.tar.gz: 4fca341c3bbb1e21e0b14c2e0dfe48bb713b3560fdb2774b2967542385d82d9941a1c543ba6c6fba0179f97d098519b8543acee6d04cfae1e452777810ce6f66
6
+ metadata.gz: dc887e32b46c533f1b974e71147646a5503e872c060c7552b0567364ebaad91247575a711643c3cc0e8453db3aa99d652a98d9026ca1c63dce2170c4a5c91410
7
+ data.tar.gz: 85b5323730e245a8dca4ed7f7d90e3bd8fa10abd2d6047e27f30ee6c79488c0eca12d8c70cb63e0d1c2d55c55a591c6a8c148cf594c8dbf65ea30b96fbbb156b
@@ -84,21 +84,36 @@ class CLI
84
84
  else
85
85
  #Creates hash with query results as keys and urls as values
86
86
  options = Scraper.new.show_search(input)
87
- #Displays query results
88
- options.keys.each.with_index(1) {|option, index| puts "#{index}) \t #{option}"}
89
- puts "Which result would you like to explore?"
90
- input = gets.strip.to_i
91
- selection = options[options.keys[input - 1]]
92
- #Scrapes and instantiates production object based on selection.
93
- show = Scraper.new.production("https://www.broadwayworld.com#{selection}")
94
- show.print
87
+ if options.keys.size == 0
88
+ begin
89
+ raise SearchError
90
+ rescue SearchError => error
91
+ puts error.message
92
+ end
93
+ else
94
+ #Displays query results
95
+ options.keys.each.with_index(1) {|option, index| puts "#{index}) \t #{option}"}
96
+ puts "Which result would you like to explore?"
97
+ input = gets.strip.to_i
98
+ selection = options[options.keys[input - 1]]
99
+ #Scrapes and instantiates production object based on selection.
100
+ show = Scraper.new.production("https://www.broadwayworld.com#{selection}")
101
+ show.print
102
+ end
95
103
  continue_prompt
96
104
  end
97
105
  end
98
106
 
107
+ class SearchError < StandardError
108
+ def message
109
+ "Search yielded no results."
110
+ end
111
+ end
112
+
99
113
  #Sequence for repeated searches
100
114
  def continue_prompt
101
115
  puts "\nWould you like to explore more?"
116
+ puts "Yes/No"
102
117
  input = gets.strip.downcase
103
118
  if input == "n" || input == "no" || input == "exit"
104
119
  goodbye
@@ -127,7 +142,6 @@ class CLI
127
142
  puts "---------------------------"
128
143
  puts "|| Goodbye! ||"
129
144
  puts "==========================="
130
- binding.pry
131
145
  exit
132
146
  end
133
147
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TheatreExplorer
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Theatre_Explorer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Drew Keat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-30 00:00:00.000000000 Z
11
+ date: 2021-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize