blackbaud-client 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +6 -0
- data/LICENSE.txt +21 -0
- data/README.md +17 -0
- data/blackbaud-client.gemspec +15 -0
- data/lib/blackbaud-client.rb +71 -0
- data/lib/blackbaud-client/api/academic_year.rb +21 -0
- data/lib/blackbaud-client/api/blackbaud_object.rb +9 -0
- data/lib/blackbaud-client/api/class.rb +16 -0
- data/lib/blackbaud-client/api/code_table.rb +13 -0
- data/lib/blackbaud-client/api/person.rb +22 -0
- data/lib/blackbaud-client/api/session.rb +16 -0
- data/lib/blackbaud-client/api/static_code_table.rb +13 -0
- data/lib/blackbaud-client/api/table_entry.rb +13 -0
- data/lib/blackbaud-client/api/term.rb +14 -0
- metadata +56 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
OTZjZmQyMzcyNTcxMWIwNTNhMjY2YzhlYzhmYTE3ZmVlZGZhZjZmYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YzliMDlhM2Q1ZGIyOWUxNmU2NDk4NTE1MGZmZWViZTJhZGY0NjdkYg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDAwMDk2MTkzZWI2YzE1YjVmMzQ1NDAwZGEyMjdlMmYyODgxMzdkMDBjMDc0
|
10
|
+
MDBkZGIzYzM2MzNkOGM2YzU4ZDZjZDAzNzhlMDI2NTkwNDEwYjhmNmJjYmE2
|
11
|
+
Mzc4ODBjMDI4M2YxNDk1ZDM1YjJhZWE5YjNhMWE0ZTJkYmVhYjQ=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NzY4NDI1NTAwNzFiNGYxMzQ2MmEyYmM5YmE1YjRiMGRkNGU3ZWNhMjE4YTAz
|
14
|
+
NWQwYmY5YmExY2Y3NDU2MTZkNjEyNzRhMWVjZDc2ZjNiOWUyZWZjNWNjOWM1
|
15
|
+
NDI2MzE1MDg0NDU5MDg5YjZkODE5NWZkMWNmZGQ4ODBjMWU0ZmQ=
|
data/.gitignore
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 Alex Dugger, Haiku Learning Systems
|
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,17 @@
|
|
1
|
+
# Clever::Ruby
|
2
|
+
|
3
|
+
Ruby bindings to the Blackbaud API.
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Create a Blackbaud API Client
|
8
|
+
|
9
|
+
options = {
|
10
|
+
:password => "pass",
|
11
|
+
:key => "abcde",
|
12
|
+
:username => "user",
|
13
|
+
:database => "1"
|
14
|
+
:url => "https://blackbaud.api.url.example/key/"
|
15
|
+
}
|
16
|
+
|
17
|
+
@client = Blackbaud::Client.new(options)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib/', __FILE__)
|
3
|
+
$:.unshift lib unless $:.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |gem|
|
6
|
+
gem.name = "blackbaud-client"
|
7
|
+
gem.version = "0.0.2"
|
8
|
+
gem.authors = "Alex Dugger"
|
9
|
+
gem.email = "alexd@haikulearning.com"
|
10
|
+
gem.description = "A client for the Blackbaud API."
|
11
|
+
gem.homepage = "https://github.com/haikulearning/blackbaud-api-client"
|
12
|
+
gem.summary = "A client for the Blackbaud API."
|
13
|
+
gem.files = `git ls-files`.split($/)
|
14
|
+
gem.require_path = 'lib'
|
15
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'blackbaud-client/api/blackbaud_object.rb'
|
2
|
+
require 'blackbaud-client/api/academic_year.rb'
|
3
|
+
require 'blackbaud-client/api/class.rb'
|
4
|
+
require 'blackbaud-client/api/code_table.rb'
|
5
|
+
require 'blackbaud-client/api/person.rb'
|
6
|
+
require 'blackbaud-client/api/session.rb'
|
7
|
+
require 'blackbaud-client/api/static_code_table.rb'
|
8
|
+
require 'blackbaud-client/api/table_entry.rb'
|
9
|
+
require 'blackbaud-client/api/term.rb'
|
10
|
+
require 'hmac-sha1'
|
11
|
+
require 'cgi'
|
12
|
+
require 'base64'
|
13
|
+
require 'json'
|
14
|
+
require 'rest-client'
|
15
|
+
require 'date'
|
16
|
+
|
17
|
+
module Blackbaud
|
18
|
+
class Client
|
19
|
+
|
20
|
+
def initialize(options)
|
21
|
+
auth_params = {
|
22
|
+
:password => options[:password],
|
23
|
+
:key => options[:key],
|
24
|
+
:user_name => options[:username],
|
25
|
+
:database_number => options[:database]
|
26
|
+
}.to_json
|
27
|
+
@web_services_url = options[:url]
|
28
|
+
@token = JSON.parse(RestClient.post (@web_services_url+'security/access_token'), auth_params, {:content_type=>'application/json'})["token"]
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
def construct_url(web_services_url, endpoint)
|
33
|
+
@url = "#{web_services_url}#{endpoint}?token=#{@token}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def connect(endpoint)
|
37
|
+
construct_url(@web_services_url, endpoint)
|
38
|
+
JSON.parse(RestClient::Request.execute(:method=>'get', :url=>@url))
|
39
|
+
end
|
40
|
+
|
41
|
+
def academic_years(id)
|
42
|
+
results = connect("schedule/#{id}/academic_years")
|
43
|
+
results["academic_years"].collect {|year| Blackbaud::AcademicYear.new(year)}
|
44
|
+
end
|
45
|
+
|
46
|
+
def people(year)
|
47
|
+
results = connect("person/academic_years/#{year.ea7_academic_year_id}/people")
|
48
|
+
results["people"].first["faculty"].collect {|person| Blackbaud::Person.new(person, 1)} + results["people"].first["students"].collect {|person| Blackbaud::Person.new(person, 2)}
|
49
|
+
end
|
50
|
+
|
51
|
+
def classes(year)
|
52
|
+
results = connect("schedule/academic_years/#{year.ea7_academic_year_id}/classes")
|
53
|
+
results["classes"].collect {|c| Blackbaud::Class.new(c)}
|
54
|
+
end
|
55
|
+
|
56
|
+
def code_tables
|
57
|
+
results = connect("global/code_tables")
|
58
|
+
results["code_tables"].collect {|table| Blackbaud::CodeTable.new(table)}
|
59
|
+
end
|
60
|
+
|
61
|
+
def code_table_entries(code_table)
|
62
|
+
results = connect("global/code_tables/#{code_table.id}")
|
63
|
+
results["table_entries"].collect {|entry| Blackbaud::TableEntry.new(entry)}
|
64
|
+
end
|
65
|
+
|
66
|
+
def static_code_tables(id)
|
67
|
+
results = connect("global/static_code_tables/#{id}")
|
68
|
+
results["table_entries"].collect {|c| Blackbaud::TableEntry.new(c)}
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Blackbaud
|
2
|
+
class AcademicYear < BlackbaudObject
|
3
|
+
attr_accessor(:description, :ea7_academic_year_id, :end_date, :school_id, :school_name, :sessions, :short_description, :start_date, :links)
|
4
|
+
|
5
|
+
def initialize(values)
|
6
|
+
|
7
|
+
values["sessions"].map! {|s| Blackbaud::Session.new(s)} if values["sessions"]
|
8
|
+
|
9
|
+
["start_date", "end_date"].each do |date|
|
10
|
+
send("#{date}=".intern, format_date(values["#{date}"]))
|
11
|
+
values.delete("#{date}")
|
12
|
+
end
|
13
|
+
|
14
|
+
values.each do |k,v|
|
15
|
+
send("#{k}=".intern, v)
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Blackbaud
|
2
|
+
class Class < BlackbaudObject
|
3
|
+
attr_accessor(:ea7_class_id, :course_id, :course_name, :section, :ea7_term_id, :ea7_term_name, :faculty, :students)
|
4
|
+
|
5
|
+
def initialize(values)
|
6
|
+
|
7
|
+
values["faculty"].map! {|s| Blackbaud::Person.new(s, 1)} if values["faculty"]
|
8
|
+
values["students"].map! {|s| Blackbaud::Person.new(s, 2)} if values["students"]
|
9
|
+
|
10
|
+
values.each do |k,v|
|
11
|
+
send("#{k}=".intern, v)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Blackbaud
|
2
|
+
class Person < BlackbaudObject
|
3
|
+
attr_accessor(:ea7_record_id, :name_for_display, :type, :birth_date, :first_name, :import_id, :last_name, :record_type, :title, :suffix, :middle_name, :user_defined_id, :nickname)
|
4
|
+
|
5
|
+
def initialize(values, type_id)
|
6
|
+
|
7
|
+
values["type"] = type_id
|
8
|
+
|
9
|
+
if values["bio"]
|
10
|
+
values["bio"].each {|k, v| values[k] = v}
|
11
|
+
values.delete("bio")
|
12
|
+
end
|
13
|
+
|
14
|
+
values["birth_date"] = format_date(values["birth_date"]) if values["birth_date"]
|
15
|
+
|
16
|
+
values.each do |k,v|
|
17
|
+
send("#{k}=".intern, v)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Blackbaud
|
2
|
+
class Session < BlackbaudObject
|
3
|
+
attr_accessor(:name, :ea7_session_id, :terms, :links)
|
4
|
+
|
5
|
+
def initialize(values)
|
6
|
+
|
7
|
+
values["terms"].map! {|t| Blackbaud::Term.new(t)} if values["terms"]
|
8
|
+
|
9
|
+
values.each do |k,v|
|
10
|
+
send("#{k}=".intern, v)
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: blackbaud-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alex Dugger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A client for the Blackbaud API.
|
14
|
+
email: alexd@haikulearning.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- .gitignore
|
20
|
+
- LICENSE.txt
|
21
|
+
- README.md
|
22
|
+
- blackbaud-client.gemspec
|
23
|
+
- lib/blackbaud-client.rb
|
24
|
+
- lib/blackbaud-client/api/academic_year.rb
|
25
|
+
- lib/blackbaud-client/api/blackbaud_object.rb
|
26
|
+
- lib/blackbaud-client/api/class.rb
|
27
|
+
- lib/blackbaud-client/api/code_table.rb
|
28
|
+
- lib/blackbaud-client/api/person.rb
|
29
|
+
- lib/blackbaud-client/api/session.rb
|
30
|
+
- lib/blackbaud-client/api/static_code_table.rb
|
31
|
+
- lib/blackbaud-client/api/table_entry.rb
|
32
|
+
- lib/blackbaud-client/api/term.rb
|
33
|
+
homepage: https://github.com/haikulearning/blackbaud-api-client
|
34
|
+
licenses: []
|
35
|
+
metadata: {}
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
requirements: []
|
51
|
+
rubyforge_project:
|
52
|
+
rubygems_version: 2.2.1
|
53
|
+
signing_key:
|
54
|
+
specification_version: 4
|
55
|
+
summary: A client for the Blackbaud API.
|
56
|
+
test_files: []
|