rock_rms 3.2.0 → 3.4.0

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: f0cae4d173508c911eed0f4b4f42bb066733ef4c
4
- data.tar.gz: 0d3693d923644c81c47d00346f658f3b96a9704d
3
+ metadata.gz: cea1c7188cb9f0611e98f27122b16c6ff12f6760
4
+ data.tar.gz: b56617dd53c3067e44f381425b013b0846eca94e
5
5
  SHA512:
6
- metadata.gz: 4cbcc9c63f6f55faba9306674e95873821b274c543136cce124a8e46adeffe4438a4721fe4619cceaa5ce7e92c20f9e9b7dd9353752abde5398f361001b2aeb3
7
- data.tar.gz: 837493f64846af3869877c167f43733b05a252201e4cf2e3ba64b527e558e153d6880e1ee93f53b50ff12f3288dc9e41f3c586aae9af12515b89fadecf7a5204
6
+ metadata.gz: af3f37cbcca2633b648555e811751399814587e160593cdb5d2af903c42ff8608491871f7e100f45e9557a1a54ec286bbf2d4a212de6278b7d2d238358c11f2d
7
+ data.tar.gz: '08cf5c1f2c891b06c870c1a8c7baecaa1c2ebe795e51a0b4ebc488c93c94634025cb53c47d61e7da384777e990fd3e24708c2762ee2e1d7a174595e5ecab3d60'
@@ -10,6 +10,7 @@ module RockRMS
10
10
  class Client
11
11
  include RockRMS::Client::Batch
12
12
  include RockRMS::Client::Fund
13
+ include RockRMS::Client::Campus
13
14
  include RockRMS::Client::Group
14
15
  include RockRMS::Client::GroupMember
15
16
  include RockRMS::Client::PaymentMethod
@@ -11,10 +11,11 @@ module RockRMS
11
11
  Response::Batch.format(res)
12
12
  end
13
13
 
14
- def create_batch(name:, start_time:, end_time:, foreign_key: nil)
14
+ def create_batch(name:, start_time:, end_time:, foreign_key: nil, campus_id: nil)
15
15
  options = {
16
16
  'Name' => name,
17
17
  'BatchStartDateTime' => start_time,
18
+ 'CampusId' => campus_id,
18
19
  'BatchEndDateTime' => end_time,
19
20
  'ForeignKey' => foreign_key
20
21
  }
@@ -0,0 +1,16 @@
1
+ module RockRMS
2
+ class Client
3
+ module Campus
4
+
5
+ def find_campus(id)
6
+ Response::Campus.format(get(campus_path(id)))
7
+ end
8
+
9
+ private
10
+
11
+ def campus_path(id = nil)
12
+ id ? "Campuses/#{id}" : 'Campus'
13
+ end
14
+ end
15
+ end
16
+ end
@@ -5,13 +5,20 @@ module RockRMS
5
5
  id: 'Id',
6
6
  name: 'Name',
7
7
  control_amount: 'ControlAmount',
8
- transactions: 'Transactions'
8
+ transactions: 'Transactions',
9
+ start_date: 'BatchStartDateTime',
10
+ end_date: 'BatchEndDateTime',
11
+ campus_id: 'CampusId',
12
+ is_campus: 'Campus',
13
+ status: 'Status',
9
14
  }.freeze
10
15
 
11
16
  def format_single(data)
12
17
  response = to_h(MAP, data)
13
18
  response[:transactions] = Transaction.format(response[:transactions])
14
19
  response[:amount] = calculate_total(response[:transactions])
20
+ response[:start_date] = DateTime.parse(response[:start_date])
21
+ response[:end_date] = DateTime.parse(response[:end_date])
15
22
  response
16
23
  end
17
24
 
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '3.2.0'.freeze
2
+ VERSION = '3.4.0'.freeze
3
3
  end
@@ -56,6 +56,7 @@ RSpec.describe RockRMS::Client::Batch, type: :model do
56
56
  name: '1',
57
57
  start_time: '1',
58
58
  end_time: '1',
59
+ campus_id: 1,
59
60
  foreign_key: 1
60
61
  )
61
62
  end
