rock_rms 1.0.0 → 1.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65005100add8c42685fc4eae6afd72642d839b51
4
- data.tar.gz: b177de895e8be5949aa3a1c3074479f873271594
3
+ metadata.gz: 9d81db433d9edd22ba5fa2148c2b0a82ac7f1150
4
+ data.tar.gz: 6b4b51e866c128c254aad44755fe03170946fd3b
5
5
  SHA512:
6
- metadata.gz: 7122edcf512009eec7a9cc633c0cc087a1962ee1d533b0b47e03b179e19f8b26cb029e43fc846d31d6b81852928ebc674c3979692bbf395786f256359ea803c6
7
- data.tar.gz: 74c27a4c0f3a1536a2ede5c220f1cd3584b0586c5b20e8787a224ab7f161641cc25965dc32bd91ad8b7e04d3c6d66c0faa028cf74f5a1cf2c543f137a79d99bc
6
+ metadata.gz: 33ffe1335a1d8b40e2388d65d9fdab92419644dd7cbabe9c468873fc9322655c033e77db9f1b92dcaf76e74b97fc7d6ec74ec5f8d446358c41b7267138723afd
7
+ data.tar.gz: 1c37aa2af141e7ba2e2b68bfcb13c859a7bd5b83e172053f61a5d4e6a8948161631f4667925016d8de44895b6ea71e0fa69e693b726fae78888a38cae07f082b
@@ -2,12 +2,13 @@ module RockRMS
2
2
  class Client
3
3
  module PaymentMethod
4
4
  def list_payment_methods(options = {})
5
- get(payment_method_path, options)
5
+ res = get(payment_method_path, options)
6
+ RockRMS::PaymentMethod.format(res)
6
7
  end
7
8
 
8
- def create_payment_method(currency_type:, foreign_key: nil)
9
+ def create_payment_method(payment_type:, foreign_key: nil)
9
10
  options = {
10
- 'CurrencyTypeValueId' => currency_type,
11
+ 'CurrencyTypeValueId' => cast_payment_type(payment_type),
11
12
  'ForeignKey' => foreign_key
12
13
  }
13
14
 
@@ -16,6 +17,15 @@ module RockRMS
16
17
 
17
18
  private
18
19
 
20
+ def cast_payment_type(payment_type)
21
+ case payment_type
22
+ when 'card'
23
+ 156
24
+ when 'bank account', 'ach'
25
+ 157
26
+ end
27
+ end
28
+
19
29
  def payment_method_path(id = nil)
20
30
  id ? "FinancialPaymentDetails/#{id}" : 'FinancialPaymentDetails'
21
31
  end
@@ -0,0 +1,24 @@
1
+ module RockRMS
2
+ class PaymentMethod
3
+ MAP = {
4
+ id: 'Id',
5
+ foreign_key: 'ForeignKey',
6
+ payment_type_id: 'CurrencyTypeValueId',
7
+ masked_number: 'AccountNumberMasked'
8
+ }.freeze
9
+
10
+ def self.format(data)
11
+ if data.is_a?(Array)
12
+ data.map { |object| format_single(object) }
13
+ else
14
+ format_single(data)
15
+ end
16
+ end
17
+
18
+ def self.format_single(data)
19
+ MAP.each.with_object({}) do |(l, r), object|
20
+ object[l] = data[r]
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-30 00:00:00.000000000 Z
11
+ date: 2018-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -192,6 +192,7 @@ files:
192
192
  - lib/rock_rms/resources/transaction_detail.rb
193
193
  - lib/rock_rms/responses/donation.rb
194
194
  - lib/rock_rms/responses/fund.rb
195
+ - lib/rock_rms/responses/payment_method.rb
195
196
  - lib/rock_rms/responses/person.rb
196
197
  - lib/rock_rms/responses/recurring_donation.rb
197
198
  - lib/rock_rms/responses/recurring_donation_details.rb