church_community_builder 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00758bc1f576757f0ef02435f2218fe82c6960cd
4
- data.tar.gz: 29c6aad97d3edb45751394f9369c2428e3d07529
3
+ metadata.gz: e52f5a807cdfbad48295dbab5ad05d5c35e158ef
4
+ data.tar.gz: 326067c175be2005e91f8a5d09bd388b39190d33
5
5
  SHA512:
6
- metadata.gz: 94142c6d9af5ba63a338c5b07ba85987b6558dfd8e4e5f66906eeaf6cc54d97f51f3d206fa08a2f88749204cec9faeabba67d8b9cdbffaa14f68f55ab8fa80c7
7
- data.tar.gz: 25b8d0a9eac8eae2b6a58b406112a1eedf95d7deb5e4871f63386ef91fc41994554dbb4678f9e2ab6090e47258231c8ba7189026d981c0df9e9b696e35c6e959
6
+ metadata.gz: c797f0571678f02381cc4c6f5e95bcf3f7bca7db809785f764325ec21f1c76fc71acf0e44216876cac2ce27938d3bee0a510ebd3177fc4229bd842a5b4695172
7
+ data.tar.gz: 0a1c6181d2b5556e147e9c874320aa2fb221ce3e7505a86563bdfcb04163c732356c852404aa62da5559abb4c26864adc4157a0fd1909c020ed2fa99865bebaf
@@ -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.12"
6
+ s.version = "0.0.13"
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"
@@ -7,6 +7,11 @@ module ChurchCommunityBuilder
7
7
  ChurchCommunityBuilder::Contribution.new(response).parse
8
8
  end
9
9
 
10
+ def list_contributions_by_family_id(family_id)
11
+ response = get("?srv=transactions_by_family&family_id=#{family_id}")
12
+ ChurchCommunityBuilder::FamilyContributions.new(response).parse
13
+ end
14
+
10
15
  end
11
16
  end
12
17
  end
@@ -15,4 +15,26 @@ module ChurchCommunityBuilder
15
15
  end
16
16
 
17
17
  end
18
+
19
+ class FamilyContributions
20
+ attr :transactions
21
+
22
+ def initialize(response)
23
+ @transactions = response["ccb_api"]["response"]["transactions"]["transaction"]
24
+ end
25
+
26
+ def parse
27
+ @transactions.map do |t|
28
+ OpenStruct.new(
29
+ id: t["id"],
30
+ date: t["date"],
31
+ amount: t["transaction_details"]["transaction_detail"]["amount"],
32
+ fund: t["transaction_details"]["transaction_detail"]["coa"]["__content__"],
33
+ note: t["transaction_details"]["transaction_detail"]["note"],
34
+ person: t["individual"]["__content__"],
35
+ person_id: t["individual"]["id"],
36
+ )
37
+ end
38
+ end
39
+ end
18
40
  end
@@ -21,9 +21,10 @@ module ChurchCommunityBuilder
21
21
  def hydrate(person)
22
22
  OpenStruct.new(
23
23
  id: person["id"],
24
+ family_id: person["family"]["id"],
24
25
  first_name: person["first_name"],
25
26
  last_name: person["last_name"],
26
- email: person["email"]
27
+ email: person["email"],
27
28
  )
28
29
  end
29
30
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: church_community_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.12
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-01 00:00:00.000000000 Z
11
+ date: 2016-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler