rock_rms 2.0.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/lib/rock_rms/client.rb +2 -2
  4. data/lib/rock_rms/resources/batch.rb +4 -2
  5. data/lib/rock_rms/resources/fund.rb +1 -1
  6. data/lib/rock_rms/resources/group.rb +3 -3
  7. data/lib/rock_rms/resources/person.rb +4 -4
  8. data/lib/rock_rms/resources/phone_number.rb +1 -1
  9. data/lib/rock_rms/resources/recurring_donation.rb +2 -2
  10. data/lib/rock_rms/resources/{donation.rb → transaction.rb} +13 -11
  11. data/lib/rock_rms/resources/transaction_detail.rb +2 -2
  12. data/lib/rock_rms/response/base.rb +29 -0
  13. data/lib/rock_rms/response/batch.rb +23 -0
  14. data/lib/rock_rms/{responses → response}/campus.rb +4 -14
  15. data/lib/rock_rms/response/fund.rb +14 -0
  16. data/lib/rock_rms/{responses → response}/group.rb +4 -14
  17. data/lib/rock_rms/response/group_location.rb +22 -0
  18. data/lib/rock_rms/{responses → response}/location.rb +4 -14
  19. data/lib/rock_rms/response/payment_method.rb +16 -0
  20. data/lib/rock_rms/response/person.rb +20 -0
  21. data/lib/rock_rms/response/phone_number.rb +17 -0
  22. data/lib/rock_rms/response/recurring_donation.rb +20 -0
  23. data/lib/rock_rms/response/recurring_donation_details.rb +14 -0
  24. data/lib/rock_rms/response/transaction.rb +28 -0
  25. data/lib/rock_rms/response/transaction_detail.rb +15 -0
  26. data/lib/rock_rms/version.rb +1 -1
  27. data/spec/rock_rms/resources/batch_spec.rb +8 -1
  28. data/spec/rock_rms/resources/group_spec.rb +3 -3
  29. data/spec/rock_rms/resources/person_spec.rb +1 -1
  30. data/spec/rock_rms/resources/phone_number_spec.rb +1 -1
  31. data/spec/rock_rms/resources/recurring_donation_spec.rb +2 -2
  32. data/spec/rock_rms/resources/transaction_detail_spec.rb +1 -1
  33. data/spec/rock_rms/resources/{donation_spec.rb → transaction_spec.rb} +21 -21
  34. data/spec/rock_rms/response/batch_spec.rb +27 -0
  35. data/spec/rock_rms/{responses → response}/campus_spec.rb +1 -1
  36. data/spec/rock_rms/{responses → response}/group_location_spec.rb +2 -2
  37. data/spec/rock_rms/{responses → response}/group_spec.rb +3 -3
  38. data/spec/rock_rms/{responses → response}/location_spec.rb +1 -1
  39. data/spec/rock_rms/{responses → response}/phone_number_spec.rb +1 -1
  40. data/spec/rock_rms/{responses → response}/recurring_donation_details_spec.rb +1 -1
  41. data/spec/rock_rms/{responses → response}/recurring_donation_spec.rb +2 -2
  42. data/spec/rock_rms/{responses → response}/transaction_detail_spec.rb +1 -1
  43. data/spec/rock_rms/{responses/donation_spec.rb → response/transaction_spec.rb} +3 -3
  44. data/spec/support/fixtures/{create_donation.json → create_transaction.json} +0 -0
  45. data/spec/support/fixtures/{donation.json → transaction.json} +0 -0
  46. data/spec/support/fixtures/{donations.json → transactions.json} +0 -0
  47. data/spec/support/rock_mock.rb +3 -3
  48. metadata +32 -29
  49. data/lib/rock_rms/responses/donation.rb +0 -40
  50. data/lib/rock_rms/responses/fund.rb +0 -18
  51. data/lib/rock_rms/responses/group_location.rb +0 -32
  52. data/lib/rock_rms/responses/payment_method.rb +0 -24
  53. data/lib/rock_rms/responses/person.rb +0 -33
  54. data/lib/rock_rms/responses/phone_number.rb +0 -27
  55. data/lib/rock_rms/responses/recurring_donation.rb +0 -32
  56. data/lib/rock_rms/responses/recurring_donation_details.rb +0 -24
  57. data/lib/rock_rms/responses/transaction_detail.rb +0 -25
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe RockRMS::Responses::TransactionDetail, type: :model do
3
+ RSpec.describe RockRMS::Response::TransactionDetail, type: :model do
4
4
  let(:parsed) { JSON.parse(FixturesHelper.read('transaction_details.json')) }
