church_community_builder 0.0.11 → 0.0.12
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 +4 -4
- data/README.md +1 -0
- data/church_community_builder.gemspec +1 -1
- data/lib/church_community_builder/resources/campus.rb +1 -1
- data/lib/church_community_builder/resources/contribution.rb +1 -1
- data/lib/church_community_builder/resources/fund.rb +1 -1
- data/lib/church_community_builder/resources/person.rb +2 -2
- data/lib/church_community_builder/response/campus.rb +15 -13
- data/lib/church_community_builder/response/contribution.rb +14 -12
- data/lib/church_community_builder/response/fund.rb +14 -12
- data/lib/church_community_builder/response/person.rb +24 -22
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 00758bc1f576757f0ef02435f2218fe82c6960cd
|
|
4
|
+
data.tar.gz: 29c6aad97d3edb45751394f9369c2428e3d07529
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94142c6d9af5ba63a338c5b07ba85987b6558dfd8e4e5f66906eeaf6cc54d97f51f3d206fa08a2f88749204cec9faeabba67d8b9cdbffaa14f68f55ab8fa80c7
|
|
7
|
+
data.tar.gz: 25b8d0a9eac8eae2b6a58b406112a1eedf95d7deb5e4871f63386ef91fc41994554dbb4678f9e2ab6090e47258231c8ba7189026d981c0df9e9b696e35c6e959
|
data/README.md
CHANGED
|
@@ -3,7 +3,7 @@ require "base64"
|
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "church_community_builder"
|
|
6
|
-
s.version = "0.0.
|
|
6
|
+
s.version = "0.0.12"
|
|
7
7
|
s.authors = ['Taylor Brooks']
|
|
8
8
|
s.email = ["dGJyb29rc0BnbWFpbC5jb20="].map{ |e| Base64.decode64(e) }
|
|
9
9
|
s.homepage = "https://github.com/taylorbrooks/church_community_builder"
|
|
@@ -4,7 +4,7 @@ module ChurchCommunityBuilder
|
|
|
4
4
|
|
|
5
5
|
def create_contribution(contribution_params)
|
|
6
6
|
response = post("?srv=online_giving_insert_gift&#{Addressable::URI.form_encode(contribution_params)}", nil)
|
|
7
|
-
::Contribution.new(response).parse
|
|
7
|
+
ChurchCommunityBuilder::Contribution.new(response).parse
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
end
|
|
@@ -4,12 +4,12 @@ module ChurchCommunityBuilder
|
|
|
4
4
|
|
|
5
5
|
def create_person(person_params)
|
|
6
6
|
response = post("?srv=create_individual", Addressable::URI.form_encode(person_params))
|
|
7
|
-
::Person.new(response).parse
|
|
7
|
+
ChurchCommunityBuilder::Person.new(response).parse
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
def search_for_person_by_email(email)
|
|
11
11
|
response = get("?srv=individual_search&email=#{email}")
|
|
12
|
-
::Person.new(response).parse
|
|
12
|
+
ChurchCommunityBuilder::Person.new(response).parse
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
end
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
module ChurchCommunityBuilder
|
|
2
|
+
class Campus
|
|
3
|
+
attr_reader :response, :campuses
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
def initialize(response)
|
|
6
|
+
@response = response["ccb_api"]["response"]
|
|
7
|
+
@campuses = @response["campuses"]["campus"]
|
|
8
|
+
end
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
def parse
|
|
11
|
+
@campuses.map do |campus|
|
|
12
|
+
OpenStruct.new(
|
|
13
|
+
id: campus["id"],
|
|
14
|
+
name: campus["name"]
|
|
15
|
+
)
|
|
16
|
+
end
|
|
15
17
|
end
|
|
16
|
-
end
|
|
17
18
|
|
|
19
|
+
end
|
|
18
20
|
end
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
module ChurchCommunityBuilder
|
|
2
|
+
class Contribution
|
|
3
|
+
attr_reader :response, :contribution
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
def initialize(response)
|
|
6
|
+
@response = response["ccb_api"]["response"]
|
|
7
|
+
@contribution = @response["items"]["item"]
|
|
8
|
+
end
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
def parse
|
|
11
|
+
OpenStruct.new(
|
|
12
|
+
id: contribution["gift_id"],
|
|
13
|
+
amount: contribution["amount"]
|
|
14
|
+
)
|
|
15
|
+
end
|
|
15
16
|
|
|
17
|
+
end
|
|
16
18
|
end
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
module ChurchCommunityBuilder
|
|
2
|
+
class Fund
|
|
3
|
+
attr_reader :response, :funds
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
def initialize(response)
|
|
6
|
+
@response = response["ccb_api"]["response"]
|
|
7
|
+
@funds = @response["transaction_detail_types"]["transaction_detail_type"]
|
|
8
|
+
end
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
def parse
|
|
11
|
+
@funds.map do |fund|
|
|
12
|
+
OpenStruct.new(
|
|
13
|
+
id: fund["id"],
|
|
14
|
+
name: fund["name"]
|
|
15
|
+
)
|
|
16
|
+
end
|
|
15
17
|
end
|
|
16
18
|
end
|
|
17
19
|
end
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
module ChurchCommunityBuilder
|
|
2
|
+
class Person
|
|
3
|
+
attr_reader :response, :people, :count
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
def initialize(response)
|
|
6
|
+
@response = response["ccb_api"]["response"]
|
|
7
|
+
@people = @response["individuals"]
|
|
8
|
+
@count = @people["count"].to_i
|
|
9
|
+
end
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
def parse
|
|
12
|
+
return [] if count == 0
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
if count == 1
|
|
15
|
+
[hydrate(people["individual"])]
|
|
16
|
+
else
|
|
17
|
+
people["individual"].map{|p| hydrate(p) }
|
|
18
|
+
end
|
|
17
19
|
end
|
|
18
|
-
end
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
def hydrate(person)
|
|
22
|
+
OpenStruct.new(
|
|
23
|
+
id: person["id"],
|
|
24
|
+
first_name: person["first_name"],
|
|
25
|
+
last_name: person["last_name"],
|
|
26
|
+
email: person["email"]
|
|
27
|
+
)
|
|
28
|
+
end
|
|
28
29
|
|
|
30
|
+
end
|
|
29
31
|
end
|