work_together 0.6.0 → 0.7.0

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: a6f2fb796937e7f37d46abee6d075df3d25550d6
4
- data.tar.gz: a9bede98d7bc13351dc99427d79935b5f30b8ae7
3
+ metadata.gz: 4395d6f7fd17e9876bdfe98481a9bbecc7d2f323
4
+ data.tar.gz: 5dd2911a1f6aa3dea4ea2bac5950ae67f6d53043
5
5
  SHA512:
6
- metadata.gz: 97a17e65266a397f0f303d48f36af43968164d2ba91683ab5d8f648eeb50dc025122ccf752e129b9284fac69522058609456394e81d13602815c6e124363e53b
7
- data.tar.gz: b398ffa81c018727b8094ba4ee283a07b4d049c27a3f0a75e0a71772e65147ed4b5f3607418af5f4c29516c6ff602e0701a35af600584d9f14d3eb2f451d750b
6
+ metadata.gz: 941027bf9b07dd5c4d0a53d44b55159691d1e2b8cce6abb2f4ed91f2c5a47fa52235724a6f2d0767d030e1ff67a8b2d2149eaf2b8705b716b8dfd5bb3636f33d
7
+ data.tar.gz: 9154b8d6d39d82a4050f2627152f1fd5b50412e4b68cb021aa915904b820e9756a6a92d52cec9234473ce805bba703826afa8dc95a6432108d64b11354b5212f
@@ -0,0 +1,3 @@
1
+ ---
2
+ GITHUB_USERNAME: SophieDeBenedetto
3
+ GITHUB_PASSWORD: fakepassword
@@ -1,3 +1,3 @@
1
1
  module WorkTogether
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
data/lib/work_together.rb CHANGED
@@ -11,7 +11,7 @@ module WorkTogether
11
11
 
12
12
  attr_accessor :batch_id, :client, :pair_maker, :keys
13
13
 
14
- def initialize(batch_id)
14
+ def initialize(batch_id=nil)
15
15
  @batch_id = batch_id
16
16
  @pair_maker = PairMaker.new
17
17
  end
@@ -28,6 +28,11 @@ module WorkTogether
28
28
  Student.generate_from_data(student_data)
29
29
  end
30
30
 
31
+ def make_batch_data
32
+ configure_client
33
+ get_and_parse_csv
34
+ end
35
+
31
36
  def make_groups(options, quiet)
32
37
  flag = options[1][2..-1]
33
38
  if options.include?("pairs")
@@ -39,21 +44,11 @@ module WorkTogether
39
44
  else
40
45
  puts "Please enter a valid command. Type work-together --help for more."
41
46
  end
42
- display_tables if !quiet && Table.all.length > 0
47
+ Group.display_groups if !quiet && Group.all.length > 0
43
48
  end
44
49
 
45
50
  private
46
51
 
47
- def display_tables
48
- Table.all.each_with_index do |table, i|
49
- puts "Group #{i + 1}:".colorize(:blue)
50
- table.students.each do |student|
51
- puts student.name.colorize(:light_blue)
52
- end
53
- puts "-------------------".colorize(:blue)
54
- end
55
- end
56
-
57
52
  def help
58
53
  puts "Available commands:"
59
54
  puts "work-together pairs --random batch-number generate pairs randomly"
@@ -94,6 +89,23 @@ module WorkTogether
94
89
  end
95
90
  end
96
91
 
92
+ class Group
93
+
94
+ def self.all
95
+ Table.all
96
+ end
97
+
98
+ def self.display_groups
99
+ Table.all.each_with_index do |table, i|
100
+ puts "Group #{i + 1}:".colorize(:blue)
101
+ table.students.each do |student|
102
+ puts student.name.colorize(:light_blue)
103
+ end
104
+ puts "-------------------".colorize(:blue)
105
+ end
106
+ end
107
+ end
108
+
97
109
  class Student
98
110
  @@all = []
99
111
 
@@ -107,6 +119,12 @@ module WorkTogether
107
119
  @@all
108
120
  end
109
121
 
122
+ def self.build_attributes(headers)
123
+ headers.each do |header|
124
+ attr_accessor header.to_sym
125
+ end
126
+ end
127
+
110
128
  def name
111
129
  "#{first_name} #{last_name}"
112
130
  end
@@ -115,7 +133,13 @@ module WorkTogether
115
133
  self.completion
116
134
  end
117
135
 
136
+ def self.attributes_from_data(data)
137
+ attributes = data.first.to_hash.keys
138
+ self.build_attributes(attributes)
139
+ end
140
+
118
141
  def self.generate_from_data(data)
142
+ attributes_from_data(data)
119
143
  data.each do |student_hash|
120
144
  student_hash.delete_if {|attribute, value| !Student.instance_methods.include?(attribute.to_sym)}
121
145
  self.new.tap do |student|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: work_together
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sophie DeBenedetto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-11 00:00:00.000000000 Z
11
+ date: 2016-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler