event_reporter 1.0.0 → 1.0.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.
data/README.md CHANGED
@@ -1,32 +1,60 @@
1
1
  # Event Reporter
2
2
 
3
- Allows for inspection, filtering, printing and saving of csv containing event attendees through CLI.
3
+ Allows for loading, inspection, filtering, printing and saving of csv containing event attendees through CLI. Read the project description on [JumpstartLab's website](http://tutorials.jumpstartlab.com/projects/event_reporter.html).
4
4
 
5
5
  ## Installation
6
6
 
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'event_reporter'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
7
  $ gem install event_reporter
18
8
 
19
9
  ## Usage
20
10
 
21
11
  For help:
22
- $ help
12
+
13
+ ```
14
+ > help
15
+ find <attribute> <criteria> searches csv for specific criteria
16
+ load <filename> erase any loaded data and parse the specified file. If no filename is given default to event_attendees.csv
17
+ queue count outputs how many records are in the current queue
18
+ queue clear empty the queue
19
+ queue print print out a tab-delimited data table with a header row
20
+ queue print by <attribute> print the data table sorted by the specified attribute like zipcode
21
+ queue save to <filename.csv> exports current queue to specified filename as a CSV
22
+ add <attribute> <criteria> exports current queue to specified filename as a CSV
23
+ subtract <attribute> <criteria> exports current queue to specified filename as a CSV
24
+ quit exits program
25
+ ```
23
26
 
24
27
  Example:
25
- $ load
26
- $ find first_name (chris, sarah) and state (co, ky)
27
- $ add last_name smith
28
- $ queue print by last_name
29
- $ queue save to results.csv
28
+
29
+ ```
30
+ EventManager initializing...
31
+ > load event_attendees.csv
32
+ Loaded event_attendees.csv (5175 attendees)
33
+ > find first_name (john, sarah) and state (co, ky)
34
+ There are 6 records in your queue
35
+ > queue print by last_name
36
+ LAST NAME FIRST NAME EMAIL ZIPCODE CITY STATE ADDRESS PHONE NUMBER
37
+ Catlin Sarah tlacyjamesrossi3@jumpstartlab.com 40206 Louisville KY 114 N Galt Ave 5029386000
38
+ Dayananda John kyllacamerak@jumpstartlab.com 40206 Louisville KY 513 Emery Rd. 5027410000
39
+ Dyment John lqeisler@jumpstartlab.com 40741 London KY 216 Johnson Addition 6068624000
40
+ Riordan Sarah ctuhspugha@jumpstartlab.com 80212 Denver CO 2814 Tennyson St. 7202058000
41
+ Ruud Sarah lprissa.S.Knodel@jumpstartlab.com 40508 Lexington KY 300 N. Broadway 6067480000
42
+ Waickman Sarah pvssino_a@jumpstartlab.com 42101 Bowling green KY 1538 Chestnut Street 6153306000
43
+ > subtract city denver
44
+ There are 5 records in your queue
45
+ > queue print by city
46
+ LAST NAME FIRST NAME EMAIL ZIPCODE CITY STATE ADDRESS PHONE NUMBER
47
+ Waickman Sarah pvssino_a@jumpstartlab.com 42101 Bowling green KY 1538 Chestnut Street 6153306000
48
+ Ruud Sarah lprissa.S.Knodel@jumpstartlab.com 40508 Lexington KY 300 N. Broadway 6067480000
49
+ Dyment John lqeisler@jumpstartlab.com 40741 London KY 216 Johnson Addition 6068624000
50
+ Dayananda John kyllacamerak@jumpstartlab.com 40206 Louisville KY 513 Emery Rd. 5027410000
51
+ Catlin Sarah tlacyjamesrossi3@jumpstartlab.com 40206 Louisville KY 114 N Galt Ave 5029386000
52
+ > queue save to results.csv
53
+ Saved to results.csv
54
+ > quit
55
+ Ciao, bella!
56
+ ```
57
+
30
58
 
31
59
  ## Contributing
32
60
 
data/bin/results.csv ADDED
@@ -0,0 +1,6 @@
1
+ last_name,first_name,email,zipcode,city,state,address,HomePhone
2
+ Waickman,Sarah,pvssino_a@jumpstartlab.com,42101,Bowling green,KY,1538 Chestnut Street,6153306000
3
+ Ruud,Sarah,lprissa.S.Knodel@jumpstartlab.com,40508,Lexington,KY,300 N. Broadway,6067480000
4
+ Dyment,John,lqeisler@jumpstartlab.com,40741,London,KY,216 Johnson Addition,6068624000
5
+ Dayananda,John,kyllacamerak@jumpstartlab.com,40206,Louisville,KY,513 Emery Rd.,5027410000
6
+ Catlin,Sarah,tlacyjamesrossi3@jumpstartlab.com,40206,Louisville,KY,114 N Galt Ave,5029386000
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = "event_reporter"
3
- gem.version = "1.0.0"
3
+ gem.version = "1.0.1"
4
4
  gem.author = "Raphael Weiner"
5
5
  gem.email = "raphael.weiner@gmail.com"
6
6
  gem.summary = "Loads csv of event attendees and allows for searching"
@@ -19,8 +19,6 @@ Gem::Specification.new do |gem|
19
19
 
20
20
  gem.required_ruby_version = '>=1.9'
21
21
  gem.has_rdoc = false
22
- # gem.add_dependency 'CSV'
23
- # gem.add_dependency 'yaml'
24
22
  gem.add_dependency 'json'
25
23
  gem.add_dependency 'nokogiri'
26
24
  end
@@ -94,21 +94,21 @@ module EventReporter
94
94
  @cache.queue.delete_if do |attendee|
95
95
  attendee[attribute].downcase == criteria.downcase
96
96
  end
97
+ @cache.queue_count("")
97
98
  end
98
99
 
99
100
  def add(instructions)
100
101
  attribute, criteria = parse_maths_input(instructions)
101
102
  @cache.queue |= search('all', attribute, criteria)
103
+ @cache.queue_count("")
102
104
  end
103
105
 
104
106
  def parse_maths_input(instructions)
105
- if instructions.length != 2
106
- throw(:top, "Incorrect add/subtract input")
107
- elsif @cache.queue.empty?
107
+ if @cache.queue.empty?
108
108
  throw(:top, "Can't add/subtract from an empty queue, silly!")
109
109
  end
110
110
 
111
- attribute, criteria = instructions[0], instructions[1]
111
+ attribute, criteria = instructions[0], instructions[1..-1].join(" ")
112
112
  validate_input(attribute, criteria)
113
113
  return attribute, criteria
114
114
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_reporter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -54,6 +54,7 @@ files:
54
54
  - bin/event_attendees.csv
55
55
  - bin/event_reporter
56
56
  - bin/help.yml
57
+ - bin/results.csv
57
58
  - lib/event_reporter/accept_any_input.rb
58
59
  - lib/event_reporter/attendee.rb
59
60
  - lib/event_reporter/cache.rb