rock_rms 5.7.1 → 5.8.0

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
  SHA256:
3
- metadata.gz: '0285c478d37f3866307aa15c573a900a76c1ba1e502767b0adf4ad8a772bacf0'
4
- data.tar.gz: c93c50ffa1405ed6120ff4c316f1426ec6a37ee53fc26048365d0a1ab021d295
3
+ metadata.gz: 3f80037876165ae910a1e20ebc844295d312c0aafba86d84b031588b0594a7a9
4
+ data.tar.gz: d1abcffed57ba80128b6be557125c93ab52ad1696f80c2c191280df42bcc5bf9
5
5
  SHA512:
6
- metadata.gz: 94abb5223e5ff1a6da0c7ac2b2612e426416594b8346defae8dfb2f7ee072c17aa1caad97a4e768eedc80fa96a0db8a4bba2fb8c54d3f942e502875c1e9cb33e
7
- data.tar.gz: cf8b5521d733ce280698bd3f60288f1a3d7af575c2ca36c1c1f195f5ab86f8d212e427bd2d3a450a4ddaa74e8ce386d790e988403dd178fe1d1591370751ee9c
6
+ metadata.gz: 470c18185dc8fb6b7a1d10e6686ad6bfa9b4224cf00a882237201f168c0f127185c3f2f243f3c46e4c419f8376cbf3f94f441babf289088d8549635cf3f6fd63
7
+ data.tar.gz: bfd6a558830b9cb167dbe71772b79a1fcfe5a919bea9675ec06ec686e31755b7ed0ed7dd1b93a5596db6e2943494fae9777698fd91f39ed557c8d7666398038d
@@ -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
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '5.7.1'.freeze
2
+ VERSION = '5.8.0'.freeze
3
3
  end
@@ -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
@@ -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.7.1
4
+ version: 5.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-14 00:00:00.000000000 Z
11
+ date: 2020-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -300,6 +300,7 @@ files:
300
300
  - spec/support/fixtures/create_payment_detail.json
301
301
  - spec/support/fixtures/create_phone_number.json
302
302
  - spec/support/fixtures/create_recurring_donation.json
303
+ - spec/support/fixtures/create_recurring_donation_detail.json
303
304
  - spec/support/fixtures/create_refund.json
304
305
  - spec/support/fixtures/create_refund_reason.json
305
306
  - spec/support/fixtures/create_saved_payment_method.json