blackbaud-client 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/lib/blackbaud-client/version.rb +1 -1
- data/lib/blackbaud-client.rb +13 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MDQ2MmJjZGU3NGVlMzI2ODcxMmJkNjc5N2ZiYzU3Y2JkYzU3OTc2NA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzkwODFlNDgwYTUxMDQ5YTQ5ODQ5ZDlhNDNlYzBiOGE5NTlhODg3OA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YWYyNTZjYjIxNmE5NDU1MjA4YmY4ZTE4ZDBmYzFmNWJhYzdjZTgwNTAzZmZi
|
10
|
+
YTg0YTNjM2FiOTY0OTM5OTdhNzA2MmVmMGVjMmFiMDRmYmU4NWJhMzRmMGQ1
|
11
|
+
ZDI0NzhhMTIyNjU4Mzk1ZDAwNjViODMwZTZiYWViZGZmNjY1ZDg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YWY1ZTM3NGViZDI4OTI4ZDVjNzVkMmE4YTJkNzY5MzE4MzQ0NTNhZWYxZTBi
|
14
|
+
ODQ4ZWIxZjE0NTFkMTk5MjQzNzNjYWQ4NWQyNWE4YmE4Mzg1YWM3MmQ0Zjhl
|
15
|
+
NGY4MTNjYmEzYTM4YmVkY2FkN2QyMTdhN2EyZWU2MDIzZjFmOWY=
|
data/.gitignore
CHANGED
data/lib/blackbaud-client.rb
CHANGED
@@ -30,13 +30,14 @@ module Blackbaud
|
|
30
30
|
}.to_json
|
31
31
|
@web_services_url = options[:url]
|
32
32
|
@token = JSON.parse(RestClient.post (@web_services_url+'/security/access_token'), auth_params, {:content_type=>'application/json'})["token"]
|
33
|
-
|
33
|
+
@save_request_data_to = options[:save_request_data_to]
|
34
34
|
end
|
35
35
|
|
36
36
|
def connect(endpoint, filters=nil)
|
37
37
|
url = construct_url(@web_services_url, endpoint, filters)
|
38
|
-
|
39
|
-
|
38
|
+
json = RestClient::Request.execute(:method=>'get', :url=>url)
|
39
|
+
write_json_to_file(url, json) if @save_request_data_to
|
40
|
+
JSON.parse(json)
|
40
41
|
end
|
41
42
|
|
42
43
|
def academic_years(id)
|
@@ -104,6 +105,15 @@ module Blackbaud
|
|
104
105
|
|
105
106
|
private
|
106
107
|
|
108
|
+
def write_json_to_file(url, data)
|
109
|
+
return unless data
|
110
|
+
file = url.gsub( /\/|\\/, ':' ).match(/.{,250}$/).to_s + '.json'
|
111
|
+
# file = /[^\/]*$/.match(url).to_s + '.json'
|
112
|
+
file = File.expand_path(File.join(@save_request_data_to, file))
|
113
|
+
FileUtils.mkdir_p @save_request_data_to
|
114
|
+
File.open(file, 'w') { |f| f.write(data) }
|
115
|
+
end
|
116
|
+
|
107
117
|
def construct_url(web_services_url, endpoint, filters=nil)
|
108
118
|
url = "#{web_services_url}/#{endpoint}?token=#{@token}"
|
109
119
|
filters = Array(filters).map do |k,v|
|
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.1.
|
4
|
+
version: 0.1.1
|
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-08-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ruby-hmac
|