rock_rms 2.0.0 → 3.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/.ruby-version +1 -1
- data/lib/rock_rms/client.rb +2 -2
- data/lib/rock_rms/resources/batch.rb +4 -2
- data/lib/rock_rms/resources/fund.rb +1 -1
- data/lib/rock_rms/resources/group.rb +3 -3
- data/lib/rock_rms/resources/person.rb +4 -4
- data/lib/rock_rms/resources/phone_number.rb +1 -1
- data/lib/rock_rms/resources/recurring_donation.rb +2 -2
- data/lib/rock_rms/resources/{donation.rb → transaction.rb} +13 -11
- data/lib/rock_rms/resources/transaction_detail.rb +2 -2
- data/lib/rock_rms/response/base.rb +29 -0
- data/lib/rock_rms/response/batch.rb +23 -0
- data/lib/rock_rms/{responses → response}/campus.rb +4 -14
- data/lib/rock_rms/response/fund.rb +14 -0
- data/lib/rock_rms/{responses → response}/group.rb +4 -14
- data/lib/rock_rms/response/group_location.rb +22 -0
- data/lib/rock_rms/{responses → response}/location.rb +4 -14
- data/lib/rock_rms/response/payment_method.rb +16 -0
- data/lib/rock_rms/response/person.rb +20 -0
- data/lib/rock_rms/response/phone_number.rb +17 -0
- data/lib/rock_rms/response/recurring_donation.rb +20 -0
- data/lib/rock_rms/response/recurring_donation_details.rb +14 -0
- data/lib/rock_rms/response/transaction.rb +28 -0
- data/lib/rock_rms/response/transaction_detail.rb +15 -0
- data/lib/rock_rms/version.rb +1 -1
- data/spec/rock_rms/resources/batch_spec.rb +8 -1
- data/spec/rock_rms/resources/group_spec.rb +3 -3
- data/spec/rock_rms/resources/person_spec.rb +1 -1
- data/spec/rock_rms/resources/phone_number_spec.rb +1 -1
- data/spec/rock_rms/resources/recurring_donation_spec.rb +2 -2
- data/spec/rock_rms/resources/transaction_detail_spec.rb +1 -1
- data/spec/rock_rms/resources/{donation_spec.rb → transaction_spec.rb} +21 -21
- data/spec/rock_rms/response/batch_spec.rb +27 -0
- data/spec/rock_rms/{responses → response}/campus_spec.rb +1 -1
- data/spec/rock_rms/{responses → response}/group_location_spec.rb +2 -2
- data/spec/rock_rms/{responses → response}/group_spec.rb +3 -3
- data/spec/rock_rms/{responses → response}/location_spec.rb +1 -1
- data/spec/rock_rms/{responses → response}/phone_number_spec.rb +1 -1
- data/spec/rock_rms/{responses → response}/recurring_donation_details_spec.rb +1 -1
- data/spec/rock_rms/{responses → response}/recurring_donation_spec.rb +2 -2
- data/spec/rock_rms/{responses → response}/transaction_detail_spec.rb +1 -1
- data/spec/rock_rms/{responses/donation_spec.rb → response/transaction_spec.rb} +3 -3
- data/spec/support/fixtures/{create_donation.json → create_transaction.json} +0 -0
- data/spec/support/fixtures/{donation.json → transaction.json} +0 -0
- data/spec/support/fixtures/{donations.json → transactions.json} +0 -0
- data/spec/support/rock_mock.rb +3 -3
- metadata +32 -29
- data/lib/rock_rms/responses/donation.rb +0 -40
- data/lib/rock_rms/responses/fund.rb +0 -18
- data/lib/rock_rms/responses/group_location.rb +0 -32
- data/lib/rock_rms/responses/payment_method.rb +0 -24
- data/lib/rock_rms/responses/person.rb +0 -33
- data/lib/rock_rms/responses/phone_number.rb +0 -27
- data/lib/rock_rms/responses/recurring_donation.rb +0 -32
- data/lib/rock_rms/responses/recurring_donation_details.rb +0 -24
- data/lib/rock_rms/responses/transaction_detail.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65ed9a699a31184f1078ecace1c1b051a1b47cec
|
4
|
+
data.tar.gz: 32794e0d15893c90bdf25837bdef55ba091ae849
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df5926061ebb2526b41a1628b028e77925ec7e9708cbf7e452762b9c840a7bc266a2bf84885cbd1526f9f202b70e9d5f56a727f3aec3bda9fea1ca9a925824a1
|
7
|
+
data.tar.gz: bf1cd9228b9196b391419cd287b42a59340dd5320dc82d4d4259f0317d9da25f3cc29bf2a906e64a21f2d85fa14e4d541c4a52deb75907c6529a9894be4661be
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.3.6
|
data/lib/rock_rms/client.rb
CHANGED
@@ -3,12 +3,11 @@ require 'faraday_middleware'
|
|
3
3
|
require 'faraday_middleware/parse_oj'
|
4
4
|
|
5
5
|
Dir[File.expand_path('../resources/*.rb', __FILE__)].each { |f| require f }
|
6
|
-
Dir[File.expand_path('../
|
6
|
+
Dir[File.expand_path('../response/*.rb', __FILE__)].each { |f| require f }
|
7
7
|
|
8
8
|
module RockRMS
|
9
9
|
class Client
|
10
10
|
include RockRMS::Client::Batch
|
11
|
-
include RockRMS::Client::Donation
|
12
11
|
include RockRMS::Client::Fund
|
13
12
|
include RockRMS::Client::Group
|
14
13
|
include RockRMS::Client::GroupMember
|
@@ -16,6 +15,7 @@ module RockRMS
|
|
16
15
|
include RockRMS::Client::Person
|
17
16
|
include RockRMS::Client::PhoneNumber
|
18
17
|
include RockRMS::Client::RecurringDonation
|
18
|
+
include RockRMS::Client::Transaction
|
19
19
|
include RockRMS::Client::TransactionDetail
|
20
20
|
|
21
21
|
attr_reader :url, :username, :password, :logger, :cookie, :connection
|
@@ -2,11 +2,13 @@ module RockRMS
|
|
2
2
|
class Client
|
3
3
|
module Batch
|
4
4
|
def list_batches(options = {})
|
5
|
-
get(batches_path, options)
|
5
|
+
res = get(batches_path, options)
|
6
|
+
Response::Batch.format(res)
|
6
7
|
end
|
7
8
|
|
8
9
|
def find_batch(id)
|
9
|
-
get(batches_path(id))
|
10
|
+
res = get(batches_path(id))
|
11
|
+
Response::Batch.format(res)
|
10
12
|
end
|
11
13
|
|
12
14
|
def create_batch(name:, start_time:, end_time:, foreign_key: nil)
|
@@ -2,11 +2,11 @@ module RockRMS
|
|
2
2
|
class Client
|
3
3
|
module Group
|
4
4
|
def list_groups(options = {})
|
5
|
-
|
5
|
+
Response::Group.format(get(group_path, options))
|
6
6
|
end
|
7
7
|
|
8
8
|
def find_group(id)
|
9
|
-
|
9
|
+
Response::Group.format(get(group_path(id)))
|
10
10
|
end
|
11
11
|
|
12
12
|
def list_groups_for_person(person_id, options = {})
|
@@ -20,7 +20,7 @@ module RockRMS
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def list_families_for_person(person_id, options = {})
|
23
|
-
|
23
|
+
Response::Group.format(
|
24
24
|
get("Groups/GetFamilies/#{person_id}", options)
|
25
25
|
)
|
26
26
|
end
|
@@ -3,17 +3,17 @@ module RockRMS
|
|
3
3
|
module Person
|
4
4
|
def list_people(options = {})
|
5
5
|
res = get(people_path, options)
|
6
|
-
|
6
|
+
Response::Person.format(res)
|
7
7
|
end
|
8
8
|
|
9
9
|
def find_person(id)
|
10
10
|
res = get(people_path(id))
|
11
|
-
|
11
|
+
Response::Person.format(res)
|
12
12
|
end
|
13
13
|
|
14
14
|
def find_person_by_email(email)
|
15
15
|
res = get("People/GetByEmail/#{email}")
|
16
|
-
|
16
|
+
Response::Person.format(res)
|
17
17
|
end
|
18
18
|
|
19
19
|
NAME_SEARCH_DEFAULTS = {
|
@@ -26,7 +26,7 @@ module RockRMS
|
|
26
26
|
def find_person_by_name(full_name, options = {})
|
27
27
|
priority = options.merge(name: full_name)
|
28
28
|
|
29
|
-
|
29
|
+
Response::Person.format(
|
30
30
|
get('People/Search', NAME_SEARCH_DEFAULTS.merge(priority))
|
31
31
|
)
|
32
32
|
end
|
@@ -3,12 +3,12 @@ module RockRMS
|
|
3
3
|
module RecurringDonation
|
4
4
|
def list_recurring_donations(options = {})
|
5
5
|
res = get(recurring_donation_path, options)
|
6
|
-
|
6
|
+
Response::RecurringDonation.format(res)
|
7
7
|
end
|
8
8
|
|
9
9
|
def find_recurring_donation(id)
|
10
10
|
res = get(recurring_donation_path(id))
|
11
|
-
|
11
|
+
Response::RecurringDonation.format(res)
|
12
12
|
end
|
13
13
|
|
14
14
|
def update_recurring_donation(
|
@@ -1,22 +1,24 @@
|
|
1
1
|
module RockRMS
|
2
2
|
class Client
|
3
|
-
module
|
4
|
-
|
3
|
+
module Transaction
|
4
|
+
PATH = 'FinancialTransactions'.freeze
|
5
|
+
|
6
|
+
def list_transactions(options = {})
|
5
7
|
res = get(transaction_path, options)
|
6
|
-
|
8
|
+
Response::Transaction.format(res)
|
7
9
|
end
|
8
10
|
|
9
11
|
def find_donations_by_giving_id(id, raw = false)
|
10
|
-
res = get("
|
11
|
-
raw ? res :
|
12
|
+
res = get("#{PATH}/GetByGivingId/#{id}?$expand=TransactionDetails")
|
13
|
+
raw ? res : Response::Transaction.format(res)
|
12
14
|
end
|
13
15
|
|
14
|
-
def
|
16
|
+
def find_transaction(id)
|
15
17
|
res = get(transaction_path(id))
|
16
|
-
|
18
|
+
Response::Transaction.format(res)
|
17
19
|
end
|
18
20
|
|
19
|
-
def
|
21
|
+
def create_transaction(
|
20
22
|
authorized_person_id:,
|
21
23
|
batch_id:,
|
22
24
|
date:,
|
@@ -43,7 +45,7 @@ module RockRMS
|
|
43
45
|
post(transaction_path, options)
|
44
46
|
end
|
45
47
|
|
46
|
-
def
|
48
|
+
def update_transaction(id, batch_id: nil, summary: nil, recurring_donation_id: nil)
|
47
49
|
options = {}
|
48
50
|
|
49
51
|
options['Summary'] = summary if summary
|
@@ -53,7 +55,7 @@ module RockRMS
|
|
53
55
|
patch(transaction_path(id), options)
|
54
56
|
end
|
55
57
|
|
56
|
-
def
|
58
|
+
def delete_transaction(id)
|
57
59
|
delete(transaction_path(id))
|
58
60
|
end
|
59
61
|
|
@@ -69,7 +71,7 @@ module RockRMS
|
|
69
71
|
end
|
70
72
|
|
71
73
|
def transaction_path(id = nil)
|
72
|
-
id ? "
|
74
|
+
id ? "#{PATH}/#{id}" : PATH
|
73
75
|
end
|
74
76
|
end
|
75
77
|
end
|
@@ -3,12 +3,12 @@ module RockRMS
|
|
3
3
|
module TransactionDetail
|
4
4
|
def list_transaction_details(options = {})
|
5
5
|
res = get(transaction_detail_path, options)
|
6
|
-
|
6
|
+
Response::TransactionDetail.format(res)
|
7
7
|
end
|
8
8
|
|
9
9
|
def find_transaction_detail(id)
|
10
10
|
res = get(transaction_detail_path(id))
|
11
|
-
|
11
|
+
Response::TransactionDetail.format(res)
|
12
12
|
end
|
13
13
|
|
14
14
|
def update_transaction_detail(id, fund_id:)
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module RockRMS
|
2
|
+
module Response
|
3
|
+
class Base
|
4
|
+
attr_reader :data
|
5
|
+
|
6
|
+
def self.format(data)
|
7
|
+
new(data).format
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize(data)
|
11
|
+
@data = data
|
12
|
+
end
|
13
|
+
|
14
|
+
def format
|
15
|
+
if data.is_a?(Array)
|
16
|
+
data.map { |item| format_single(item) }
|
17
|
+
else
|
18
|
+
format_single(data)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_h(dict, data)
|
23
|
+
dict.each_with_object({}) do |(l, r), object|
|
24
|
+
object[l] = data[r]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module RockRMS
|
2
|
+
module Response
|
3
|
+
class Batch < Base
|
4
|
+
MAP = {
|
5
|
+
id: 'Id',
|
6
|
+
name: 'Name',
|
7
|
+
control_amount: 'ControlAmount',
|
8
|
+
transactions: 'Transactions'
|
9
|
+
}.freeze
|
10
|
+
|
11
|
+
def format_single(data)
|
12
|
+
response = to_h(MAP, data)
|
13
|
+
response[:transactions] = Transaction.format(response[:transactions])
|
14
|
+
response[:amount] = calculate_total(response[:transactions])
|
15
|
+
response
|
16
|
+
end
|
17
|
+
|
18
|
+
def calculate_total(transactions)
|
19
|
+
transactions.reduce(0) { |sum, txn| sum + txn[:amount] }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RockRMS
|
2
|
-
module
|
3
|
-
class Campus
|
2
|
+
module Response
|
3
|
+
class Campus < Base
|
4
4
|
MAP = {
|
5
5
|
id: 'Id',
|
6
6
|
name: 'Name',
|
@@ -14,18 +14,8 @@ module RockRMS
|
|
14
14
|
guid: 'Guid'
|
15
15
|
}.freeze
|
16
16
|
|
17
|
-
def
|
18
|
-
|
19
|
-
data.map { |object| format_single(object) }
|
20
|
-
else
|
21
|
-
format_single(data)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.format_single(data)
|
26
|
-
MAP.each.with_object({}) do |(l, r), object|
|
27
|
-
object[l] = data[r]
|
28
|
-
end
|
17
|
+
def format_single(data)
|
18
|
+
to_h(MAP, data)
|
29
19
|
end
|
30
20
|
end
|
31
21
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RockRMS
|
2
|
-
module
|
3
|
-
class Group
|
2
|
+
module Response
|
3
|
+
class Group < Base
|
4
4
|
MAP = {
|
5
5
|
id: 'Id',
|
6
6
|
name: 'Name',
|
@@ -12,18 +12,8 @@ module RockRMS
|
|
12
12
|
members: 'Members'
|
13
13
|
}.freeze
|
14
14
|
|
15
|
-
def
|
16
|
-
|
17
|
-
data.map { |object| format_single(object) }
|
18
|
-
else
|
19
|
-
format_single(data)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.format_single(data)
|
24
|
-
result = MAP.each.with_object({}) do |(l, r), object|
|
25
|
-
object[l] = data[r]
|
26
|
-
end
|
15
|
+
def format_single(data)
|
16
|
+
result = to_h(MAP, data)
|
27
17
|
|
28
18
|
if group_locations = data['GroupLocations']
|
29
19
|
result[:group_locations] = GroupLocation.format(group_locations)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module RockRMS
|
2
|
+
module Response
|
3
|
+
class GroupLocation < Base
|
4
|
+
MAP = {
|
5
|
+
id: 'Id',
|
6
|
+
group_id: 'GroupId',
|
7
|
+
location_id: 'LocationId',
|
8
|
+
guid: 'Guid'
|
9
|
+
}.freeze
|
10
|
+
|
11
|
+
def format_single(data)
|
12
|
+
result = to_h(MAP, data)
|
13
|
+
|
14
|
+
if location = data['Location']
|
15
|
+
result[:location] = Location.format(location)
|
16
|
+
end
|
17
|
+
|
18
|
+
result
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module RockRMS
|
2
|
-
module
|
3
|
-
class Location
|
2
|
+
module Response
|
3
|
+
class Location < Base
|
4
4
|
MAP = {
|
5
5
|
id: 'Id',
|
6
6
|
name: 'Name',
|
@@ -17,18 +17,8 @@ module RockRMS
|
|
17
17
|
guid: 'Guid'
|
18
18
|
}.freeze
|
19
19
|
|
20
|
-
def
|
21
|
-
|
22
|
-
data.map { |object| format_single(object) }
|
23
|
-
else
|
24
|
-
format_single(data)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.format_single(data)
|
29
|
-
MAP.each.with_object({}) do |(l, r), object|
|
30
|
-
object[l] = data[r]
|
31
|
-
end
|
20
|
+
def format_single(data)
|
21
|
+
to_h(MAP, data)
|
32
22
|
end
|
33
23
|
end
|
34
24
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module RockRMS
|
2
|
+
module Response
|
3
|
+
class PaymentMethod < Base
|
4
|
+
MAP = {
|
5
|
+
id: 'Id',
|
6
|
+
foreign_key: 'ForeignKey',
|
7
|
+
payment_type_id: 'CurrencyTypeValueId',
|
8
|
+
masked_number: 'AccountNumberMasked'
|
9
|
+
}.freeze
|
10
|
+
|
11
|
+
def format_single(data)
|
12
|
+
to_h(MAP, data)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module RockRMS
|
2
|
+
module Response
|
3
|
+
class Person < Base
|
4
|
+
MAP = {
|
5
|
+
id: 'Id',
|
6
|
+
name: 'FullName',
|
7
|
+
email: 'Email',
|
8
|
+
first_name: 'FirstName',
|
9
|
+
last_name: 'LastName',
|
10
|
+
giving_id: 'GivingId',
|
11
|
+
alias_id: 'PrimaryAliasId',
|
12
|
+
connection_status_value_id: 'ConnectionStatusValueId'
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
def format_single(data)
|
16
|
+
to_h(MAP, data)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|