bright 1.0 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bright.gemspec +3 -2
- data/lib/bright/helpers/blank_helper.rb +40 -2
- data/lib/bright/response_collection.rb +13 -12
- data/lib/bright/sis_apis/bright_sis.rb +4 -2
- data/lib/bright/sis_apis/infinite_campus.rb +4 -2
- data/lib/bright/sis_apis/power_school.rb +4 -2
- data/lib/bright/version.rb +1 -1
- data/lib/bright.rb +23 -22
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dd99510122d136894a8e1ba1fdfb6bea0c424f355624ca2c68178143fcd7965d
|
4
|
+
data.tar.gz: 16b8599ad55c91cf1f925a76da5d49690c49e2315ca63b925b71d31e421de45c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4499da391786116fef2ef77fbf283fd67f4c4f26f84277f2bf75825d9b2444712f7df8b7bb99ba3279f4c10612addbaaa47dda84ffda2f8e9b4240539d80939
|
7
|
+
data.tar.gz: b544283e756c7114aac543d7b7a3c4d6acf87de7b5c58593a96bcafa619628444a7eaa91b0256dada1e28519914d381fc022563dce10814b5e8d0dbccca74736
|
data/bright.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = "bright"
|
8
8
|
spec.version = Bright::VERSION
|
9
9
|
spec.authors = ["Arux Software"]
|
10
|
-
spec.email = ["
|
10
|
+
spec.email = ["hello@arux.software"]
|
11
11
|
spec.summary = "Framework and tools for dealing with Student Information Systems"
|
12
12
|
spec.description = "Bright is a simple Student Information System API abstraction library used in and sponsored by Arux Software. It is written by Stephen Heuer, Steven Novotny, and contributors. The aim of the project is to abstract as many parts as possible away from the user to offer a consistent interface across all supported Student Information System APIs."
|
13
13
|
spec.homepage = ""
|
@@ -20,7 +20,8 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency "httpi", "~> 2.1"
|
22
22
|
spec.add_runtime_dependency "json", ">= 0"
|
23
|
-
spec.add_runtime_dependency
|
23
|
+
spec.add_runtime_dependency "oauth", ">= 0.5.4"
|
24
|
+
spec.add_runtime_dependency "parallel", "~> 1.2"
|
24
25
|
|
25
26
|
spec.add_development_dependency "bundler", ">= 2.2.10"
|
26
27
|
spec.add_development_dependency "rake", "~> 12.3.3"
|
@@ -1,3 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
class Object
|
4
|
+
def blank?
|
5
|
+
respond_to?(:empty?) ? !!empty? : !self
|
6
|
+
end
|
7
|
+
|
8
|
+
def present?
|
9
|
+
!blank?
|
10
|
+
end
|
11
|
+
|
12
|
+
def presence
|
13
|
+
self if present?
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class NilClass
|
18
|
+
def blank?
|
19
|
+
true
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
1
23
|
class FalseClass
|
2
24
|
def blank?
|
3
25
|
true
|
@@ -10,8 +32,24 @@ class TrueClass
|
|
10
32
|
end
|
11
33
|
end
|
12
34
|
|
13
|
-
class
|
35
|
+
class Array
|
36
|
+
alias_method :blank?, :empty?
|
37
|
+
end
|
38
|
+
|
39
|
+
class Hash
|
40
|
+
alias_method :blank?, :empty?
|
41
|
+
end
|
42
|
+
|
43
|
+
class String
|
44
|
+
BLANK_RE = /\A[[:space:]]*\z/
|
45
|
+
|
46
|
+
def blank?
|
47
|
+
BLANK_RE === self
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
class Numeric
|
14
52
|
def blank?
|
15
|
-
|
53
|
+
false
|
16
54
|
end
|
17
55
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'parallel'
|
2
|
+
|
1
3
|
class ResponseCollection
|
2
4
|
include Enumerable
|
3
5
|
|
@@ -6,6 +8,8 @@ class ResponseCollection
|
|
6
8
|
attr_accessor :per_page
|
7
9
|
attr_accessor :load_more_call
|
8
10
|
|
11
|
+
DEFAULT_NO_THREADS = 4
|
12
|
+
|
9
13
|
# seed_page, total, per_page, load_more_call
|
10
14
|
def initialize(options = {})
|
11
15
|
@paged_objects = {0 => options[:seed_page]}
|
@@ -13,24 +17,21 @@ class ResponseCollection
|
|
13
17
|
@per_page = options[:per_page].to_i
|
14
18
|
@pages = @per_page > 0 ? (@total.to_f / @per_page.to_f).ceil : 0
|
15
19
|
@load_more_call = options[:load_more_call]
|
20
|
+
@no_threads = options[:no_threads] || DEFAULT_NO_THREADS
|
16
21
|
end
|
17
22
|
|
18
23
|
def each
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
else
|
28
|
-
next_page_thread = nil
|
29
|
-
end
|
24
|
+
Parallel.each(0..@pages, in_threads: @no_threads) do |current_page|
|
25
|
+
objects = if @paged_objects[current_page].present?
|
26
|
+
@paged_objects[current_page]
|
27
|
+
else
|
28
|
+
load_more_call.call(current_page)
|
29
|
+
end
|
30
|
+
objects = [objects].flatten.compact
|
31
|
+
@paged_objects[current_page] = objects if objects.present?
|
30
32
|
objects.each do |obj|
|
31
33
|
yield obj
|
32
34
|
end
|
33
|
-
@paged_objects[next_page_no] = next_page_thread.value if next_page_thread
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
@@ -55,7 +55,8 @@ module Bright
|
|
55
55
|
:seed_page => students,
|
56
56
|
:total => total_results,
|
57
57
|
:per_page => params[:limit],
|
58
|
-
:load_more_call => load_more_call
|
58
|
+
:load_more_call => load_more_call,
|
59
|
+
:no_threads => options[:no_threads]
|
59
60
|
})
|
60
61
|
else
|
61
62
|
students
|
@@ -92,7 +93,8 @@ module Bright
|
|
92
93
|
:seed_page => schools,
|
93
94
|
:total => total_results,
|
94
95
|
:per_page => params[:limit],
|
95
|
-
:load_more_call => load_more_call
|
96
|
+
:load_more_call => load_more_call,
|
97
|
+
:no_threads => options[:no_threads]
|
96
98
|
})
|
97
99
|
else
|
98
100
|
schools
|
@@ -75,7 +75,8 @@ module Bright
|
|
75
75
|
:seed_page => students,
|
76
76
|
:total => total_results,
|
77
77
|
:per_page => params[:limit],
|
78
|
-
:load_more_call => load_more_call
|
78
|
+
:load_more_call => load_more_call,
|
79
|
+
:no_threads => options[:no_threads]
|
79
80
|
})
|
80
81
|
else
|
81
82
|
students
|
@@ -121,7 +122,8 @@ module Bright
|
|
121
122
|
:seed_page => schools,
|
122
123
|
:total => total_results,
|
123
124
|
:per_page => params[:limit],
|
124
|
-
:load_more_call => load_more_call
|
125
|
+
:load_more_call => load_more_call,
|
126
|
+
:no_threads => options[:no_threads]
|
125
127
|
})
|
126
128
|
else
|
127
129
|
schools
|
@@ -61,7 +61,8 @@ module Bright
|
|
61
61
|
:seed_page => students,
|
62
62
|
:total => total_results,
|
63
63
|
:per_page => params[:pagesize],
|
64
|
-
:load_more_call => load_more_call
|
64
|
+
:load_more_call => load_more_call,
|
65
|
+
:no_threads => options[:no_threads]
|
65
66
|
})
|
66
67
|
else
|
67
68
|
students
|
@@ -132,7 +133,8 @@ module Bright
|
|
132
133
|
:seed_page => schools,
|
133
134
|
:total => total_results,
|
134
135
|
:per_page => params[:pagesize],
|
135
|
-
:load_more_call => load_more_call
|
136
|
+
:load_more_call => load_more_call,
|
137
|
+
:no_threads => options[:no_threads]
|
136
138
|
})
|
137
139
|
else
|
138
140
|
schools
|
data/lib/bright/version.rb
CHANGED
data/lib/bright.rb
CHANGED
@@ -1,30 +1,31 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
require_relative "bright/version"
|
2
|
+
require_relative "bright/errors"
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
require_relative "bright/helpers/blank_helper.rb"
|
5
|
+
require_relative "bright/helpers/boolean_parser_helper.rb"
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
require_relative "bright/model"
|
8
|
+
require_relative "bright/student"
|
9
|
+
require_relative "bright/address"
|
10
|
+
require_relative "bright/phone_number"
|
11
|
+
require_relative "bright/email_address"
|
12
|
+
require_relative "bright/enrollment"
|
13
|
+
require_relative "bright/school"
|
14
|
+
require_relative "bright/contact"
|
15
15
|
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
require_relative "bright/connection"
|
18
|
+
require_relative "bright/response_collection"
|
19
|
+
require_relative "bright/cursor_response_collection"
|
20
20
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
21
|
+
require_relative "bright/sis_apis/base.rb"
|
22
|
+
require_relative "bright/sis_apis/tsis.rb"
|
23
|
+
require_relative "bright/sis_apis/power_school.rb"
|
24
|
+
require_relative "bright/sis_apis/aeries.rb"
|
25
|
+
require_relative "bright/sis_apis/infinite_campus.rb"
|
26
|
+
require_relative "bright/sis_apis/skyward.rb"
|
27
|
+
require_relative "bright/sis_apis/bright_sis.rb"
|
28
|
+
require_relative "bright/sis_apis/synergy.rb"
|
28
29
|
|
29
30
|
module Bright
|
30
31
|
class << self
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bright
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arux Software
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpi
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 0.5.4
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: parallel
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.2'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.2'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: bundler
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,7 +100,7 @@ description: Bright is a simple Student Information System API abstraction libra
|
|
86
100
|
away from the user to offer a consistent interface across all supported Student
|
87
101
|
Information System APIs.
|
88
102
|
email:
|
89
|
-
-
|
103
|
+
- hello@arux.software
|
90
104
|
executables: []
|
91
105
|
extensions: []
|
92
106
|
extra_rdoc_files: []
|
@@ -140,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
154
|
- !ruby/object:Gem::Version
|
141
155
|
version: '0'
|
142
156
|
requirements: []
|
143
|
-
rubygems_version: 3.
|
157
|
+
rubygems_version: 3.3.7
|
144
158
|
signing_key:
|
145
159
|
specification_version: 4
|
146
160
|
summary: Framework and tools for dealing with Student Information Systems
|