fellowshipone 1.3.4 → 2.0.0
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/fellowshipone.gemspec +1 -1
- data/lib/fellowshipone/client.rb +2 -1
- data/lib/fellowshipone/resources/contribution.rb +2 -1
- data/lib/fellowshipone/resources/fund.rb +2 -1
- data/lib/fellowshipone/responses/contribution.rb +23 -0
- data/lib/fellowshipone/responses/fund.rb +20 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 62cb24583d770d51d4bbcaa1da51bd4b3385d99a
|
4
|
+
data.tar.gz: 0857cfb2ce47912d9459c0761c827d5e99245902
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5aa25ee6e43cc373d013907147fd1644a2f29bf3075c9ae09d723235372977d7d4f98d9f49796862a9a2e88f7e9eb195ebed9e31627a01c684a261c2094663c
|
7
|
+
data.tar.gz: a06e43e12c702a214e8fd7932f70cc991af8818eb1a30d4a9f42584d2bc8f9c3be7407e5f5999dfde10cc85889bbfb1b4637c006628c293abecf26c858434421
|
data/fellowshipone.gemspec
CHANGED
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'fellowshipone'
|
5
|
-
s.version = '
|
5
|
+
s.version = '2.0.0'
|
6
6
|
s.authors = ['Taylor Brooks']
|
7
7
|
s.email = ['tbrooks@gmail.com']
|
8
8
|
s.homepage = 'https://github.com/taylorbrooks/fellowshipone'
|
data/lib/fellowshipone/client.rb
CHANGED
@@ -4,6 +4,7 @@ require 'simple_oauth'
|
|
4
4
|
require 'json'
|
5
5
|
|
6
6
|
Dir[File.expand_path('../resources/*.rb', __FILE__)].each{|f| require f}
|
7
|
+
Dir[File.expand_path('../responses/*.rb', __FILE__)].each{|f| require f}
|
7
8
|
|
8
9
|
module Fellowshipone
|
9
10
|
class Client
|
@@ -16,7 +17,7 @@ module Fellowshipone
|
|
16
17
|
|
17
18
|
attr_reader :church_code, :consumer_key, :consumer_secret, :token, :secret, :logger
|
18
19
|
|
19
|
-
def initialize(church_code
|
20
|
+
def initialize(church_code:, consumer_key:, consumer_secret:, token:, secret:, logger: false)
|
20
21
|
@church_code = church_code
|
21
22
|
@consumer_key = consumer_key
|
22
23
|
@consumer_secret = consumer_secret
|
@@ -28,7 +28,8 @@ module Fellowshipone
|
|
28
28
|
options.merge!(endReceivedDate: end_date) if end_date
|
29
29
|
|
30
30
|
params = Addressable::URI.form_encode(options)
|
31
|
-
get("/giving/v1/contributionreceipts/search.json?#{params}").results
|
31
|
+
response = get("/giving/v1/contributionreceipts/search.json?#{params}").results
|
32
|
+
Fellowshipone::Contribution.format(response)
|
32
33
|
end
|
33
34
|
|
34
35
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Fellowshipone
|
2
|
+
class Contribution
|
3
|
+
|
4
|
+
def self.format(res)
|
5
|
+
response = res["contributionReceipt"]
|
6
|
+
if response.is_a?(Array)
|
7
|
+
response.map{|contribution| format_contribution(contribution) }
|
8
|
+
else
|
9
|
+
format_contribution(response)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.format_contribution(contribution)
|
14
|
+
OpenStruct.new(
|
15
|
+
id: contribution["@id"],
|
16
|
+
amount: contribution["amount"],
|
17
|
+
fund: contribution["fund"]["name"],
|
18
|
+
sub_fund: contribution["subFund"]["name"],
|
19
|
+
date: contribution["receivedDate"]
|
20
|
+
)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Fellowshipone
|
2
|
+
class Fund
|
3
|
+
|
4
|
+
def self.format(res)
|
5
|
+
response = res["funds"]["fund"]
|
6
|
+
if response.is_a?(Array)
|
7
|
+
response.map{|fund| format_fund(fund) }
|
8
|
+
else
|
9
|
+
format_fund(response)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.format_fund(fund)
|
14
|
+
OpenStruct.new(
|
15
|
+
id: fund["@id"],
|
16
|
+
name: fund["name"],
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fellowshipone
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Brooks
|
@@ -186,6 +186,8 @@ files:
|
|
186
186
|
- lib/fellowshipone/resources/household.rb
|
187
187
|
- lib/fellowshipone/resources/person.rb
|
188
188
|
- lib/fellowshipone/resources/pledge_drive.rb
|
189
|
+
- lib/fellowshipone/responses/contribution.rb
|
190
|
+
- lib/fellowshipone/responses/fund.rb
|
189
191
|
- test/person/person_test.rb
|
190
192
|
- test/test_helper.rb
|
191
193
|
- tester.rb
|
@@ -209,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
211
|
version: '0'
|
210
212
|
requirements: []
|
211
213
|
rubyforge_project:
|
212
|
-
rubygems_version: 2.
|
214
|
+
rubygems_version: 2.4.8
|
213
215
|
signing_key:
|
214
216
|
specification_version: 4
|
215
217
|
summary: Ruby gem/plugin to interact with the FellowshipOne API (https://developer.fellowshipone.com/).
|