rock_rms 7.0.0 → 7.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rock_rms/client.rb +1 -2
  3. data/lib/rock_rms/parse_oj.rb +13 -0
  4. data/lib/rock_rms/response/attribute.rb +0 -1
  5. data/lib/rock_rms/response/attribute_value.rb +0 -1
  6. data/lib/rock_rms/response/base.rb +11 -3
  7. data/lib/rock_rms/response/batch.rb +0 -1
  8. data/lib/rock_rms/response/block.rb +0 -1
  9. data/lib/rock_rms/response/block_type.rb +0 -1
  10. data/lib/rock_rms/response/campus.rb +0 -1
  11. data/lib/rock_rms/response/defined_type.rb +0 -1
  12. data/lib/rock_rms/response/defined_value.rb +0 -1
  13. data/lib/rock_rms/response/fund.rb +0 -1
  14. data/lib/rock_rms/response/gateway.rb +0 -1
  15. data/lib/rock_rms/response/group.rb +0 -1
  16. data/lib/rock_rms/response/group_location.rb +0 -1
  17. data/lib/rock_rms/response/history.rb +0 -1
  18. data/lib/rock_rms/response/location.rb +0 -1
  19. data/lib/rock_rms/response/page.rb +0 -1
  20. data/lib/rock_rms/response/payment_detail.rb +0 -1
  21. data/lib/rock_rms/response/person.rb +0 -1
  22. data/lib/rock_rms/response/phone_number.rb +0 -1
  23. data/lib/rock_rms/response/recurring_donation.rb +0 -1
  24. data/lib/rock_rms/response/recurring_donation_details.rb +0 -1
  25. data/lib/rock_rms/response/registration.rb +0 -1
  26. data/lib/rock_rms/response/registration_instance.rb +0 -1
  27. data/lib/rock_rms/response/saved_payment_method.rb +0 -1
  28. data/lib/rock_rms/response/service_job.rb +0 -1
  29. data/lib/rock_rms/response/transaction.rb +0 -1
  30. data/lib/rock_rms/response/transaction_detail.rb +0 -1
  31. data/lib/rock_rms/response/workflow_activity_type.rb +0 -1
  32. data/lib/rock_rms/response/workflow_type.rb +0 -1
  33. data/lib/rock_rms/version.rb +1 -1
  34. data/lib/rock_rms.rb +1 -0
  35. data/rock_rms.gemspec +1 -1
  36. data/spec/rock_rms/client_spec.rb +1 -1
  37. data/spec/rock_rms/response/attribute_value_spec.rb +1 -1
  38. data/spec/rock_rms/response/recurring_donation_spec.rb +3 -1
  39. metadata +5 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cbf6c404818d64db447dec9684bf68e4ecbf8410bf0eb56e415e29cb871acf95
4
- data.tar.gz: 15a858db3f54c8075c8b49797ce98ac563068657d9646037a7002080a122a8c1
3
+ metadata.gz: d50622be87ae69275c27c620dcc9e21d5e473c700554219f7ac4eb29b854ba6e
4
+ data.tar.gz: 01d46085478582b1add636fa558932a7df8f0f99546c66f29f0494de38353c6d
5
5
  SHA512:
6
- metadata.gz: 9475d6bdb74146d458dd4ec30806823f9218c971eba9515b49897791e9faf5f93305fd84ab182f6c9f5d38fc56ee0c2b9b24a5fcaee1407c6fff9f8aca58f4a3
7
- data.tar.gz: 4b4b766e497632de3a72c3122929e51db8b87ae6906ae18c3a486b4b91e07245e513d3dd2d6f3f0b933860e916e20241e3bfd1f575f24b628e7c11b9e092fc9d
6
+ metadata.gz: '09895f32647c2cf61724fdc79d11965da9294a253eaa95544a53d29bcfd877c41f9976150dd91b311f41b45ac32795586ae83b93a448ff073b8a502eadecc4a7'
7
+ data.tar.gz: 520aa2aaf064a0a5efecfd6b418b48fbb1559a30b94584f77a59a6675b7156d905fb6ae9b25534c11601c8ecd11fe7bed8f95d74caf747c58a7cf4ad1c10e39b
@@ -1,6 +1,5 @@
1
1
  require 'faraday'
2
2
  require 'faraday_middleware'
3
- require 'faraday_middleware/parse_oj'
4
3
 
5
4
  Dir[File.expand_path('../resources/*.rb', __FILE__)].each { |f| require f }
6
5
  require File.expand_path('../response/base.rb', __FILE__)
@@ -79,7 +78,7 @@ module RockRMS
79
78
  def auth
80
79
  begin
81
80
  auth_request('Auth/Login')
82
- rescue Faraday::Error::ParsingError => e
81
+ rescue Faraday::ParsingError => e
83
82
  if e.message.include?('Document Moved')
84
83
  auth_request('auth/login')
85
84
  else
@@ -0,0 +1,13 @@
1
+ require 'faraday_middleware/response_middleware'
2
+
3
+ module FaradayMiddleware
4
+ class ParseOj < ResponseMiddleware
5
+ dependency 'oj'
6
+
7
+ define_parser do |body|
8
+ Oj.load(body, mode: :compat) unless body.strip.empty?
9
+ end
10
+ end
11
+ end
12
+
13
+ Faraday::Response.register_middleware(oj: FaradayMiddleware::ParseOj)
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Attribute < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  key: 'Key',
8
7
  description: 'Description'
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class AttributeValue < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  value: 'Value',
7
6
  value_as_number: 'ValueAsNumeric',
8
7
  entity_id: 'EntityId'
@@ -3,6 +3,12 @@ module RockRMS
3
3
  class Base
4
4
  attr_reader :data
5
5
 
6
+ BASE_MAPPING = {
7
+ id: 'Id',
8
+ created_date_time: 'CreatedDateTime',
9
+ modified_date_time: 'ModifiedDateTime'
10
+ }.freeze
11
+
6
12
  def self.format(data)
7
13
  new(data).format
8
14
  end
@@ -22,9 +28,11 @@ module RockRMS
22
28
  def to_h(dict, data)
23
29
  return {} if data.nil?
24
30
 
25
- dict.each_with_object({}) do |(l, r), object|
26
- object[l] = data[r]
27
- end
31
+ dict
32
+ .merge(BASE_MAPPING)
33
+ .each_with_object({}) do |(l, r), object|
34
+ object[l] = data[r]
35
+ end
28
36
  end
29
37
  end
30
38
  end
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Batch < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  control_amount: 'ControlAmount',
8
7
  transactions: 'Transactions',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Block < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  block_type: 'BlockType',
8
7
  page_id: 'PageId'
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class BlockType < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  description: 'Description',
8
7
  category: 'Category',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Campus < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  is_active: 'IsActive',
8
7
  description: 'Description',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class DefinedType < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  description: 'Description',
8
7
  defined_values: 'DefinedValues',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class DefinedValue < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  defined_type_id: 'DefinedTypeId',
7
6
  description: 'Description',
8
7
  order: 'Order',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Fund < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  campus_id: 'CampusId',
7
6
  name: 'Name',
8
7
  gl_code: 'GlCode'
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Gateway < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  active: 'IsActive'
8
7
  }.freeze
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Group < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  group_type_id: 'GroupTypeId',
8
7
  parent_group_id: 'ParentGroupId',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class GroupLocation < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  group_id: 'GroupId',
7
6
  location_id: 'LocationId',
8
7
  guid: 'Guid'
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class History < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  verb: 'Verb',
7
6
  change_type: 'ChangeType',
8
7
  value_name: 'ValueName',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Location < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  is_active: 'IsActive',
8
7
  street1: 'Street1',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Page < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'InternalName',
7
6
  page_title: 'PageTitle',
8
7
  browser_title: 'BrowserTitle',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class PaymentDetail < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  exp_month: 'ExpirationMonth',
7
6
  exp_year: 'ExpirationYear',
8
7
  foreign_key: 'ForeignKey',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Person < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'FullName',
7
6
  email: 'Email',
8
7
  first_name: 'FirstName',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class PhoneNumber < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  person_id: 'PersonId',
7
6
  number: 'Number',
8
7
  number_type_value_id: 'NumberTypeValueId',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class RecurringDonation < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  active: 'IsActive',
7
6
  financial_gateway_id: 'FinancialGatewayId',
8
7
  foreign_key: 'ForeignKey',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class RecurringDonationDetails < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  amount: 'Amount',
7
6
  fee_coverage_amount: 'FeeCoverageAmount',
8
7
  fund_id: 'AccountId',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Registration < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  first_name: 'FirstName',
7
6
  last_name: 'LastName',
8
7
  confirmation_email: 'ConfirmationEmail',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class RegistrationInstance < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  start_date: 'StartDateTime',
8
7
  end_date: 'EndDateTime',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class SavedPaymentMethod < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  foreign_key: 'ForeignKey',
7
6
  gateway_id: 'FinancialGatewayId',
8
7
  gateway_person_id: 'GatewayPersonIdentifier',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class ServiceJob < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  active: 'IsActive',
8
7
  description: 'Description',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class Transaction < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  date: 'TransactionDateTime',
7
6
  person: 'AuthorizedPersonAlias',
8
7
  person_id: 'AuthorizedPersonAliasId',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class TransactionDetail < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  fee_amount: 'FeeAmount',
7
6
  fee_coverage_amount: 'FeeCoverageAmount',
8
7
  fund: 'Account',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class WorkflowActivityType < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  name: 'Name',
7
6
  description: 'Description',
8
7
  order: 'Order',
@@ -2,7 +2,6 @@ module RockRMS
2
2
  module Response
3
3
  class WorkflowType < Base
4
4
  MAP = {
5
- id: 'Id',
6
5
  active: 'IsActive',
7
6
  name: 'Name',
8
7
  description: 'Description',
@@ -1,3 +1,3 @@
1
1
  module RockRMS
2
- VERSION = '7.0.0'.freeze
2
+ VERSION = '7.0.3'.freeze
3
3
  end
data/lib/rock_rms.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require_relative 'rock_rms/client'
2
2
  require_relative 'rock_rms/error'
3
+ require_relative 'rock_rms/parse_oj'
3
4
  require_relative 'rock_rms/version'
4
5
 
5
6
  module RockRMS
data/rock_rms.gemspec CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |s|
22
22
 
23
23
  s.add_runtime_dependency 'faraday'
24
24
  s.add_runtime_dependency 'faraday_middleware'
25
- s.add_runtime_dependency 'faraday_middleware-parse_oj'
26
25
  s.add_runtime_dependency 'json'
26
+ s.add_runtime_dependency 'oj'
27
27
 
28
28
  s.add_development_dependency 'bundler', '~> 2.3'
29
29
  s.add_development_dependency 'dotenv'
@@ -33,7 +33,7 @@ RSpec.describe RockRMS::Client do
33
33
  it 'expects a valid URI' do
34
34
  expect do
35
35
  described_class.new(url: 'test', username: 'test', password: 'test')
36
- end.to raise_error(URI::InvalidURIError)
36
+ end.to raise_error(URI::BadURIError)
37
37
  end
38
38
  end
39
39
  end
@@ -14,7 +14,7 @@ RSpec.describe RockRMS::Response::AttributeValue, type: :model do
14
14
 
15
15
  it 'has the correct number keys' do
16
16
  keys = result.first.keys
17
- expect(keys.count).to eq(4)
17
+ expect(keys.count).to eq(6)
18
18
  end
19
19
 
20
20
  it 'translates keys' do
@@ -15,7 +15,6 @@ RSpec.describe RockRMS::Response::RecurringDonation, type: :model do
15
15
  it 'has the following keys' do
16
16
  response = result.first
17
17
  expected_keys = %i[
18
- id
19
18
  active
20
19
  financial_gateway_id
21
20
  foreign_key
@@ -30,6 +29,9 @@ RSpec.describe RockRMS::Response::RecurringDonation, type: :model do
30
29
  transaction_code
31
30
  transaction_type_id
32
31
  summary
32
+ id
33
+ created_date_time
34
+ modified_date_time
33
35
  ]
34
36
 
35
37
  expect(response.keys).to eq(expected_keys)
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: 7.0.0
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-03 00:00:00.000000000 Z
11
+ date: 2022-08-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: faraday_middleware-parse_oj
42
+ name: json
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: json
56
+ name: oj
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -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/parse_oj.rb
187
188
  - lib/rock_rms/recurring_frequencies.rb
188
189
  - lib/rock_rms/resources/attribute.rb
189
190
  - lib/rock_rms/resources/attribute_value.rb