rock_rms 5.6.0 → 5.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.ruby-version +1 -1
- data/lib/rock_rms/client.rb +2 -0
- data/lib/rock_rms/resources/history.rb +10 -0
- data/lib/rock_rms/resources/recurring_donation.rb +4 -0
- data/lib/rock_rms/resources/recurring_donation_detail.rb +21 -0
- data/lib/rock_rms/resources/service_job.rb +18 -0
- data/lib/rock_rms/resources/transaction.rb +3 -1
- data/lib/rock_rms/response/batch.rb +2 -1
- data/lib/rock_rms/response/history.rb +19 -0
- data/lib/rock_rms/response/recurring_donation.rb +2 -1
- data/lib/rock_rms/response/recurring_donation_details.rb +3 -1
- data/lib/rock_rms/response/service_job.rb +17 -0
- data/lib/rock_rms/response/transaction_detail.rb +3 -1
- data/lib/rock_rms/version.rb +1 -1
- data/spec/rock_rms/resources/recurring_donation_detail_spec.rb +59 -0
- data/spec/rock_rms/resources/recurring_donation_spec.rb +1 -1
- data/spec/rock_rms/resources/transaction_spec.rb +1 -1
- data/spec/rock_rms/response/recurring_donation_spec.rb +1 -0
- data/spec/rock_rms/response/transaction_detail_spec.rb +2 -0
- data/spec/support/fixtures/create_recurring_donation_detail.json +1 -0
- data/spec/support/rock_mock.rb +3 -1
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b4c7c116742e1c3d7ad8ef95c87c5eb484af173bc6b0ec5de6a7692326f3b354
|
4
|
+
data.tar.gz: edbd8b736d2bbbab53e7b71d814cbd8e660a68582e374e6a6a8c4558295b9005
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de2c4e9ee063f1b1bb8ee4ebf1581965dcf13e2792e6767dc2e73b11bf9a8b5e36d89fe927f1ed348a8dade0657aea488282453408e47a0ff75106f790288594
|
7
|
+
data.tar.gz: 5f7d2190935dc449ec0aefd52009b13335c5da527563f6c6a5836603afce29aceb4b9ab4d33958fb498a7a2e052ce8bb5d5303641a7fc5ae477e7cabe9ce79d0
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.7.2
|
data/lib/rock_rms/client.rb
CHANGED
@@ -22,6 +22,7 @@ module RockRMS
|
|
22
22
|
include RockRMS::Client::Gateway
|
23
23
|
include RockRMS::Client::Group
|
24
24
|
include RockRMS::Client::GroupMember
|
25
|
+
include RockRMS::Client::History
|
25
26
|
include RockRMS::Client::Page
|
26
27
|
include RockRMS::Client::PaymentDetail
|
27
28
|
include RockRMS::Client::Person
|
@@ -31,6 +32,7 @@ module RockRMS
|
|
31
32
|
include RockRMS::Client::Refund
|
32
33
|
include RockRMS::Client::RefundReason
|
33
34
|
include RockRMS::Client::SavedPaymentMethod
|
35
|
+
include RockRMS::Client::ServiceJob
|
34
36
|
include RockRMS::Client::Transaction
|
35
37
|
include RockRMS::Client::TransactionDetail
|
36
38
|
include RockRMS::Client::UserLogin
|
@@ -1,6 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module RockRMS
|
2
4
|
class Client
|
3
5
|
module RecurringDonationDetail
|
6
|
+
def create_recurring_donation_detail(
|
7
|
+
recurring_donation_id:,
|
8
|
+
fund_id:,
|
9
|
+
amount:
|
10
|
+
)
|
11
|
+
|
12
|
+
options = {
|
13
|
+
'AccountId' => fund_id,
|
14
|
+
'Amount' => amount,
|
15
|
+
'ScheduledTransactionId' => recurring_donation_id
|
16
|
+
}
|
17
|
+
|
18
|
+
post(recurring_donation_detail_path, options)
|
19
|
+
end
|
20
|
+
|
21
|
+
def delete_recurring_donation_detail(id)
|
22
|
+
delete(recurring_donation_detail_path(id))
|
23
|
+
end
|
24
|
+
|
4
25
|
def update_recurring_donation_detail(id, fund_id: nil, amount: nil)
|
5
26
|
options = {}
|
6
27
|
options['AccountId'] = fund_id if fund_id
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module RockRMS
|
2
|
+
class Client
|
3
|
+
module ServiceJob
|
4
|
+
def list_service_jobs(options = {})
|
5
|
+
res = get('ServiceJobs', options)
|
6
|
+
Response::ServiceJob.format(res)
|
7
|
+
end
|
8
|
+
|
9
|
+
def update_service_job(id, cron: nil)
|
10
|
+
options = {
|
11
|
+
'CronExpression': cron
|
12
|
+
}
|
13
|
+
|
14
|
+
patch("ServiceJobs/#{id}", options)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module RockRMS
|
2
|
+
module Response
|
3
|
+
class History < Base
|
4
|
+
MAP = {
|
5
|
+
id: 'Id',
|
6
|
+
verb: 'Verb',
|
7
|
+
change_type: 'ChangeType',
|
8
|
+
value_name: 'ValueName',
|
9
|
+
old_value: 'OldValue',
|
10
|
+
new_value: 'NewValue',
|
11
|
+
alias_id: 'CreatedByPersonAliasId'
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
def format_single(data)
|
15
|
+
to_h(MAP, data)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -13,7 +13,8 @@ module RockRMS
|
|
13
13
|
person_id: 'AuthorizedPersonAliasId',
|
14
14
|
start_date: 'StartDate',
|
15
15
|
transaction_details: 'ScheduledTransactionDetails',
|
16
|
-
transaction_code: 'TransactionCode'
|
16
|
+
transaction_code: 'TransactionCode',
|
17
|
+
summary: 'Summary'
|
17
18
|
}.freeze
|
18
19
|
|
19
20
|
def format_single(data)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module RockRMS
|
2
|
+
module Response
|
3
|
+
class ServiceJob < Base
|
4
|
+
MAP = {
|
5
|
+
id: 'Id',
|
6
|
+
name: 'Name',
|
7
|
+
active: 'IsActive',
|
8
|
+
description: 'Description',
|
9
|
+
cron: 'CronExpression'
|
10
|
+
}.freeze
|
11
|
+
|
12
|
+
def format_single(data)
|
13
|
+
to_h(MAP, data)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/rock_rms/version.rb
CHANGED
@@ -3,6 +3,50 @@ require 'spec_helper'
|
|
3
3
|
RSpec.describe RockRMS::Client::RecurringDonationDetail, type: :model do
|
4
4
|
include_context 'resource specs'
|
5
5
|
|
6
|
+
describe '#create_recurring_donation_detail' do
|
7
|
+
context 'arguments' do
|
8
|
+
it 'require `fund_id`' do
|
9
|
+
expect { client.create_recurring_donation_detail }
|
10
|
+
.to raise_error(ArgumentError, /fund_id/)
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'require `amount`' do
|
14
|
+
expect { client.create_recurring_donation_detail }
|
15
|
+
.to raise_error(ArgumentError, /amount/)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'require `recurring_donation_id`' do
|
19
|
+
expect { client.create_recurring_donation_detail }
|
20
|
+
.to raise_error(ArgumentError, /recurring_donation_id/)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
subject(:resource) do
|
26
|
+
client.create_recurring_donation_detail(
|
27
|
+
fund_id: 1,
|
28
|
+
amount: 5.00,
|
29
|
+
recurring_donation_id: 1
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'returns integer' do
|
34
|
+
expect(resource).to be_a(Integer)
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'passes options' do
|
38
|
+
expect(client).to receive(:post)
|
39
|
+
.with(
|
40
|
+
'FinancialScheduledTransactionDetails',
|
41
|
+
'AccountId' => 1,
|
42
|
+
'ScheduledTransactionId' => 1,
|
43
|
+
'Amount' => 5.00,
|
44
|
+
)
|
45
|
+
.and_call_original
|
46
|
+
resource
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
6
50
|
describe '#update_recurring_donation_detail' do
|
7
51
|
subject(:resource) do
|
8
52
|
client.update_recurring_donation_detail(
|
@@ -26,4 +70,19 @@ RSpec.describe RockRMS::Client::RecurringDonationDetail, type: :model do
|
|
26
70
|
resource
|
27
71
|
end
|
28
72
|
end
|
73
|
+
|
74
|
+
describe '#delete_recurring_donation_detail' do
|
75
|
+
subject(:resource) do
|
76
|
+
client.delete_recurring_donation_detail(123)
|
77
|
+
end
|
78
|
+
|
79
|
+
it 'returns nothing' do
|
80
|
+
expect(client.delete_recurring_donation_detail(123)).to eq(nil)
|
81
|
+
end
|
82
|
+
|
83
|
+
it 'passes options' do
|
84
|
+
expect(client).to receive(:delete).with('FinancialScheduledTransactionDetails/123').and_call_original
|
85
|
+
resource
|
86
|
+
end
|
87
|
+
end
|
29
88
|
end
|
@@ -139,7 +139,7 @@ RSpec.describe RockRMS::Client::RecurringDonation, type: :model do
|
|
139
139
|
'FinancialGatewayId' => nil,
|
140
140
|
'FinancialPaymentDetailId' => nil,
|
141
141
|
'TransactionCode' => 'asdf',
|
142
|
-
'ScheduledTransactionDetails' => [{ 'Amount' => 450, 'AccountId' => 2 }],
|
142
|
+
'ScheduledTransactionDetails' => [{ 'Amount' => 450, 'AccountId' => 2, 'EntityId' => nil, 'EntityTypeId' => nil }],
|
143
143
|
'GatewayScheduleId' => nil,
|
144
144
|
'SourceTypeValueId' => 10,
|
145
145
|
'ForeignKey' => nil
|
@@ -85,7 +85,7 @@ RSpec.describe RockRMS::Client::Transaction, type: :model do
|
|
85
85
|
'FinancialPaymentDetailId' => 1,
|
86
86
|
'TransactionCode' => 'asdf',
|
87
87
|
'TransactionDateTime' => 1,
|
88
|
-
'TransactionDetails' => [{ 'Amount' => 450, 'AccountId' => 2 }],
|
88
|
+
'TransactionDetails' => [{ 'Amount' => 450, 'AccountId' => 2, 'EntityTypeId' => nil, 'EntityId' => nil }],
|
89
89
|
'TransactionTypeValueId' => 53,
|
90
90
|
'SourceTypeValueId' => 10,
|
91
91
|
'Summary' => 'taco tuesday'
|
@@ -17,6 +17,8 @@ RSpec.describe RockRMS::Response::TransactionDetail, type: :model do
|
|
17
17
|
expect(r[:id]).to eq(p['Id'])
|
18
18
|
expect(r[:fund_id]).to eq(p['AccountId'])
|
19
19
|
expect(r[:amount]).to eq(p['Amount'])
|
20
|
+
expect(r[:entity_type_id]).to eq(p['EntityTypeId'])
|
21
|
+
expect(r[:entity_id]).to eq(p['EntityId'])
|
20
22
|
end
|
21
23
|
end
|
22
24
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
12345
|
data/spec/support/rock_mock.rb
CHANGED
@@ -9,6 +9,7 @@ class RockMock < Sinatra::Base
|
|
9
9
|
'FinancialPaymentDetails/:id',
|
10
10
|
'FinancialPersonSavedAccounts/:id',
|
11
11
|
'FinancialTransactions/:id',
|
12
|
+
'FinancialScheduledTransactionDetails/:id',
|
12
13
|
'GroupMembers/:id'
|
13
14
|
].each do |end_point|
|
14
15
|
delete "/api/#{end_point}" do
|
@@ -64,7 +65,8 @@ class RockMock < Sinatra::Base
|
|
64
65
|
create_recurring_donation: 'FinancialScheduledTransactions',
|
65
66
|
create_refund: 'FinancialTransactionRefunds',
|
66
67
|
create_refund_reason: 'DefinedValues',
|
67
|
-
create_saved_payment_method: 'FinancialPersonSavedAccounts'
|
68
|
+
create_saved_payment_method: 'FinancialPersonSavedAccounts',
|
69
|
+
create_recurring_donation_detail: 'FinancialScheduledTransactionDetails',
|
68
70
|
}.each do |json, end_point|
|
69
71
|
post "/api/#{end_point}" do
|
70
72
|
json_response 201, "#{json}.json"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rock_rms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taylor Brooks
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/rock_rms/resources/gateway.rb
|
198
198
|
- lib/rock_rms/resources/group.rb
|
199
199
|
- lib/rock_rms/resources/group_member.rb
|
200
|
+
- lib/rock_rms/resources/history.rb
|
200
201
|
- lib/rock_rms/resources/page.rb
|
201
202
|
- lib/rock_rms/resources/payment_detail.rb
|
202
203
|
- lib/rock_rms/resources/person.rb
|
@@ -206,6 +207,7 @@ files:
|
|
206
207
|
- lib/rock_rms/resources/refund.rb
|
207
208
|
- lib/rock_rms/resources/refund_reason.rb
|
208
209
|
- lib/rock_rms/resources/saved_payment_method.rb
|
210
|
+
- lib/rock_rms/resources/service_job.rb
|
209
211
|
- lib/rock_rms/resources/transaction.rb
|
210
212
|
- lib/rock_rms/resources/transaction_detail.rb
|
211
213
|
- lib/rock_rms/resources/user_login.rb
|
@@ -226,6 +228,7 @@ files:
|
|
226
228
|
- lib/rock_rms/response/gateway.rb
|
227
229
|
- lib/rock_rms/response/group.rb
|
228
230
|
- lib/rock_rms/response/group_location.rb
|
231
|
+
- lib/rock_rms/response/history.rb
|
229
232
|
- lib/rock_rms/response/location.rb
|
230
233
|
- lib/rock_rms/response/page.rb
|
231
234
|
- lib/rock_rms/response/payment_detail.rb
|
@@ -234,6 +237,7 @@ files:
|
|
234
237
|
- lib/rock_rms/response/recurring_donation.rb
|
235
238
|
- lib/rock_rms/response/recurring_donation_details.rb
|
236
239
|
- lib/rock_rms/response/saved_payment_method.rb
|
240
|
+
- lib/rock_rms/response/service_job.rb
|
237
241
|
- lib/rock_rms/response/transaction.rb
|
238
242
|
- lib/rock_rms/response/transaction_detail.rb
|
239
243
|
- lib/rock_rms/response/user_login.rb
|
@@ -296,6 +300,7 @@ files:
|
|
296
300
|
- spec/support/fixtures/create_payment_detail.json
|
297
301
|
- spec/support/fixtures/create_phone_number.json
|
298
302
|
- spec/support/fixtures/create_recurring_donation.json
|
303
|
+
- spec/support/fixtures/create_recurring_donation_detail.json
|
299
304
|
- spec/support/fixtures/create_refund.json
|
300
305
|
- spec/support/fixtures/create_refund_reason.json
|
301
306
|
- spec/support/fixtures/create_saved_payment_method.json
|
@@ -334,7 +339,7 @@ homepage: https://github.com/taylorbrooks/rock_rms
|
|
334
339
|
licenses:
|
335
340
|
- MIT
|
336
341
|
metadata: {}
|
337
|
-
post_install_message:
|
342
|
+
post_install_message:
|
338
343
|
rdoc_options: []
|
339
344
|
require_paths:
|
340
345
|
- lib
|
@@ -349,9 +354,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
349
354
|
- !ruby/object:Gem::Version
|
350
355
|
version: '0'
|
351
356
|
requirements: []
|
352
|
-
|
353
|
-
|
354
|
-
signing_key:
|
357
|
+
rubygems_version: 3.1.4
|
358
|
+
signing_key:
|
355
359
|
specification_version: 4
|
356
360
|
summary: A Ruby wrapper for the Rock RMS API
|
357
361
|
test_files: []
|