get_your_rep 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7fe38bde07d4ade3dfcb86928ca140ed53b6761e
4
- data.tar.gz: 6eedfe6c5b68af6e447c9d7b4b6221e531e31853
3
+ metadata.gz: c16d91fa3356cbf8023016ff512e0aa0eea194fd
4
+ data.tar.gz: 3e55d1025abf18ba15c704484edec851bb57be41
5
5
  SHA512:
6
- metadata.gz: de3a833357b414447dc44002dc3260c61808661a9a11ffd2bc52d62f92286113711b133d9b13617af80ef724432df9897a00fa0b8e2f24217707d59116870c02
7
- data.tar.gz: a14e284a91c1ad1bee2ebf5771df47d58e6bccf6fb2cbc9edae7f0c9fcf0ae22214d6fc1212b12abb811148a05bb6115a65ad05562ad1ecdc00b6c8e96f4bad8
6
+ metadata.gz: 0222b6b22f44fc6464544595dc25f171a858a0f4698eb3666b641b61d895b3bbd3c9aabf82cd5fcae3122784d833813736c15a4254af0056b24172fc1dc41ec4
7
+ data.tar.gz: e6ea659e4bc3c1261885d74d83d40392bb91ab95b9416568c7e2faa117e07f6410feb297fef05f9d276bc04529c0e7b591b250179879a35a7c6cececb82f3d97
@@ -19,8 +19,7 @@ module GetYourRep
19
19
  def start
20
20
  puts '', "Type 'help' for help".blue
21
21
  loop do
22
- new_line
23
- print "[#{line}] gyr(#{VERSION}) -> "
22
+ command_line
24
23
  input = gets.strip.downcase
25
24
 
26
25
  case input
@@ -46,6 +45,11 @@ module GetYourRep
46
45
  end
47
46
  end
48
47
 
48
+ def command_line
49
+ new_line
50
+ print "[#{line}] gyr(#{VERSION}) -> "
51
+ end
52
+
49
53
  def find_or_set_address
50
54
  puts address || set_address
51
55
  end
@@ -103,9 +107,39 @@ but you can try a zip code if you insist.".yellow
103
107
  end
104
108
 
105
109
  def display_reps
106
- delegation.reps.each do |rep|
107
- @banner ||= Patriotic.banner
108
- rep.cli_display
110
+ rep_list
111
+ puts "Select a rep number for more detail. Type 'list' for the list or 'exit' for a new query.".yellow
112
+ rep_loop
113
+ end
114
+
115
+ def rep_list
116
+ delegation.each_with_index do |rep, index|
117
+ puts "#{index + 1}. #{rep.name}".bold.blue
118
+ end
119
+ end
120
+
121
+ def rep_loop
122
+ loop do
123
+ command_line
124
+ input = gets.strip.downcase
125
+ num = input.to_i
126
+
127
+ if input == 'exit'
128
+ puts "Enter a new query. Type 'help' for help.".yellow
129
+ break
130
+
131
+ elsif input == 'list'
132
+ rep_list
133
+
134
+ elsif (1..delegation.count).include?(num)
135
+ delegation.each_with_index do |rep, index|
136
+ next if index + 1 != num
137
+ rep.cli_display
138
+ end
139
+
140
+ else
141
+ puts "Submit a valid entry or type 'exit'.".bold.red
142
+ end
109
143
  end
110
144
  end
111
145
  end
@@ -2,13 +2,6 @@
2
2
  module GetYourRep
3
3
  # Red, white and blue decorations for CLI.
4
4
  module Patriotic
5
- # Stars banner.
6
- def self.banner
7
- puts ' ' + '_' * 23 + ' '.bold.red
8
- puts "\u23B9".bold.red + ' * * * * * * * * * * * '.white.on_blue + "\u23B8".bold.red
9
- puts ' ' + "\u203E".bold.red * 23 + ' '
10
- end
11
-
12
5
  # Stars and Bars
13
6
  def self.stars_and_bars
14
7
  4.times { puts stars_and_red_bar, stars_and_white_bar }
@@ -20,6 +20,8 @@ module GetYourRep
20
20
  # the office_array is an array of hashes and is a sibling to the officials array from which
21
21
  # the rep info is parsed.
22
22
  attr_accessor :office_name
23
+ # Define the :photoUrl in case it's not passed in the options.
24
+ attr_accessor :photoUrl
23
25
 
24
26
  # Sets array attributes to empty arrays and and builds other attributes from options hash.
25
27
  def initialize(options = {})
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GetYourRep
3
- VERSION = '1.0.4' # :nodoc:
3
+ VERSION = '1.0.5' # :nodoc:
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_your_rep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - msimonborg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-09 00:00:00.000000000 Z
11
+ date: 2017-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty