blackbaud-client 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/LICENSE.txt +1 -1
- data/blackbaud-client.gemspec +4 -2
- data/lib/blackbaud-client.rb +21 -16
- data/lib/blackbaud-client/api/academic_year.rb +8 -0
- data/lib/blackbaud-client/api/term.rb +4 -0
- metadata +32 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWI4MTAwMjg4NGU0Yjk2NjZlNGYzNDJjYWJiNjFjYTc1NDg3ZjVjZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTI2ZTQwNzg4MTY0YTIzYjk5ODA2MjMwYjFlOWI4NGU2MzNhNzU4MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzU2YWIzZGE1YTA3NjhjMTAwNjM2YWNlZDA3MzY5M2QzOTRiMjQxN2EyMjE0
|
10
|
+
NjY3NTZiYTEyZjZjNzNmZGQyNmU3MmU4MzJlZTY3MTk5NjYyYjI4ZjU4ZjNl
|
11
|
+
ZWEwMTRjYjg5Njg2N2JkNDlkYzQ3NzkwMzgxZThlOTBlNzExNWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTdjNGMxZWVlYzAwZDg0NTNkZmZjYWQ1ZTcyODcxN2E0NGU2ZmU1YzIzNDQw
|
14
|
+
OTNjOWEwYTdiZWM0MmQ0NWQ2ZTYyMGRiOGUzODIzMGZkNmU3MzIzYjM4NWJl
|
15
|
+
ZDVjYTBkZmYwNTZmNTg5ZmQ0Y2MyYjRjNWU4YzY0YzRhMDIwNGQ=
|
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2014 Alex Dugger, Haiku Learning Systems
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/blackbaud-client.gemspec
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
# gem build blackbaud-client.gemspec
|
2
1
|
# -*- encoding: utf-8 -*-
|
3
2
|
lib = File.expand_path('../lib/', __FILE__)
|
4
3
|
$:.unshift lib unless $:.include?(lib)
|
5
4
|
|
6
5
|
Gem::Specification.new do |gem|
|
7
6
|
gem.name = "blackbaud-client"
|
8
|
-
gem.version = "0.0.
|
7
|
+
gem.version = "0.0.5"
|
9
8
|
gem.authors = "Alex Dugger"
|
10
9
|
gem.email = "alexd@haikulearning.com"
|
11
10
|
gem.description = "A client for the Blackbaud API."
|
@@ -13,4 +12,7 @@ Gem::Specification.new do |gem|
|
|
13
12
|
gem.summary = "A client for the Blackbaud API."
|
14
13
|
gem.files = `git ls-files`.split($/)
|
15
14
|
gem.require_path = 'lib'
|
15
|
+
gem.add_runtime_dependency 'ruby-hmac'
|
16
|
+
gem.add_runtime_dependency 'rest-client'
|
17
|
+
|
16
18
|
end
|
data/lib/blackbaud-client.rb
CHANGED
@@ -19,20 +19,25 @@ require 'date'
|
|
19
19
|
module Blackbaud
|
20
20
|
class Client
|
21
21
|
|
22
|
+
USER_TYPE = {
|
23
|
+
:faculty => 1,
|
24
|
+
:student => 2
|
25
|
+
}
|
26
|
+
|
22
27
|
def initialize(options)
|
23
28
|
auth_params = {
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
29
|
+
:database_key => options[:database_key],
|
30
|
+
:database_number => options[:database_number],
|
31
|
+
:vendor_id => options[:vendor_id],
|
32
|
+
:vendor_key => options[:vendor_key]
|
28
33
|
}.to_json
|
29
34
|
@web_services_url = options[:url]
|
30
|
-
@token = JSON.parse(RestClient.post (@web_services_url+'security/access_token'), auth_params, {:content_type=>'application/json'})["token"]
|
35
|
+
@token = JSON.parse(RestClient.post (@web_services_url+'/security/access_token'), auth_params, {:content_type=>'application/json'})["token"]
|
31
36
|
|
32
37
|
end
|
33
38
|
|
34
39
|
def construct_url(web_services_url, endpoint, filters=nil)
|
35
|
-
@url = "#{web_services_url}
|
40
|
+
@url = "#{web_services_url}/#{endpoint}?token=#{@token}"
|
36
41
|
@url << "&filter=(#{filters})" if filters
|
37
42
|
end
|
38
43
|
|
@@ -51,18 +56,18 @@ module Blackbaud
|
|
51
56
|
results["table_entries"].collect {|ct| Blackbaud::ContactType.new(ct)}
|
52
57
|
end
|
53
58
|
|
54
|
-
def people(
|
55
|
-
|
56
|
-
results
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
def people(scope, contact_types=nil)
|
60
|
+
filter = contact_types.is_a?(Array) ? "contact.type_id%20eq%20#{contact_types.join(',')}" : nil
|
61
|
+
results = connect("person/#{scope.connection_string}/people", filter )
|
62
|
+
r = [:faculty, :students].collect do |t|
|
63
|
+
p = results["people"].first[t.to_s]
|
64
|
+
(p.nil? ? [] : p.collect {|person| Blackbaud::Person.new(person, (USER_TYPE[t]))})
|
65
|
+
end
|
66
|
+
r.flatten(1)
|
62
67
|
end
|
63
68
|
|
64
|
-
def classes(
|
65
|
-
results = connect("schedule
|
69
|
+
def classes(scope)
|
70
|
+
results = connect("schedule/#{scope.connection_string}/classes")
|
66
71
|
results["classes"].collect {|c| Blackbaud::Class.new(c)}
|
67
72
|
end
|
68
73
|
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blackbaud-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alex Dugger
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
-
dependencies:
|
11
|
+
date: 2014-04-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: ruby-hmac
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ! '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ! '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rest-client
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
description: A client for the Blackbaud API.
|
14
42
|
email: alexd@haikulearning.com
|
15
43
|
executables: []
|
@@ -51,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
79
|
version: '0'
|
52
80
|
requirements: []
|
53
81
|
rubyforge_project:
|
54
|
-
rubygems_version: 2.2.
|
82
|
+
rubygems_version: 2.2.2
|
55
83
|
signing_key:
|
56
84
|
specification_version: 4
|
57
85
|
summary: A client for the Blackbaud API.
|