rock_rms 4.5.0 → 4.6.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
  SHA1:
3
- metadata.gz: 59e90862a4b1de48956ca5013d237994dee60ac3
4
- data.tar.gz: ee44b3c8fdcfe8a733d684f10cfe12cd797c9087
3
+ metadata.gz: 1a3054295b2deca69b1eb80316e76a7167a8c5cb
4
+ data.tar.gz: ebb9413e249d73551942e07377f64c329b44c028
5
5
  SHA512:
6
- metadata.gz: 4774e516bd2ecb8c093393aa0effd7a4b2c621df478f27096f1705c1c0d1f00b7b852d948bcd2d44d8a269c527647484782ac7f3c92a05845d8eb0c1ce47e8ea
7
- data.tar.gz: 5741aff3e3087ff2fa0463ecf4dfb90a3616ee1c92e3a59ecbc77ff74b43973528ac14128509dc65ae469e04052c2bfece0a68361aa84b9586e3ffbcb8f6a070
6
+ metadata.gz: 37eb36da20fe40cd761337d53eeaf5464cb6f3e0f93c0b2d51233ca87ead149c4aa3bac9e01f19e672e1c2dca4dd78d0a72f7fccaab3892de62285e95817aa6c
7
+ data.tar.gz: 64e62fbdc08a874012edbae3c5ad65b177d8da89be1f0de20d21d2e21ecfb4a4c23d3d79f57d90f551a9ef04eca3637262af1c56c6a359d8da0644eec88a0996
@@ -4,10 +4,12 @@ require 'faraday_middleware/parse_oj'
4
4
 
5
5
  Dir[File.expand_path('../resources/*.rb', __FILE__)].each { |f| require f }
6
6
  require File.expand_path('../response/base.rb', __FILE__)
7
+ require File.expand_path('../recurring_frequencies.rb', __FILE__)
7
8
  Dir[File.expand_path('../response/*.rb', __FILE__)].each { |f| require f }
8
9
 
9
10
  module RockRMS
10
11
  class Client
12
+ include RecurringFrequencies
11
13
  include RockRMS::Client::Attribute
12
14
  include RockRMS::Client::AttributeValue
13
15
  include RockRMS::Client::Batch
@@ -0,0 +1,11 @@
1
+ module RecurringFrequencies
2
+ RECURRING_FREQUENCIES = {
3
+ 'one-time' => 130,
4
+ 'weekly' => 132,
5
+ 'bi-weekly' => 133,
6
+ 'twice-a-month' => 134,
7
+ 'monthly' => 135,
8
+ 'quarterly' => 153,
9
+ 'yearly' => 155
10
+ }.freeze
11
+ end
@@ -27,7 +27,7 @@ module RockRMS
27
27
 
28
28
  options = {
29
29
  'AuthorizedPersonAliasId' => authorized_person_id,
30
- 'TransactionFrequencyValueId' => RECURRING_FREQUENCIES[frequency],
30
+ 'TransactionFrequencyValueId' => RecurringFrequencies::RECURRING_FREQUENCIES[frequency],
31
31
  'StartDate' => start_date,
32
32
  'NextPaymentDate' => next_payment_date,
33
33
  'IsActive' => active,
@@ -56,16 +56,6 @@ module RockRMS
56
56
 
57
57
  private
58
58
 
59
- RECURRING_FREQUENCIES = {
60
- 'one-time' => 130,
61
- 'weekly' => 132,
62
- 'bi-weekly' => 133,
63
- 'twice-a-month' => 134,
64
- 'monthly' => 135,
65
- 'quarterly' => 153,
66
- 'yearly' => 155
67
- }.freeze
68
-
69
59
  def translate_funds(funds)
70
60
  funds.map do |fund|
71
61
  {
@@ -4,20 +4,28 @@ module RockRMS
4
4
  MAP = {
5
5
  id: 'Id',
6
6
  active: 'IsActive',
7
+ financial_gateway_id: 'FinancialGatewayId',
7
8
  foreign_key: 'ForeignKey',
9
+ frequency: 'TransactionFrequencyValueId',
8
10
  next_payment_date: 'NextPaymentDate',
9
11
  payment_details: 'FinancialPaymentDetail',
10
12
  person_id: 'AuthorizedPersonAliasId',
13
+ start_date: 'StartDate',
11
14
  transaction_details: 'ScheduledTransactionDetails',
12
15
  transaction_code: 'TransactionCode'
13
16
  }.freeze
14
17
 
15
18
  def format_single(data)
16
19
  result = to_h(MAP, data)
20
+ result[:frequency] = find_frequency_by_id(result[:frequency])
17
21
  result[:transaction_details] = RecurringDonationDetails.format(result[:transaction_details])
18
22
  result[:payment_details] = PaymentDetail.format(result[:payment_details])
19
23
  result
20
24
  end
25
+
26
+ def find_frequency_by_id(type_id)
27
+ RecurringFrequencies::RECURRING_FREQUENCIES.key(type_id)
28
+ end
21
29
  end
22
30
  end
23
31
  end
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '4.5.0'.freeze
2
+ VERSION = '4.6.0'.freeze
3
3
  end
@@ -12,10 +12,32 @@ RSpec.describe RockRMS::Response::RecurringDonation, type: :model do
12
12
  end
13
13
  end
14
14
 
15
+ it 'has the following keys' do
16
+ response = result.first
17
+ expected_keys = %i[
18
+ id
19
+ active
20
+ financial_gateway_id
21
+ foreign_key
22
+ frequency
23
+ next_payment_date
24
+ payment_details
25
+ person_id
26
+ start_date
27
+ transaction_details
28
+ transaction_code
29
+ ]
30
+
31
+ expect(response.keys).to eq(expected_keys)
32
+ end
33
+
15
34
  it 'translates keys' do
16
35
  result.zip(parsed) do |r, p|
17
36
  expect(r[:id]).to eq(p['Id'])
37
+ expect(r[:active]).to eq(p['IsActive'])
38
+ expect(r[:financial_gateway_id]).to eq(p['FinancialGatewayId'])
18
39
  expect(r[:foreign_key]).to eq(p['ForeignKey'])
40
+ expect(r[:frequency]).to eq('monthly')
19
41
  expect(r[:next_payment_date]).to eq(p['NextPaymentDate'])
20
42
  expect(r[:person_id]).to eq(p['AuthorizedPersonAliasId'])
21
43
  expect(r[:transaction_details]).to eq(
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: 4.5.0
4
+ version: 4.6.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: 2018-09-22 00:00:00.000000000 Z
11
+ date: 2018-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -184,6 +184,7 @@ files:
184
184
  - lib/rock_rms.rb
185
185
  - lib/rock_rms/client.rb
186
186
  - lib/rock_rms/error.rb
187
+ - lib/rock_rms/recurring_frequencies.rb
187
188
  - lib/rock_rms/resources/attribute.rb
188
189
  - lib/rock_rms/resources/attribute_value.rb
189
190
  - lib/rock_rms/resources/batch.rb