bridge_blueprint 0.0.01
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +92 -0
- data/README.rdoc +6 -0
- data/bridge_blueprint.gemspec +33 -0
- data/lib/bridge_blueprint/constants.rb +8 -0
- data/lib/bridge_blueprint/data_dump.rb +42 -0
- data/lib/bridge_blueprint/remote_data.rb +75 -0
- data/lib/bridge_blueprint/version.rb +3 -0
- data/lib/bridge_blueprint.rb +4 -0
- data/spec/bridge_blueprint/data_dump_spec.rb +38 -0
- data/spec/bridge_blueprint/remote_data_spec.rb +50 -0
- data/spec/fixtures/bridge_zip/custom_fields.csv +6 -0
- data/spec/fixtures/bridge_zip/users.csv +3 -0
- data/spec/fixtures/data_dumps.json +9 -0
- data/spec/support/fake_bridge.rb +137 -0
- data/spec/test_helper.rb +19 -0
- metadata +235 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a335bce024ef1829056001ce04b79c9b9f720b55
|
4
|
+
data.tar.gz: d7fafab5ea5ed44fdbf480b5c02f24a95f72d3b5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 45086fe9e2386f37c082168f820f9c4744fa720f6dbdff5b3b308725eae98817539445b920077218ca787d883f6766a6c076ff2a6db8bb3495ab9e71f213eef4
|
7
|
+
data.tar.gz: 4a60a49104d9e8e2ce45369c30b5f5b222bfce51c5633df5ed4e195a2f8353c1d31d018b34a2ba02c963a33247d4c00f01eb9fceb2df465acf7cf3fd8b5932d1
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.4.1
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
bridge_blueprint (0.0.01)
|
5
|
+
bridge_api (~> 0.0.12)
|
6
|
+
open_uri_redirections (~> 0.2.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (5.0.2)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (~> 0.7)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
addressable (2.5.1)
|
17
|
+
public_suffix (~> 2.0, >= 2.0.2)
|
18
|
+
bridge_api (0.0.12)
|
19
|
+
faraday (~> 0.9.0)
|
20
|
+
faraday_middleware (~> 0.9.0)
|
21
|
+
footrest (>= 0.5.1)
|
22
|
+
byebug (8.2.5)
|
23
|
+
coderay (1.1.1)
|
24
|
+
concurrent-ruby (1.0.5)
|
25
|
+
crack (0.4.3)
|
26
|
+
safe_yaml (~> 1.0.0)
|
27
|
+
diff-lcs (1.3)
|
28
|
+
faraday (0.9.2)
|
29
|
+
multipart-post (>= 1.2, < 3)
|
30
|
+
faraday_middleware (0.9.2)
|
31
|
+
faraday (>= 0.7.4, < 0.10)
|
32
|
+
footrest (0.5.1)
|
33
|
+
activesupport (>= 3.0.0)
|
34
|
+
faraday (~> 0.9.0)
|
35
|
+
link_header (>= 0.0.7)
|
36
|
+
hashdiff (0.3.2)
|
37
|
+
i18n (0.8.1)
|
38
|
+
link_header (0.0.8)
|
39
|
+
method_source (0.8.2)
|
40
|
+
minitest (5.10.1)
|
41
|
+
multipart-post (2.0.0)
|
42
|
+
open_uri_redirections (0.2.1)
|
43
|
+
pry (0.10.4)
|
44
|
+
coderay (~> 1.1.0)
|
45
|
+
method_source (~> 0.8.1)
|
46
|
+
slop (~> 3.4)
|
47
|
+
public_suffix (2.0.5)
|
48
|
+
rack (1.6.5)
|
49
|
+
rack-protection (1.5.3)
|
50
|
+
rack
|
51
|
+
rake (0.9.6)
|
52
|
+
rspec (2.99.0)
|
53
|
+
rspec-core (~> 2.99.0)
|
54
|
+
rspec-expectations (~> 2.99.0)
|
55
|
+
rspec-mocks (~> 2.99.0)
|
56
|
+
rspec-core (2.99.2)
|
57
|
+
rspec-expectations (2.99.2)
|
58
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
59
|
+
rspec-mocks (2.99.4)
|
60
|
+
rubyzip (1.0.0)
|
61
|
+
safe_yaml (1.0.4)
|
62
|
+
sinatra (1.4.8)
|
63
|
+
rack (~> 1.5)
|
64
|
+
rack-protection (~> 1.4)
|
65
|
+
tilt (>= 1.3, < 3)
|
66
|
+
slop (3.6.0)
|
67
|
+
thread_safe (0.3.6)
|
68
|
+
tilt (1.4.1)
|
69
|
+
tzinfo (1.2.3)
|
70
|
+
thread_safe (~> 0.1)
|
71
|
+
webmock (1.22.6)
|
72
|
+
addressable (>= 2.3.6)
|
73
|
+
crack (>= 0.3.2)
|
74
|
+
hashdiff
|
75
|
+
|
76
|
+
PLATFORMS
|
77
|
+
ruby
|
78
|
+
|
79
|
+
DEPENDENCIES
|
80
|
+
bridge_blueprint!
|
81
|
+
bundler (~> 1.0, >= 1.0.0)
|
82
|
+
byebug (~> 8.2.2)
|
83
|
+
pry (~> 0)
|
84
|
+
rake (~> 0)
|
85
|
+
rspec (~> 2.6)
|
86
|
+
rubyzip (~> 1.0.0)
|
87
|
+
sinatra (~> 1.0)
|
88
|
+
tilt (~> 1.3, >= 1.3.4)
|
89
|
+
webmock (~> 1.22.6)
|
90
|
+
|
91
|
+
BUNDLED WITH
|
92
|
+
1.14.6
|
data/README.rdoc
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require 'bridge_blueprint/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.authors = ["Jay Shaffer"]
|
7
|
+
gem.email = ["jshaffer@instructure.com"]
|
8
|
+
gem.description = %q{Tools for consuming bridge data dumps}
|
9
|
+
gem.summary = %q{Bridge Blueprint}
|
10
|
+
gem.homepage = "https://getbridge.com"
|
11
|
+
gem.license = 'MIT'
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split("\n")
|
14
|
+
gem.files += Dir.glob("lib/**/*.rb")
|
15
|
+
gem.files += Dir.glob("spec/**/*")
|
16
|
+
gem.test_files = Dir.glob("spec/**/*")
|
17
|
+
gem.name = "bridge_blueprint"
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
gem.version = BridgeBlueprint::VERSION
|
20
|
+
|
21
|
+
gem.add_runtime_dependency 'bridge_api', '~> 0.0.12'
|
22
|
+
gem.add_runtime_dependency 'open_uri_redirections', '~> 0.2.1'
|
23
|
+
|
24
|
+
gem.add_development_dependency 'rake', '~> 0'
|
25
|
+
gem.add_development_dependency 'bundler', '~> 1.0', '>= 1.0.0'
|
26
|
+
gem.add_development_dependency 'rspec', '~> 2.6'
|
27
|
+
gem.add_development_dependency 'webmock', '~>1.22.6'
|
28
|
+
gem.add_development_dependency 'pry', '~> 0'
|
29
|
+
gem.add_development_dependency 'tilt', '>= 1.3.4', '~> 1.3'
|
30
|
+
gem.add_development_dependency 'sinatra', '~> 1.0'
|
31
|
+
gem.add_development_dependency 'byebug', '~> 8.2.2'
|
32
|
+
gem.add_development_dependency 'rubyzip', '~> 1.0.0'
|
33
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'csv'
|
2
|
+
|
3
|
+
module BridgeBlueprint
|
4
|
+
class DataDump
|
5
|
+
|
6
|
+
@path = nil
|
7
|
+
|
8
|
+
def initialize(path)
|
9
|
+
@path = path
|
10
|
+
unless File.exists?(path)
|
11
|
+
raise "File not found #{path}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def each_row(name)
|
16
|
+
extract_from_zip("#{name}.csv") do |file|
|
17
|
+
CSV.foreach(file, headers: true) do |row|
|
18
|
+
yield(row)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def extract_from_zip(name)
|
26
|
+
Dir.mktmpdir do |dir|
|
27
|
+
path = nil
|
28
|
+
Zip::File.open(@path) do |zip_file|
|
29
|
+
zip_file.each do |entry|
|
30
|
+
if "#{name.to_s}" == entry.name
|
31
|
+
path = "#{dir}/#{entry.name}"
|
32
|
+
file = entry.extract(path)
|
33
|
+
yield "#{dir}/#{name}" if block_given?
|
34
|
+
return
|
35
|
+
end
|
36
|
+
end
|
37
|
+
raise "File #{name} not found in zip archive #{@path}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
require 'open_uri_redirections'
|
3
|
+
require 'net/http'
|
4
|
+
require 'uri'
|
5
|
+
require 'base64'
|
6
|
+
require "bridge_api"
|
7
|
+
|
8
|
+
module BridgeBlueprint
|
9
|
+
|
10
|
+
class RemoteData
|
11
|
+
|
12
|
+
USERS_CSV_NAME = 'users.csv'
|
13
|
+
CUSTOM_FIELD_CSV_NAME = 'custom_fields.csv'
|
14
|
+
GRANTS_CSV_NAME = 'grants.csv'
|
15
|
+
|
16
|
+
@base_url = nil
|
17
|
+
@auth_header = nil
|
18
|
+
@file_url = nil
|
19
|
+
@file_path = nil
|
20
|
+
@is_complete = false
|
21
|
+
@client = nil
|
22
|
+
|
23
|
+
def initialize(base_url, key, secret)
|
24
|
+
@base_url = base_url
|
25
|
+
@auth_header = 'Basic ' + Base64.strict_encode64("#{key}:#{secret}")
|
26
|
+
@client = BridgeAPI::Client.new(prefix: base_url, api_key: key, api_secret: secret)
|
27
|
+
end
|
28
|
+
|
29
|
+
def start_data_report
|
30
|
+
@client.create_data_dump
|
31
|
+
end
|
32
|
+
|
33
|
+
def status
|
34
|
+
dumps = get_dumps
|
35
|
+
if dumps.members.size > 0
|
36
|
+
return get_dumps.first['status']
|
37
|
+
else
|
38
|
+
return BridgeBlueprint::Constants::STATUS_NOT_FOUND
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def store_file(path)
|
43
|
+
@file_path = path
|
44
|
+
uri = URI.parse(@base_url)
|
45
|
+
http = Net::HTTP.new(uri.host, uri.port)
|
46
|
+
http.read_timeout = 300
|
47
|
+
http.use_ssl = (uri.scheme == "https")
|
48
|
+
req = Net::HTTP::Get.new("#{@base_url}/api/admin/data_dumps/download")
|
49
|
+
req.add_field("Authorization", @auth_header)
|
50
|
+
res = http.request(req)
|
51
|
+
redirect_url = res['location']
|
52
|
+
open(redirect_url,
|
53
|
+
) do |remote_file|
|
54
|
+
File.open(@file_path, 'wb') do |file|
|
55
|
+
file.write(remote_file.read)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def get_dumps
|
63
|
+
@client.get_data_dumps
|
64
|
+
end
|
65
|
+
|
66
|
+
def get_headers
|
67
|
+
{
|
68
|
+
'Authorization'=> @auth_header,
|
69
|
+
'Content-Type'=> 'application/json',
|
70
|
+
'Accept'=> 'application/json'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require 'zip'
|
3
|
+
|
4
|
+
describe BridgeBlueprint::DataDump do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
dir = Dir.mktmpdir
|
8
|
+
zip_folder_path = "#{File.dirname(__FILE__)}/../fixtures/bridge_zip"
|
9
|
+
input_filenames = [
|
10
|
+
'users.csv',
|
11
|
+
'custom_fields.csv'
|
12
|
+
]
|
13
|
+
|
14
|
+
@zipfile_name = "#{dir}/dump.zip"
|
15
|
+
|
16
|
+
Zip::File.open(@zipfile_name, Zip::File::CREATE) do |zipfile|
|
17
|
+
input_filenames.each do |filename|
|
18
|
+
zipfile.add(filename, zip_folder_path + '/' + filename)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe 'each' do
|
24
|
+
it 'should parse a bridge data dump file' do
|
25
|
+
file = BridgeBlueprint::DataDump.new(@zipfile_name)
|
26
|
+
user_count = 0
|
27
|
+
file.each_row('users') do |user|
|
28
|
+
user_count += 1
|
29
|
+
end
|
30
|
+
custom_field_count = 0
|
31
|
+
file.each_row('custom_fields') do |custom_field|
|
32
|
+
custom_field_count += 1
|
33
|
+
end
|
34
|
+
expect(user_count).to(eq(8))
|
35
|
+
expect(custom_field_count).to(eq(5))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
require 'zip'
|
3
|
+
|
4
|
+
describe BridgeBlueprint::RemoteData do
|
5
|
+
|
6
|
+
before(:each) do
|
7
|
+
@dir = Dir.mktmpdir
|
8
|
+
zip_folder_path = "#{File.dirname(__FILE__)}/../fixtures/bridge_zip"
|
9
|
+
input_filenames = [
|
10
|
+
'users.csv',
|
11
|
+
'custom_fields.csv'
|
12
|
+
]
|
13
|
+
|
14
|
+
@zipfile_name = "#{@dir}/dump.zip"
|
15
|
+
|
16
|
+
Zip::File.open(@zipfile_name, Zip::File::CREATE) do |zipfile|
|
17
|
+
input_filenames.each do |filename|
|
18
|
+
zipfile.add(filename, zip_folder_path + '/' + filename)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
WebMock.stub_request(:get, "https://example.com/fake-file-url").
|
23
|
+
with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
|
24
|
+
to_return(:status => 200, :body => lambda{|request| File.open(@zipfile_name)}, :headers => {})
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'completed' do
|
28
|
+
it 'should start a data dump' do
|
29
|
+
data = BridgeBlueprint::RemoteData.new('https://example.com', 'key', 'secret')
|
30
|
+
data.start_data_report
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe 'completed' do
|
35
|
+
it 'should check if a data dump is complete' do
|
36
|
+
data = BridgeBlueprint::RemoteData.new('https://example.com', 'key', 'secret')
|
37
|
+
expect(data.status == BridgeBlueprint::Constants::STATUS_COMPLETE).to(eq(true))
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'store_file' do
|
42
|
+
it 'should store a data dump file locally' do
|
43
|
+
data = BridgeBlueprint::RemoteData.new('https://example.com', 'key', 'secret')
|
44
|
+
dir = Dir.mktmpdir
|
45
|
+
data.store_file("#{@dir}/data_dump.csv")
|
46
|
+
expect(File.exists?("#{@dir}/data_dump.csv")).to(eq(true))
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
id,name,created_at,updated_at,deleted_at,domain_id
|
2
|
+
1,hotel,2017-04-06 05:42:04.149619,2017-04-06 05:42:04.149619,,1
|
3
|
+
2,state,2017-04-06 05:42:23.891412,2017-04-06 05:42:23.891412,,1
|
4
|
+
3,role,2017-04-06 05:42:25.926795,2017-04-06 05:42:25.926795,,1
|
5
|
+
4,rid code,2017-04-06 05:42:39.303982,2017-04-06 05:42:39.303982,,1
|
6
|
+
5,department,2017-04-06 05:42:42.747786,2017-04-06 05:42:42.747786,,1
|
@@ -0,0 +1,3 @@
|
|
1
|
+
id,email,uid,created_at,updated_at,avatar_url,first_name,last_name,external_id,reset_token,domain_id,deleted_at,tac_accepted_at,tagline,locale,unsubscribed,welcomed_at,logged_in_at,config,full_name,sortable_name,uuid,sub_account_id,hris_id,support_user,hire_date,hidden
|
2
|
+
1,,bridge_support,2016-11-21 21:17:00.866864,2016-11-21 21:17:00.866864,,,,,,1,,,,,,,,,,,,1,,t,,
|
3
|
+
7,jacobs@instructure.com,jacobs@instructure.com,2016-11-21 21:26:25.564319,2016-12-15 21:43:26.194241,,,,,,1,,2016-12-15 15:51:04.777559,,,,,2016-12-15 15:50:56.417357,,,,,,,,,
|
@@ -0,0 +1,137 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'tilt'
|
3
|
+
|
4
|
+
class FakeBridge < Sinatra::Base
|
5
|
+
|
6
|
+
## Course Templates
|
7
|
+
|
8
|
+
get %r{/api/author/course_templates$} do
|
9
|
+
get_json_data 200, 'courses.json'
|
10
|
+
end
|
11
|
+
|
12
|
+
get %r{/api/author/course_templates/\d+$} do
|
13
|
+
get_json_data 200, 'course.json'
|
14
|
+
end
|
15
|
+
|
16
|
+
post %r{/api/author/course_templates$} do
|
17
|
+
get_json_data 200, 'course.json'
|
18
|
+
end
|
19
|
+
|
20
|
+
post %r{/api/author/course_templates/\d+/publish$} do
|
21
|
+
get_json_data 200, 'course.json'
|
22
|
+
end
|
23
|
+
|
24
|
+
put %r{/api/author/course_templates/\d+$} do
|
25
|
+
get_json_data 200, 'course.json'
|
26
|
+
end
|
27
|
+
|
28
|
+
delete %r{/api/author/course_templates/\d+$} do
|
29
|
+
get_json_data 204, nil
|
30
|
+
end
|
31
|
+
|
32
|
+
## Programs
|
33
|
+
|
34
|
+
get %r{/api/author/programs.*$} do
|
35
|
+
get_json_data 200, 'programs.json'
|
36
|
+
end
|
37
|
+
|
38
|
+
## Users
|
39
|
+
|
40
|
+
get %r{/api/author/users$} do
|
41
|
+
get_json_data 200, 'users.json'
|
42
|
+
end
|
43
|
+
|
44
|
+
get %r{/api/author/users/\d+$} do
|
45
|
+
get_json_data 200, 'user.json'
|
46
|
+
end
|
47
|
+
|
48
|
+
put %r{/api/author/users/\d+$} do
|
49
|
+
get_json_data 200, 'user.json'
|
50
|
+
end
|
51
|
+
|
52
|
+
post %r{/api/admin/users$} do
|
53
|
+
get_json_data 200, 'user.json'
|
54
|
+
end
|
55
|
+
|
56
|
+
delete %r{/api/admin/users/\d+$} do
|
57
|
+
get_json_data 204, nil
|
58
|
+
end
|
59
|
+
|
60
|
+
## Managers
|
61
|
+
get %r{/api/author/managers$} do
|
62
|
+
get_json_data 200, 'managers.json'
|
63
|
+
end
|
64
|
+
|
65
|
+
get %r{/api/author/managers/\d+/direct_reports$} do
|
66
|
+
get_json_data 200, 'direct_reports.json'
|
67
|
+
end
|
68
|
+
|
69
|
+
## Enrollments
|
70
|
+
|
71
|
+
post %r{/api/author/course_templates/\d+/enrollments$} do
|
72
|
+
get_json_data 204, nil
|
73
|
+
end
|
74
|
+
|
75
|
+
get %r{/api/author/course_templates/\d+/enrollments$} do
|
76
|
+
get_json_data 200, 'enrollments.json'
|
77
|
+
end
|
78
|
+
|
79
|
+
delete %r{/api/author/enrollments.*$} do
|
80
|
+
get_json_data 204, nil
|
81
|
+
end
|
82
|
+
|
83
|
+
put %r{/api/author/enrollments.*$} do
|
84
|
+
get_json_data 200, 'enrollment.json'
|
85
|
+
end
|
86
|
+
|
87
|
+
#Custom Fields
|
88
|
+
|
89
|
+
get %r{/api/author/custom_fields} do
|
90
|
+
get_json_data 200, 'custom_fields.json'
|
91
|
+
end
|
92
|
+
|
93
|
+
get %r{/api/author/custom_fields/\d+$} do
|
94
|
+
get_json_data 200, 'custom_fields.json'
|
95
|
+
end
|
96
|
+
|
97
|
+
put %r{/api/author/custom_fields/\d+$} do
|
98
|
+
get_json_data 200, 'custom_fields.json'
|
99
|
+
end
|
100
|
+
|
101
|
+
post %r{/api/author/custom_fields} do
|
102
|
+
get_json_data 200, 'custom_fields.json'
|
103
|
+
end
|
104
|
+
|
105
|
+
delete %r{/api/author/custom_fields/\d+$} do
|
106
|
+
get_json_data 204, nil
|
107
|
+
end
|
108
|
+
|
109
|
+
# Data Dumps
|
110
|
+
|
111
|
+
get %r{/api/admin/data_dumps$} do
|
112
|
+
get_json_data 200, 'data_dumps.json'
|
113
|
+
end
|
114
|
+
|
115
|
+
post %r{/api/admin/data_dumps$} do
|
116
|
+
get_json_data 200, 'data_dumps.json'
|
117
|
+
end
|
118
|
+
|
119
|
+
get %r{/api/admin/data_dumps/download.*} do
|
120
|
+
content_type :json
|
121
|
+
status 200
|
122
|
+
headers[:location] = "https://example.com/fake-file-url"
|
123
|
+
end
|
124
|
+
|
125
|
+
private
|
126
|
+
|
127
|
+
def get_json_data(response_code, file_name)
|
128
|
+
content_type :json
|
129
|
+
status response_code
|
130
|
+
unless file_name.nil?
|
131
|
+
File.open(File.dirname(__FILE__) + '/../fixtures/' + file_name).read
|
132
|
+
else
|
133
|
+
{}
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
end
|
data/spec/test_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'bridge_blueprint'
|
2
|
+
require 'rspec'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'json'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
RSpec.configure do |config|
|
8
|
+
Dir["./spec/support/**/*.rb"].sort.each {|f| require f}
|
9
|
+
|
10
|
+
config.before(:each) do
|
11
|
+
WebMock.disable_net_connect!
|
12
|
+
WebMock.stub_request(:any, /api\/.*/).to_rack(FakeBridge)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def fixture(*file)
|
18
|
+
File.new(File.join(File.expand_path("../fixtures", __FILE__), *file))
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bridge_blueprint
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.01
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jay Shaffer
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bridge_api
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.0.12
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.0.12
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: open_uri_redirections
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.1
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: 1.0.0
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '1.0'
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 1.0.0
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: rspec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '2.6'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2.6'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: webmock
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.22.6
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.22.6
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: pry
|
105
|
+
requirement: !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - "~>"
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - "~>"
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: '0'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: tilt
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 1.3.4
|
124
|
+
- - "~>"
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '1.3'
|
127
|
+
type: :development
|
128
|
+
prerelease: false
|
129
|
+
version_requirements: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: 1.3.4
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '1.3'
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: sinatra
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '1.0'
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '1.0'
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: byebug
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 8.2.2
|
158
|
+
type: :development
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - "~>"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 8.2.2
|
165
|
+
- !ruby/object:Gem::Dependency
|
166
|
+
name: rubyzip
|
167
|
+
requirement: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - "~>"
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: 1.0.0
|
172
|
+
type: :development
|
173
|
+
prerelease: false
|
174
|
+
version_requirements: !ruby/object:Gem::Requirement
|
175
|
+
requirements:
|
176
|
+
- - "~>"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: 1.0.0
|
179
|
+
description: Tools for consuming bridge data dumps
|
180
|
+
email:
|
181
|
+
- jshaffer@instructure.com
|
182
|
+
executables: []
|
183
|
+
extensions: []
|
184
|
+
extra_rdoc_files: []
|
185
|
+
files:
|
186
|
+
- ".gitignore"
|
187
|
+
- ".ruby-version"
|
188
|
+
- Gemfile
|
189
|
+
- Gemfile.lock
|
190
|
+
- README.rdoc
|
191
|
+
- bridge_blueprint.gemspec
|
192
|
+
- lib/bridge_blueprint.rb
|
193
|
+
- lib/bridge_blueprint/constants.rb
|
194
|
+
- lib/bridge_blueprint/data_dump.rb
|
195
|
+
- lib/bridge_blueprint/remote_data.rb
|
196
|
+
- lib/bridge_blueprint/version.rb
|
197
|
+
- spec/bridge_blueprint/data_dump_spec.rb
|
198
|
+
- spec/bridge_blueprint/remote_data_spec.rb
|
199
|
+
- spec/fixtures/bridge_zip/custom_fields.csv
|
200
|
+
- spec/fixtures/bridge_zip/users.csv
|
201
|
+
- spec/fixtures/data_dumps.json
|
202
|
+
- spec/support/fake_bridge.rb
|
203
|
+
- spec/test_helper.rb
|
204
|
+
homepage: https://getbridge.com
|
205
|
+
licenses:
|
206
|
+
- MIT
|
207
|
+
metadata: {}
|
208
|
+
post_install_message:
|
209
|
+
rdoc_options: []
|
210
|
+
require_paths:
|
211
|
+
- lib
|
212
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
213
|
+
requirements:
|
214
|
+
- - ">="
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0'
|
217
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
requirements: []
|
223
|
+
rubyforge_project:
|
224
|
+
rubygems_version: 2.6.11
|
225
|
+
signing_key:
|
226
|
+
specification_version: 4
|
227
|
+
summary: Bridge Blueprint
|
228
|
+
test_files:
|
229
|
+
- spec/bridge_blueprint/data_dump_spec.rb
|
230
|
+
- spec/bridge_blueprint/remote_data_spec.rb
|
231
|
+
- spec/fixtures/bridge_zip/custom_fields.csv
|
232
|
+
- spec/fixtures/bridge_zip/users.csv
|
233
|
+
- spec/fixtures/data_dumps.json
|
234
|
+
- spec/support/fake_bridge.rb
|
235
|
+
- spec/test_helper.rb
|