blackbaud-client 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/blackbaud-client.gemspec +2 -1
- data/lib/blackbaud-client/api/contact.rb +12 -0
- data/lib/blackbaud-client/api/contact_type.rb +12 -0
- data/lib/blackbaud-client/api/person.rb +6 -1
- data/lib/blackbaud-client.rb +16 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjdiNjZiYTAwNjMzMzNiZjEwNWI2ZWZjZTJmZDliNmNhNTk5YmY4OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzcyYTkzMjQ0MGY0MGE2ZDgyYzEwYzQyNDdjNjhjYTgwZTE3OTg3Yw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODlmOTY4YjE2NzBiYTg1ZTc2Zjk4MDMzMjkzNzcwYTNjNmUyMGE2YTQ2NDFi
|
10
|
+
YTExZDQ0Y2IzNDRiMTI4OWM0YjdlNmZlMDZhNDYyNDBmZDYwMGY1NmQyNDY5
|
11
|
+
NmJlMTJhMDY2MWY3ZTRiMGUwM2JlNGJhMTcxZDhkY2IzZmQwYmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmRmYmI5NjEyZWMzN2M1NTIwMmMxYjE0NWNjZWZhOTQwZDdkNTQ1ZTZmZmRi
|
14
|
+
YWU1NGVkYmZjMjI0MGU4YjNhZWU5NDUwZjE3MjNjY2I2YzliZjhlZmU1YjQ3
|
15
|
+
MGE2ZWI3OWRhODUyNTQxMGEyYTE5ZWQwYjUzNzE0ZWUwMDE3MDc=
|
data/blackbaud-client.gemspec
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
# gem build blackbaud-client.gemspec
|
1
2
|
# -*- encoding: utf-8 -*-
|
2
3
|
lib = File.expand_path('../lib/', __FILE__)
|
3
4
|
$:.unshift lib unless $:.include?(lib)
|
4
5
|
|
5
6
|
Gem::Specification.new do |gem|
|
6
7
|
gem.name = "blackbaud-client"
|
7
|
-
gem.version = "0.0.
|
8
|
+
gem.version = "0.0.4"
|
8
9
|
gem.authors = "Alex Dugger"
|
9
10
|
gem.email = "alexd@haikulearning.com"
|
10
11
|
gem.description = "A client for the Blackbaud API."
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Blackbaud
|
2
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)
|
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, :contacts)
|
4
4
|
|
5
5
|
def initialize(values, type_id)
|
6
6
|
|
@@ -11,6 +11,11 @@ module Blackbaud
|
|
11
11
|
values.delete("bio")
|
12
12
|
end
|
13
13
|
|
14
|
+
if values["contact_info"]
|
15
|
+
values["contacts"] = values["contact_info"].map! {|c| Blackbaud::Contact.new(c)}
|
16
|
+
values.delete("contact_info")
|
17
|
+
end
|
18
|
+
|
14
19
|
values["birth_date"] = format_date(values["birth_date"]) if values["birth_date"]
|
15
20
|
|
16
21
|
values.each do |k,v|
|
data/lib/blackbaud-client.rb
CHANGED
@@ -7,6 +7,8 @@ require 'blackbaud-client/api/session.rb'
|
|
7
7
|
require 'blackbaud-client/api/static_code_table.rb'
|
8
8
|
require 'blackbaud-client/api/table_entry.rb'
|
9
9
|
require 'blackbaud-client/api/term.rb'
|
10
|
+
require 'blackbaud-client/api/contact_type.rb'
|
11
|
+
require 'blackbaud-client/api/contact.rb'
|
10
12
|
require 'hmac-sha1'
|
11
13
|
require 'cgi'
|
12
14
|
require 'base64'
|
@@ -29,12 +31,13 @@ module Blackbaud
|
|
29
31
|
|
30
32
|
end
|
31
33
|
|
32
|
-
def construct_url(web_services_url, endpoint)
|
34
|
+
def construct_url(web_services_url, endpoint, filters=nil)
|
33
35
|
@url = "#{web_services_url}#{endpoint}?token=#{@token}"
|
36
|
+
@url << "&filter=(#{filters})" if filters
|
34
37
|
end
|
35
38
|
|
36
|
-
def connect(endpoint)
|
37
|
-
construct_url(@web_services_url, endpoint)
|
39
|
+
def connect(endpoint, filters=nil)
|
40
|
+
construct_url(@web_services_url, endpoint, filters)
|
38
41
|
JSON.parse(RestClient::Request.execute(:method=>'get', :url=>@url))
|
39
42
|
end
|
40
43
|
|
@@ -43,11 +46,21 @@ module Blackbaud
|
|
43
46
|
results["academic_years"].collect {|year| Blackbaud::AcademicYear.new(year)}
|
44
47
|
end
|
45
48
|
|
49
|
+
def contact_types
|
50
|
+
results = connect("global/code_tables/phone%20type")
|
51
|
+
results["table_entries"].collect {|ct| Blackbaud::ContactType.new(ct)}
|
52
|
+
end
|
53
|
+
|
46
54
|
def people(year)
|
47
55
|
results = connect("person/academic_years/#{year.ea7_academic_year_id}/people")
|
48
56
|
results["people"].first["faculty"].collect {|person| Blackbaud::Person.new(person, 1)} + results["people"].first["students"].collect {|person| Blackbaud::Person.new(person, 2)}
|
49
57
|
end
|
50
58
|
|
59
|
+
def people_with_contacts(year, contact_types)
|
60
|
+
results = connect("person/academic_years/#{year.ea7_academic_year_id}/people", "contact.type_id%20eq%20#{contact_types.join(',')}" )
|
61
|
+
results["people"].first["faculty"].collect {|person| Blackbaud::Person.new(person, 1)} + results["people"].first["students"].collect {|person| Blackbaud::Person.new(person, 2)}
|
62
|
+
end
|
63
|
+
|
51
64
|
def classes(year)
|
52
65
|
results = connect("schedule/academic_years/#{year.ea7_academic_year_id}/classes")
|
53
66
|
results["classes"].collect {|c| Blackbaud::Class.new(c)}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.4
|
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-
|
11
|
+
date: 2014-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A client for the Blackbaud API.
|
14
14
|
email: alexd@haikulearning.com
|
@@ -25,6 +25,8 @@ files:
|
|
25
25
|
- lib/blackbaud-client/api/blackbaud_object.rb
|
26
26
|
- lib/blackbaud-client/api/class.rb
|
27
27
|
- lib/blackbaud-client/api/code_table.rb
|
28
|
+
- lib/blackbaud-client/api/contact.rb
|
29
|
+
- lib/blackbaud-client/api/contact_type.rb
|
28
30
|
- lib/blackbaud-client/api/person.rb
|
29
31
|
- lib/blackbaud-client/api/session.rb
|
30
32
|
- lib/blackbaud-client/api/static_code_table.rb
|