mconnect 0.1.3 → 0.1.4
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 +4 -4
- data/lib/mconnect/decorator.rb +9 -9
- data/lib/mconnect/generator.rb +3 -3
- data/lib/mconnect/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5666b5063eecb8e5d60d11ebb056219d781548d2
|
4
|
+
data.tar.gz: fca817cb838773da1761a76d74c487cace58ebe0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5d67a48c04593773a761a4d164457584bc13ad1afde001e941f04b55fd0ba7f120adc4a7273a082117b60e04eba3d03f073175964e06bd2c322393a2db40a9f
|
7
|
+
data.tar.gz: 293c6960986017bee4392428c8c90d5e12f6caac859a7208cd79f8483d994e406f7a1809a35155d1af5f05ddeb97ab88e5a51e8b0afbde465d2d2e8a00478334
|
data/lib/mconnect/decorator.rb
CHANGED
@@ -7,7 +7,7 @@ module Mconnect
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def remove_columns columns = []
|
10
|
-
|
10
|
+
content.each do |hash|
|
11
11
|
hash.reject! do |k,v|
|
12
12
|
columns.include? k
|
13
13
|
end
|
@@ -15,24 +15,24 @@ module Mconnect
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def flatten_column column
|
18
|
-
orig_content =
|
19
|
-
|
18
|
+
orig_content = content.dup
|
19
|
+
content = []
|
20
20
|
|
21
21
|
orig_content.each do |hash|
|
22
|
-
|
22
|
+
content << hash[column]
|
23
23
|
end
|
24
24
|
|
25
|
-
|
25
|
+
content.flatten!
|
26
26
|
end
|
27
27
|
|
28
28
|
def sections_hash
|
29
|
-
orig_content =
|
30
|
-
|
29
|
+
orig_content = content.dup
|
30
|
+
content = []
|
31
31
|
|
32
32
|
orig_content.each do |hash|
|
33
33
|
hash['teachers'].each do |t|
|
34
34
|
hash['students'].each do |s|
|
35
|
-
|
35
|
+
content << {
|
36
36
|
"id" => hash['id'],
|
37
37
|
"school_id" => hash['school_id'],
|
38
38
|
"name" => hash['name'],
|
@@ -52,7 +52,7 @@ module Mconnect
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
return
|
55
|
+
return content
|
56
56
|
end
|
57
57
|
end
|
58
58
|
end
|
data/lib/mconnect/generator.rb
CHANGED
@@ -10,7 +10,7 @@ module Mconnect
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def save_csv
|
13
|
-
decorator = Mconnect::Decorator.new
|
13
|
+
decorator = Mconnect::Decorator.new content
|
14
14
|
|
15
15
|
case endpoint
|
16
16
|
when "teachers"
|
@@ -23,8 +23,8 @@ module Mconnect
|
|
23
23
|
content = decorator.sections_hash
|
24
24
|
end
|
25
25
|
|
26
|
-
CSV.open("#{
|
27
|
-
|
26
|
+
CSV.open("#{directory}/#{endpoint}.csv", "w", write_headers: true, headers: content.first.keys) do |csv|
|
27
|
+
content.each do |hash|
|
28
28
|
csv << hash.values
|
29
29
|
end
|
30
30
|
end
|
data/lib/mconnect/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mconnect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Silas Sao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -132,4 +132,3 @@ summary: Gem for the MasteryConnect API
|
|
132
132
|
test_files:
|
133
133
|
- spec/helpers_spec.rb
|
134
134
|
- spec/spec_helper.rb
|
135
|
-
has_rdoc:
|