mconnect 0.1.4 → 0.1.5
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/authorizer.rb +2 -3
- data/lib/mconnect/decorator.rb +3 -5
- data/lib/mconnect/generator.rb +8 -11
- data/lib/mconnect/version.rb +1 -1
- data/lib/mconnect/worker.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f6d96350b829a614483b1b1ba7c8559e81cf072b
|
4
|
+
data.tar.gz: e6df3d427d882c758d8861159d458476fd8e4826
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d4d9ccd718ee438fd237e5769545f86766dd8deb63ae54df6e56d047e5efbaa1095f2880fafc2995a4ac0d6d22ae97e1617327ccd0ed8e165f01a01202c06f1
|
7
|
+
data.tar.gz: 7bb2bc7bf54c61486bbbca640745950b5e0604ca29cb6342487c94d5648552e0079c7b874149566bdae116f512bea198fabd0c7f3e9181cbcc2be9dd8f5c4d8a
|
data/lib/mconnect/authorizer.rb
CHANGED
@@ -5,7 +5,6 @@ module Mconnect
|
|
5
5
|
include Helpers
|
6
6
|
|
7
7
|
attr_writer :verifier
|
8
|
-
attr_reader :client
|
9
8
|
|
10
9
|
def initialize
|
11
10
|
oauth_options = load_yaml '/tmp/mconnect/config.yml'
|
@@ -23,11 +22,11 @@ module Mconnect
|
|
23
22
|
|
24
23
|
def access_token
|
25
24
|
access_token = load_yaml '/tmp/mconnect/authorization.yml'
|
26
|
-
OAuth::AccessToken.new(client, access_token.token, access_token.secret)
|
25
|
+
OAuth::AccessToken.new(@client, access_token.token, access_token.secret)
|
27
26
|
end
|
28
27
|
|
29
28
|
def request_token
|
30
|
-
@request_token ||= client.get_request_token
|
29
|
+
@request_token ||= @client.get_request_token
|
31
30
|
end
|
32
31
|
|
33
32
|
def authorize_url
|
data/lib/mconnect/decorator.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
1
|
module Mconnect
|
2
2
|
class Decorator
|
3
|
-
attr_accessor :content
|
4
|
-
|
5
3
|
def initialize content
|
6
4
|
@content = content
|
7
5
|
end
|
8
6
|
|
9
7
|
def remove_columns columns = []
|
10
|
-
content.each do |hash|
|
8
|
+
@content.each do |hash|
|
11
9
|
hash.reject! do |k,v|
|
12
10
|
columns.include? k
|
13
11
|
end
|
@@ -15,7 +13,7 @@ module Mconnect
|
|
15
13
|
end
|
16
14
|
|
17
15
|
def flatten_column column
|
18
|
-
orig_content = content.dup
|
16
|
+
orig_content = @content.dup
|
19
17
|
content = []
|
20
18
|
|
21
19
|
orig_content.each do |hash|
|
@@ -26,7 +24,7 @@ module Mconnect
|
|
26
24
|
end
|
27
25
|
|
28
26
|
def sections_hash
|
29
|
-
orig_content = content.dup
|
27
|
+
orig_content = @content.dup
|
30
28
|
content = []
|
31
29
|
|
32
30
|
orig_content.each do |hash|
|
data/lib/mconnect/generator.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
module Mconnect
|
2
2
|
class Generator
|
3
|
-
attr_accessor :content
|
4
|
-
attr_reader :directory, :endpoint
|
5
|
-
|
6
3
|
def initialize content, directory, endpoint
|
7
4
|
@content = content
|
8
5
|
@directory = directory
|
@@ -10,21 +7,21 @@ module Mconnect
|
|
10
7
|
end
|
11
8
|
|
12
9
|
def save_csv
|
13
|
-
decorator = Mconnect::Decorator.new content
|
10
|
+
decorator = Mconnect::Decorator.new @content
|
14
11
|
|
15
|
-
case endpoint
|
12
|
+
case @endpoint
|
16
13
|
when "teachers"
|
17
|
-
content = decorator.remove_columns ['custom', 'saml_name']
|
14
|
+
@content = decorator.remove_columns ['custom', 'saml_name']
|
18
15
|
when "students"
|
19
|
-
content = decorator.remove_columns ['sections']
|
16
|
+
@content = decorator.remove_columns ['sections']
|
20
17
|
when "standards"
|
21
|
-
content = decorator.flatten_column 'standards'
|
18
|
+
@content = decorator.flatten_column 'standards'
|
22
19
|
when "sections"
|
23
|
-
content = decorator.sections_hash
|
20
|
+
@content = decorator.sections_hash
|
24
21
|
end
|
25
22
|
|
26
|
-
CSV.open("#{directory}/#{endpoint}.csv", "w", write_headers: true, headers: content.first.keys) do |csv|
|
27
|
-
content.each do |hash|
|
23
|
+
CSV.open("#{@directory}/#{@endpoint}.csv", "w", write_headers: true, headers: @content.first.keys) do |csv|
|
24
|
+
@content.each do |hash|
|
28
25
|
csv << hash.values
|
29
26
|
end
|
30
27
|
end
|
data/lib/mconnect/version.rb
CHANGED
data/lib/mconnect/worker.rb
CHANGED