ed_fi_client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +78 -0
- data/.ruby-version +1 -0
- data/.travis.yml +5 -0
- data/.yardopts +1 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +65 -0
- data/LICENSE.txt +21 -0
- data/README.md +113 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/docs/EdFi.html +127 -0
- data/docs/EdFi/Client.html +1204 -0
- data/docs/EdFi/Client/AccessToken.html +541 -0
- data/docs/EdFi/Client/ArgumentError.html +143 -0
- data/docs/EdFi/Client/Auth.html +440 -0
- data/docs/EdFi/Client/Error.html +139 -0
- data/docs/EdFi/Client/Proxy.html +521 -0
- data/docs/EdFi/Client/Response.html +479 -0
- data/docs/EdFi/Client/UnableToAuthenticateError.html +145 -0
- data/docs/_index.html +203 -0
- data/docs/class_list.html +51 -0
- data/docs/css/common.css +1 -0
- data/docs/css/full_list.css +58 -0
- data/docs/css/style.css +499 -0
- data/docs/file.README.html +124 -0
- data/docs/file_list.html +56 -0
- data/docs/frames.html +17 -0
- data/docs/index.html +124 -0
- data/docs/js/app.js +248 -0
- data/docs/js/full_list.js +216 -0
- data/docs/js/jquery.js +4 -0
- data/docs/method_list.html +235 -0
- data/docs/top-level-namespace.html +110 -0
- data/ed_fi_client.gemspec +32 -0
- data/lib/ed_fi/client.rb +244 -0
- data/lib/ed_fi/client/access_token.rb +63 -0
- data/lib/ed_fi/client/auth.rb +99 -0
- data/lib/ed_fi/client/errors.rb +19 -0
- data/lib/ed_fi/client/proxy.rb +65 -0
- data/lib/ed_fi/client/response.rb +150 -0
- data/lib/ed_fi/client/version.rb +18 -0
- data/lib/ed_fi_client.rb +1 -0
- metadata +201 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 91f16e3849cc8bec80fcf68483932d75c7fe8221cd16d553e5f1bd2bb381e0d7
|
4
|
+
data.tar.gz: c4b25b4a6cb267155f41b89c4fa5f1895855a7efcbc5314a4ccfc29421cc669e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7c026d408a34de9255917942482602e7300447b849013cf825f7c1b2fb62f362156e47d292ac56f013eeea15be35f1d064225fdc5d2c902e74d2d8a49bdd7691
|
7
|
+
data.tar.gz: d624dff599c036d39c4c3038e34a11ed0446e56397c57f616714071705e9bc02a3a1ac9642cc9f21f2c806d04d7a8be42787e77a1c204440378ab78ec939bac2
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5
|
3
|
+
Include:
|
4
|
+
- "**/*.rake"
|
5
|
+
- "**/Gemfile"
|
6
|
+
- "**/Rakefile"
|
7
|
+
- "**/Capfile"
|
8
|
+
- "**/Berksfile"
|
9
|
+
- "**/Cheffile"
|
10
|
+
Exclude:
|
11
|
+
- "vendor/**/*"
|
12
|
+
- "db/**/*"
|
13
|
+
- "tmp/**/*"
|
14
|
+
- "true/**/*"
|
15
|
+
Metrics/ClassLength:
|
16
|
+
Description: Avoid classes longer than 100 lines of code.
|
17
|
+
Enabled: false
|
18
|
+
CountComments: false
|
19
|
+
Max: 100
|
20
|
+
Metrics/LineLength:
|
21
|
+
Description: Limit lines to 100 characters.
|
22
|
+
Enabled: false
|
23
|
+
Max: 100
|
24
|
+
Metrics/BlockLength:
|
25
|
+
Exclude:
|
26
|
+
- 'spec/**/*.rb'
|
27
|
+
Metrics/MethodLength:
|
28
|
+
Description: Avoid methods longer than 10 lines of code.
|
29
|
+
StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
|
30
|
+
Enabled: false
|
31
|
+
CountComments: false
|
32
|
+
Max: 10
|
33
|
+
Metrics/AbcSize:
|
34
|
+
Description: A calculated magnitude based on number of assignments, branches, and conditions.
|
35
|
+
Enabled: false
|
36
|
+
Max: 15
|
37
|
+
Metrics/CyclomaticComplexity:
|
38
|
+
Description: A complexity metric that is strongly correlated to the number of test cases needed to validate a method.
|
39
|
+
Enabled: false
|
40
|
+
Max: 6
|
41
|
+
Lint/Debugger:
|
42
|
+
Description: Warn in debugger entries
|
43
|
+
Enabled: false
|
44
|
+
Style/SymbolArray:
|
45
|
+
Description: Use %i or %I for arrays of symbols.
|
46
|
+
Enabled: false
|
47
|
+
Style/RegexpLiteral:
|
48
|
+
Description: Enforces using / or %r around regular expressions.
|
49
|
+
EnforcedStyle: percent_r
|
50
|
+
Style/AsciiComments:
|
51
|
+
# Disabling this so we can use non-breaking spaces (' ') in documentation comments, preventing browsers from collapsing multiple spaces in code blocks.
|
52
|
+
Description: This cop checks for non-ascii (non-English) characters in comments.
|
53
|
+
Enabled: false
|
54
|
+
Style/NumericLiterals:
|
55
|
+
Description: This cop checks for big numeric literals without _ between groups of digits in them.
|
56
|
+
Enabled: false
|
57
|
+
Style/Documentation:
|
58
|
+
Description: Document classes and non-namespace modules.
|
59
|
+
Enabled: false
|
60
|
+
Style/ClassAndModuleChildren:
|
61
|
+
Description: Use nested modules/class definitions instead of compact style.
|
62
|
+
Enabled: false
|
63
|
+
Style/FrozenStringLiteralComment:
|
64
|
+
Enabled: false
|
65
|
+
Style/EmptyMethod:
|
66
|
+
Enabled: false
|
67
|
+
Style/StderrPuts:
|
68
|
+
Enabled: true
|
69
|
+
Exclude:
|
70
|
+
- 'bin/**/*'
|
71
|
+
Style/BlockDelimiters:
|
72
|
+
Description: Check for uses of braces or do/end around single line or multi-line blocks.
|
73
|
+
Enabled: true
|
74
|
+
Exclude:
|
75
|
+
- 'spec/**/*.rb'
|
76
|
+
Style/RescueModifier:
|
77
|
+
Description: This cop checks for uses of rescue in its modifier form.
|
78
|
+
Enabled: false
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--output-dir=./docs --no-private --markup=markdown --format=html
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
ed_fi_client (0.1.0)
|
5
|
+
activesupport (~> 5.2.0)
|
6
|
+
crapi (~> 0.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (5.2.0)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 0.7, < 2)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
byebug (10.0.2)
|
17
|
+
coderay (1.1.2)
|
18
|
+
concurrent-ruby (1.0.5)
|
19
|
+
crapi (0.1.2)
|
20
|
+
activesupport (~> 5.2.0)
|
21
|
+
diff-lcs (1.3)
|
22
|
+
i18n (1.0.1)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
method_source (0.9.0)
|
25
|
+
minitest (5.11.3)
|
26
|
+
pry (0.11.3)
|
27
|
+
coderay (~> 1.1.0)
|
28
|
+
method_source (~> 0.9.0)
|
29
|
+
pry-byebug (3.6.0)
|
30
|
+
byebug (~> 10.0)
|
31
|
+
pry (~> 0.10)
|
32
|
+
rake (10.5.0)
|
33
|
+
rspec (3.7.0)
|
34
|
+
rspec-core (~> 3.7.0)
|
35
|
+
rspec-expectations (~> 3.7.0)
|
36
|
+
rspec-mocks (~> 3.7.0)
|
37
|
+
rspec-core (3.7.1)
|
38
|
+
rspec-support (~> 3.7.0)
|
39
|
+
rspec-expectations (3.7.0)
|
40
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
+
rspec-support (~> 3.7.0)
|
42
|
+
rspec-mocks (3.7.0)
|
43
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
44
|
+
rspec-support (~> 3.7.0)
|
45
|
+
rspec-support (3.7.1)
|
46
|
+
rspec_junit_formatter (0.3.0)
|
47
|
+
rspec-core (>= 2, < 4, != 2.12.0)
|
48
|
+
thread_safe (0.3.6)
|
49
|
+
tzinfo (1.2.5)
|
50
|
+
thread_safe (~> 0.1)
|
51
|
+
|
52
|
+
PLATFORMS
|
53
|
+
ruby
|
54
|
+
|
55
|
+
DEPENDENCIES
|
56
|
+
bundler (~> 1.16)
|
57
|
+
ed_fi_client!
|
58
|
+
pry (~> 0.11)
|
59
|
+
pry-byebug (~> 3.6)
|
60
|
+
rake (~> 10.0)
|
61
|
+
rspec (~> 3.0)
|
62
|
+
rspec_junit_formatter (~> 0.3)
|
63
|
+
|
64
|
+
BUNDLED WITH
|
65
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Nestor Custodio
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
# EdFi::Client [![Gem Version](https://badge.fury.io/rb/ed_fi_client.svg)](https://badge.fury.io/rb/ed_fi_client)
|
2
|
+
|
3
|
+
A utility class for authenticating to and making CRUD calls against an Ed-Fi ODS API.
|
4
|
+
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'ed_fi_client'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install ed_fi_client
|
21
|
+
|
22
|
+
|
23
|
+
## Using EdFi::Client
|
24
|
+
|
25
|
+
### Basic Usage: Reading Data
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
## Establish a connection to an Ed-Fi ODS / API.
|
29
|
+
## (We'll use the Alliance-hosted Ed-Fi ODS / API sandbox instance.)
|
30
|
+
|
31
|
+
sandbox = EdFi::Client.new(
|
32
|
+
'https://api.ed-fi.org/api/',
|
33
|
+
client_id: 'RvcohKz9zHI4',
|
34
|
+
client_secret: 'E1iEFusaNf81xzCxwHfbolkC'
|
35
|
+
)
|
36
|
+
|
37
|
+
sandbox = sandbox.v2(2017) ## For purposes of these samples, we're only
|
38
|
+
## concerned with 2017-2018 school-year data.
|
39
|
+
|
40
|
+
|
41
|
+
## Let's pull some assorted values!
|
42
|
+
|
43
|
+
sandbox.get('schools', query: { school_id: 255901001 }) ## Get school 255901001.
|
44
|
+
|
45
|
+
sandbox.get('disciplineIncidents') ## Get all discipline incidents.
|
46
|
+
sandbox.get('disciplineIncidents').sample.school ## A random incident's school.
|
47
|
+
|
48
|
+
all_schools = sandbox.get('schools') ## All schools.
|
49
|
+
all_schools.sample.name_of_institution ## A random school's name.
|
50
|
+
all_schools.map { |i| [i.id, i.school_id] }.to_h ## Maps ODS IDs to school IDs.
|
51
|
+
```
|
52
|
+
|
53
|
+
---
|
54
|
+
|
55
|
+
### Basic Usage: Writing Data
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
sandbox = EdFi::Client.new(
|
59
|
+
'https://api.ed-fi.org/api/',
|
60
|
+
client_id: 'RvcohKz9zHI4',
|
61
|
+
client_secret: 'E1iEFusaNf81xzCxwHfbolkC'
|
62
|
+
).v2(2017)
|
63
|
+
|
64
|
+
school = sandbox.get('schools').sample
|
65
|
+
original_name = school.name_of_institution ## So we can leave it like we found it.
|
66
|
+
|
67
|
+
|
68
|
+
## Via PUT ...
|
69
|
+
|
70
|
+
school.name_of_institution = 'New Name, via PUT'
|
71
|
+
sandbox.put("schools/#{school.id}", payload: school)
|
72
|
+
sandbox.get("schools/#{school.id}").name_of_institution ## => "New Name, via PUT"
|
73
|
+
|
74
|
+
|
75
|
+
## Via POST ...
|
76
|
+
|
77
|
+
school.name_of_institution = 'New Name, via POST'
|
78
|
+
sandbox.post("schools", payload: school.except(:id))
|
79
|
+
sandbox.get("schools/#{school.id}").name_of_institution ## => "New Name, via POST"
|
80
|
+
|
81
|
+
|
82
|
+
## Let's leave things like we found them.
|
83
|
+
|
84
|
+
school.name_of_institution = original_name
|
85
|
+
sandbox.put("schools/#{school.id}", payload: school)
|
86
|
+
```
|
87
|
+
|
88
|
+
---
|
89
|
+
|
90
|
+
[Consult the repo docs for the full EdFi::Client documentation.](http://nestor-custodio.github.io/ed_fi_client/EdFi/Client.html)
|
91
|
+
|
92
|
+
|
93
|
+
## Feature Roadmap / Future Development
|
94
|
+
|
95
|
+
Additional features/options coming in the future:
|
96
|
+
|
97
|
+
- Cleaner handling of non-body-returning calls.
|
98
|
+
- Use the given base endpoint's Swagger API definition file (if present) to make collections/resources more easily reachable: `#schools`, `#discipline_incidents`, etc.
|
99
|
+
- Allow for easier manipulation of resources via AR-like methods (`#find`, `#find_by`, `#where`, `#create`, `#update`, etc).
|
100
|
+
|
101
|
+
|
102
|
+
## Contribution / Development
|
103
|
+
|
104
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nestor-custodio/ed_fi_client.
|
105
|
+
|
106
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
107
|
+
|
108
|
+
Linting is courtesy of [Rubocop](https://github.com/bbatsov/rubocop) and documentation is built using [Yard](https://yardoc.org/). Neither is included in the Gemspec; you'll need to install these locally (`gem install rubocop yard`) to take advantage.
|
109
|
+
|
110
|
+
|
111
|
+
## License
|
112
|
+
|
113
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'ed_fi_client'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'irb'
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/docs/EdFi.html
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: EdFi
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.12
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "EdFi";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html?1"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (E)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">EdFi</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<div id="content"><h1>Module: EdFi
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
</h1>
|
67
|
+
<div class="box_info">
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<dl>
|
80
|
+
<dt>Defined in:</dt>
|
81
|
+
<dd>lib/ed_fi/client/version.rb</dd>
|
82
|
+
</dl>
|
83
|
+
|
84
|
+
</div>
|
85
|
+
|
86
|
+
<h2>Overview</h2><div class="docstring">
|
87
|
+
<div class="discussion">
|
88
|
+
|
89
|
+
<p>The EdFi module houses the <span class='object_link'><a href="EdFi/Client.html" title="EdFi::Client (class)">EdFi::Client</a></span> in this gem, but
|
90
|
+
should also house future EdFi tooling.</p>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
</div>
|
95
|
+
<div class="tags">
|
96
|
+
|
97
|
+
|
98
|
+
</div><h2>Defined Under Namespace</h2>
|
99
|
+
<p class="children">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="EdFi/Client.html" title="EdFi::Client (class)">Client</a></span>
|
105
|
+
|
106
|
+
|
107
|
+
</p>
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
</div>
|
118
|
+
|
119
|
+
<div id="footer">
|
120
|
+
Generated on Thu May 24 18:35:37 2018 by
|
121
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
122
|
+
0.9.12 (ruby-2.5.1).
|
123
|
+
</div>
|
124
|
+
|
125
|
+
</div>
|
126
|
+
</body>
|
127
|
+
</html>
|