5
5
 
6
6
  describe '.format' do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- RSpec.describe RockRMS::Responses::Donation, type: :model do
4
- let(:parsed) { JSON.parse(FixturesHelper.read('donations.json')) }
3
+ RSpec.describe RockRMS::Response::Transaction, type: :model do
4
+ let(:parsed) { JSON.parse(FixturesHelper.read('transactions.json')) }
5
5
 
6
6
  describe '.format' do
7
7
  subject(:result) { described_class.format(parsed) }
@@ -21,7 +21,7 @@ RSpec.describe RockRMS::Responses::Donation, type: :model do
21
21
  expect(r[:summary]).to eq(p['Summary'])
22
22
  expect(r[:transaction_code]).to eq(p['TransactionCode'])
23
23
  expect(r[:details]).to eq(
24
- RockRMS::Responses::TransactionDetail.format(p['TransactionDetails'])
24
+ RockRMS::Response::TransactionDetail.format(p['TransactionDetails'])
25
25
  )
26
26
  expect(r[:amount]).to eq(100.00)
27
27
  end
@@ -19,8 +19,8 @@ class RockMock < Sinatra::Base
19
19
  {
20
20
  batch: 'FinancialBatches/:id',
21
21
  batches: 'FinancialBatches',
22
- donation: 'FinancialTransactions/:id',
23
- donations: 'FinancialTransactions',
22
+ transaction: 'FinancialTransactions/:id',
23
+ transactions: 'FinancialTransactions',
24
24
  families: 'Groups/GetFamilies/:id',
25
25
  group: 'Groups/:id',
26
26
  groups: 'Groups',
@@ -39,7 +39,7 @@ class RockMock < Sinatra::Base
39
39
  # POST requests
40
40
  {
41
41
  create_group_member: 'GroupMembers',
42
- create_donation: 'FinancialTransactions',
42
+ create_transaction: 'FinancialTransactions',
43
43
  create_batch: 'FinancialBatches'
44
44
  }.each do |json, end_point|
45
45
  post "/api/#{end_point}" do
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: 2.0.0
4
+ version: 3.0.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-01-26 00:00:00.000000000 Z
11
+ date: 2018-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -185,7 +185,6 @@ files:
185
185
  - lib/rock_rms/client.rb
186
186
  - lib/rock_rms/error.rb
187
187
  - lib/rock_rms/resources/batch.rb
188
- - lib/rock_rms/resources/donation.rb
189
188
  - lib/rock_rms/resources/fund.rb
190
189
  - lib/rock_rms/resources/group.rb
191
190
  - lib/rock_rms/resources/group_member.rb
@@ -193,40 +192,44 @@ files:
193
192
  - lib/rock_rms/resources/person.rb
194
193
  - lib/rock_rms/resources/phone_number.rb
195
194
  - lib/rock_rms/resources/recurring_donation.rb
195
+ - lib/rock_rms/resources/transaction.rb
196
196
  - lib/rock_rms/resources/transaction_detail.rb
197
- - lib/rock_rms/responses/campus.rb
198
- - lib/rock_rms/responses/donation.rb
199
- - lib/rock_rms/responses/fund.rb
200
- - lib/rock_rms/responses/group.rb
201
- - lib/rock_rms/responses/group_location.rb
202
- - lib/rock_rms/responses/location.rb
203
- - lib/rock_rms/responses/payment_method.rb
204
- - lib/rock_rms/responses/person.rb
205
- - lib/rock_rms/responses/phone_number.rb
206
- - lib/rock_rms/responses/recurring_donation.rb
207
- - lib/rock_rms/responses/recurring_donation_details.rb
208
- - lib/rock_rms/responses/transaction_detail.rb
197
+ - lib/rock_rms/response/base.rb
198
+ - lib/rock_rms/response/batch.rb
199
+ - lib/rock_rms/response/campus.rb
200
+ - lib/rock_rms/response/fund.rb
201
+ - lib/rock_rms/response/group.rb
202
+ - lib/rock_rms/response/group_location.rb
203
+ - lib/rock_rms/response/location.rb
204
+ - lib/rock_rms/response/payment_method.rb
205
+ - lib/rock_rms/response/person.rb
206
+ - lib/rock_rms/response/phone_number.rb
207
+ - lib/rock_rms/response/recurring_donation.rb
208
+ - lib/rock_rms/response/recurring_donation_details.rb
209
+ - lib/rock_rms/response/transaction.rb
210
+ - lib/rock_rms/response/transaction_detail.rb
209
211
  - lib/rock_rms/version.rb
210
212
  - rock_rms.gemspec
211
213
  - spec/rock_rms/client_spec.rb
212
214
  - spec/rock_rms/error_spec.rb
213
215
  - spec/rock_rms/resources/batch_spec.rb
214
- - spec/rock_rms/resources/donation_spec.rb
215
216
  - spec/rock_rms/resources/group_member_spec.rb
216
217
  - spec/rock_rms/resources/group_spec.rb
217
218
  - spec/rock_rms/resources/person_spec.rb
218
219
  - spec/rock_rms/resources/phone_number_spec.rb
219
220
  - spec/rock_rms/resources/recurring_donation_spec.rb
220
221
  - spec/rock_rms/resources/transaction_detail_spec.rb
221
- - spec/rock_rms/responses/campus_spec.rb
222
- - spec/rock_rms/responses/donation_spec.rb
223
- - spec/rock_rms/responses/group_location_spec.rb
224
- - spec/rock_rms/responses/group_spec.rb
225
- - spec/rock_rms/responses/location_spec.rb
226
- - spec/rock_rms/responses/phone_number_spec.rb
227
- - spec/rock_rms/responses/recurring_donation_details_spec.rb
228
- - spec/rock_rms/responses/recurring_donation_spec.rb
229
- - spec/rock_rms/responses/transaction_detail_spec.rb
222
+ - spec/rock_rms/resources/transaction_spec.rb
223
+ - spec/rock_rms/response/batch_spec.rb
224
+ - spec/rock_rms/response/campus_spec.rb
225
+ - spec/rock_rms/response/group_location_spec.rb
226
+ - spec/rock_rms/response/group_spec.rb
227
+ - spec/rock_rms/response/location_spec.rb
228
+ - spec/rock_rms/response/phone_number_spec.rb
229
+ - spec/rock_rms/response/recurring_donation_details_spec.rb
230
+ - spec/rock_rms/response/recurring_donation_spec.rb
231
+ - spec/rock_rms/response/transaction_detail_spec.rb
232
+ - spec/rock_rms/response/transaction_spec.rb
230
233
  - spec/rock_rms_spec.rb
231
234
  - spec/spec_helper.rb
232
235
  - spec/support/client_factory.rb
@@ -234,10 +237,8 @@ files:
234
237
  - spec/support/fixtures/batches.json
235
238
  - spec/support/fixtures/campuses.json
236
239
  - spec/support/fixtures/create_batch.json
237
- - spec/support/fixtures/create_donation.json
238
240
  - spec/support/fixtures/create_group_member.json
239
- - spec/support/fixtures/donation.json
240
- - spec/support/fixtures/donations.json
241
+ - spec/support/fixtures/create_transaction.json
241
242
  - spec/support/fixtures/families.json
242
243
  - spec/support/fixtures/group.json
243
244
  - spec/support/fixtures/group_locations.json
@@ -251,8 +252,10 @@ files:
251
252
  - spec/support/fixtures/recurring_donation.json
252
253
  - spec/support/fixtures/recurring_donation_details.json
253
254
  - spec/support/fixtures/recurring_donations.json
255
+ - spec/support/fixtures/transaction.json
254
256
  - spec/support/fixtures/transaction_detail.json
255
257
  - spec/support/fixtures/transaction_details.json
258
+ - spec/support/fixtures/transactions.json
256
259
  - spec/support/fixtures_helper.rb
257
260
  - spec/support/rock_mock.rb
258
261
  homepage: https://github.com/taylorbrooks/rock_rms
@@ -275,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
278
  version: '0'
276
279
  requirements: []
277
280
  rubyforge_project:
278
- rubygems_version: 2.4.8
281
+ rubygems_version: 2.5.2.2
279
282
  signing_key:
280
283
  specification_version: 4
281
284
  summary: A Ruby wrapper for the Rock RMS API
@@ -1,40 +0,0 @@
1
- module RockRMS
2
- module Responses
3
- class Donation
4
- MAP = {
5
- id: 'Id',
6
- date: 'TransactionDateTime',
7
- person_id: 'AuthorizedPersonAliasId',
8
- batch_id: 'BatchId',
9
- recurring_donation_id: 'ScheduledTransactionId',
10
- summary: 'Summary',
11
- transaction_code: 'TransactionCode',
12
- details: 'TransactionDetails'
13
- }.freeze
14
-
15
- def self.format(response)
16
- if response.is_a?(Array)
17
- response.map { |data| format_single(data) }
18
- else
19
- format_single(response)
20
- end
21
- end
22
-
23
- def self.format_single(data)
24
- response = MAP.each.with_object({}) do |(l, r), object|
25
- object[l] = if l == :details
26
- RockRMS::Responses::TransactionDetail.format(data[r])
27
- else
28
- data[r]
29
- end
30
- end
31
- response[:amount] = calculate_total(response[:details])
32
- response
33
- end
34
-
35
- def self.calculate_total(details)
36
- details.reduce(0) { |sum, td| sum + td[:amount] }
37
- end
38
- end
39
- end
40
- end
@@ -1,18 +0,0 @@
1
- module RockRMS
2
- class Fund
3
- def self.format(response)
4
- if response.is_a?(Array)
5
- response.map { |fund| format_fund(fund) }
6
- else
7
- format_fund(response)
8
- end
9
- end
10
-
11
- def self.format_fund(fund)
12
- {
13
- id: fund['Id'],
14
- name: fund['Name']
15
- }
16
- end
17
- end
18
- end
@@ -1,32 +0,0 @@
1
- module RockRMS
2
- module Responses
3
- class GroupLocation
4
- MAP = {
5
- id: 'Id',
6
- group_id: 'GroupId',
7
- location_id: 'LocationId',
8
- guid: 'Guid'
9
- }.freeze
10
-
11
- def self.format(data)
12
- if data.is_a?(Array)
13
- data.map { |object| format_single(object) }
14
- else
15
- format_single(data)
16
- end
17
- end
18
-
19
- def self.format_single(data)
20
- result = MAP.each.with_object({}) do |(l, r), object|
21
- object[l] = data[r]
22
- end
23
-
24
- if location = data['Location']
25
- result[:location] = Location.format(location)
26
- end
27
-
28
- result
29
- end
30
- end
31
- end
32
- end
@@ -1,24 +0,0 @@
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,33 +0,0 @@
1
- module RockRMS
2
- module Responses
3
- class Person
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 self.format(data)
16
- if data.is_a?(Array)
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
- MAP.each.with_object({}) do |(l, r), object|
25
- object[l] = data[r]
26
- end
27
- end
28
- end
29
- end
30
-
31
- # for backwards compatibility
32
- Person = Responses::Person
33
- end
@@ -1,27 +0,0 @@
1
- module RockRMS
2
- module Responses
3
- class PhoneNumber
4
- MAP = {
5
- id: 'Id',
6
- person_id: 'PersonId',
7
- number: 'Number',
8
- formatted: 'NumberFormatted',
9
- formatted_with_cc: 'NumberFormattedWithCountryCode'
10
- }.freeze
11
-
12
- def self.format(response)
13
- if response.is_a?(Array)
14
- response.map { |number| format_number(number) }
15
- else
16
- format_number(response)
17
- end
18
- end
19
-
20
- def self.format_number(data)
21
- MAP.each.with_object({}) do |(l, r), object|
22
- object[l] = data[r]
23
- end
24
- end
25
- end
26
- end
27
- end
@@ -1,32 +0,0 @@
1
- module RockRMS
2
- module Responses
3
- class RecurringDonation
4
- MAP = {
5
- id: 'Id',
6
- foreign_key: 'ForeignKey',
7
- next_payment_date: 'NextPaymentDate',
8
- person_id: 'AuthorizedPersonAliasId',
9
- transaction_details: 'ScheduledTransactionDetails',
10
- transaction_code: 'TransactionCode'
11
- }.freeze
12
-
13
- def self.format(data)
14
- if data.is_a?(Array)
15
- data.map { |object| format_single(object) }
16
- else
17
- format_single(data)
18
- end
19
- end
20
-
21
- def self.format_single(data)
22
- MAP.each.with_object({}) do |(l, r), object|
23
- object[l] = if l == :transaction_details
24
- RockRMS::Responses::RecurringDonationDetails.format(data[r])
25
- else
26
- data[r]
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
@@ -1,24 +0,0 @@
1
- module RockRMS
2
- module Responses
3
- class RecurringDonationDetails
4
- MAP = {
5
- fund_id: 'AccountId',
6
- amount: 'Amount'
7
- }.freeze
8
-
9
- def self.format(data)
10
- if data.is_a?(Array)
11
- data.map { |object| format_single(object) }
12
- else
13
- format_single(data)
14
- end
15
- end
16
-
17
- def self.format_single(data)
18
- MAP.each.with_object({}) do |(l, r), object|
19
- object[l] = data[r]
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,25 +0,0 @@
1
- module RockRMS
2
- module Responses
3
- class TransactionDetail
4
- MAP = {
5
- id: 'Id',
6
- fund_id: 'AccountId',
7
- amount: 'Amount'
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
25
- end