@@ -69,6 +70,7 @@ RSpec.describe RockRMS::Client::Batch, type: :model do
69
70
  .with(
70
71
  'FinancialBatches',
71
72
  'Name' => '1',
73
+ 'CampusId' => 1,
72
74
  'BatchStartDateTime' => '1',
73
75
  'BatchEndDateTime' => '1',
74
76
  'ForeignKey' => 1
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe RockRMS::Client::Campus, type: :model do
4
+ include_context 'resource specs'
5
+
6
+ describe '#find_campus(id)' do
7
+ it 'returns a hash' do
8
+ expect(client.find_campus(1)).to be_a(Hash)
9
+ end
10
+
11
+ it 'queries campuses' do
12
+ expect(client).to receive(:get).with('Campuses/1').and_call_original
13
+
14
+ resource = client.find_campus(1)
15
+
16
+ expect(resource[:id]).to eq(1)
17
+ end
18
+
19
+ it 'formats with Campus' do
20
+ response = double
21
+ expect(RockRMS::Response::Campus).to receive(:format).with(response)
22
+ allow(client).to receive(:get).and_return(response)
23
+ client.find_campus(1)
24
+ end
25
+ end
26
+
27
+ end
@@ -9,7 +9,7 @@
9
9
  "ModifiedDateTime": null,
10
10
  "AccountingSystemCode": null,
11
11
  "Campus": null,
12
- "CampusId": null,
12
+ "CampusId": 1,
13
13
  "Note": null,
14
14
  "Guid": "ce01d12e-dac1-4079-b454-ae5edbafb0df",
15
15
  "Id": 123,
@@ -10,7 +10,7 @@
10
10
  "ModifiedDateTime": null,
11
11
  "AccountingSystemCode": null,
12
12
  "Campus": null,
13
- "CampusId": null,
13
+ "CampusId": 1,
14
14
  "Note": null,
15
15
  "Guid": "ce01d12e-dac1-4079-b454-ae5edbafb0df",
16
16
  "Id": 12312345,
@@ -0,0 +1,21 @@
1
+ {
2
+ "IsSystem": false,
3
+ "Name": "Campus Name",
4
+ "Description": "A campus description here.",
5
+ "IsActive": true,
6
+ "ShortCode": "CampusName",
7
+ "Url": "http://some-url.com",
8
+ "LocationId": 12,
9
+ "PhoneNumber": "1234567890",
10
+ "LeaderPersonAliasId": null,
11
+ "ServiceTimes": "Service Times Here",
12
+ "CreatedDateTime": null,
13
+ "ModifiedDateTime": "2017-07-26T14:41:58.103",
14
+ "CreatedByPersonAliasId": null,
15
+ "ModifiedByPersonAliasId": 12,
16
+ "Id": 1,
17
+ "Guid": "76882ae3",
18
+ "ForeignId": 1,
19
+ "ForeignGuid": null,
20
+ "ForeignKey": null
21
+ }
@@ -19,6 +19,7 @@ class RockMock < Sinatra::Base
19
19
  {
20
20
  batch: 'FinancialBatches/:id',
21
21
  batches: 'FinancialBatches',
22
+ campus: 'Campuses/:id',
22
23
  transaction: 'FinancialTransactions/:id',
23
24
  transactions: 'FinancialTransactions',
24
25
  families: 'Groups/GetFamilies/:id',
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: 3.2.0
4
+ version: 3.4.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-02-20 00:00:00.000000000 Z
11
+ date: 2018-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -185,6 +185,7 @@ 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/campus.rb
188
189
  - lib/rock_rms/resources/fund.rb
189
190
  - lib/rock_rms/resources/group.rb
190
191
  - lib/rock_rms/resources/group_member.rb
@@ -214,6 +215,7 @@ files:
214
215
  - spec/rock_rms/client_spec.rb
215
216
  - spec/rock_rms/error_spec.rb
216
217
  - spec/rock_rms/resources/batch_spec.rb
218
+ - spec/rock_rms/resources/campus_spec.rb
217
219
  - spec/rock_rms/resources/group_member_spec.rb
218
220
  - spec/rock_rms/resources/group_spec.rb
219
221
  - spec/rock_rms/resources/payment_method_spec.rb
@@ -239,6 +241,7 @@ files:
239
241
  - spec/support/client_factory.rb
240
242
  - spec/support/fixtures/batch.json
241
243
  - spec/support/fixtures/batches.json
244
+ - spec/support/fixtures/campus.json
242
245
  - spec/support/fixtures/campuses.json
243
246
  - spec/support/fixtures/create_batch.json
244
247
  - spec/support/fixtures/create_group_member.json