isaca-rails 0.4.7 → 0.4.8

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
  SHA256:
3
- metadata.gz: 0dde20172b97d248b8e2e00fb9c46eaf43cea9a6db696ea1b9c417b6ef81f8d2
4
- data.tar.gz: 7a0b3892c71331f8ff528ee72106b5479d59e1656dd7d99556312677bccd68f2
3
+ metadata.gz: 7afe3c204bc4c58d289096a6bd76b3361f1aeb73ff76f7c6c16d7867183dcd3e
4
+ data.tar.gz: b627a1002caab316552a2f8084e4fb9a17527c1567496ae5c6d4c388a5155f3f
5
5
  SHA512:
6
- metadata.gz: 8ab36a1da69542c74981be964c30384570c886ade06124a9cda4c7c89da06612c50127988262660e01f4f04f4fc7607a798cd285bdefd9dc2e2a5a19d3f152a6
7
- data.tar.gz: 6708f386489b9c44282c17d29affb64b5a0a42076baaf1412a11fcaee1cba1607464b49e3cd44e826486891546527883ae39129bafb754cee4bba8365eb45cc3
6
+ metadata.gz: fb8446322b9a69b9318683bcc8891eb46a69a7b194ffdd071b136c21cd788fd7982366668a3aa48c0cc1ab3ae25ad74b30c84d5705ffc6d4ce44dff87a6dd53c
7
+ data.tar.gz: 507b7488b1eaa633c0087e2950ae60cb9a8af0dba73e5bd1ceeeff874e286ef74013474f7d3fb4971f1160da1e99259a63a34dd3f3adb3fb4f14579a94288477
@@ -8,8 +8,17 @@ class Isaca::Rails::UsersConsentController < Isaca::Rails::ApplicationController
8
8
  def create
9
9
  @form_object = UserConsent::Agreement::FormObject.new(agreement_params)
10
10
 
11
- if @form_object.report_consent(current_isaca_user.imis_id)
12
- flash.notice = t('isaca.rails.user_consent.consent_submitted')
11
+ if @form_object.valid?
12
+ response = Isaca::Request::ReportConsent.get(current_isaca_user.imis_id, current_isaca_user.email, {
13
+ marketing: agreement_params[:marketing_policy]
14
+ })
15
+
16
+ if response
17
+ flash.notice = t('isaca.rails.user_consent.consent_submitted')
18
+ else
19
+ flash.alert = t('isaca.rails.user_consent.consent_failed')
20
+ end
21
+
13
22
  redirect_after_sign_in_or(root_path)
14
23
  else
15
24
  render :show
@@ -1,25 +1,11 @@
1
1
  module UserConsent
2
2
  module Agreement
3
- # Form object used for handling user consent
4
3
  class FormObject
5
4
  include ActiveModel::Model
6
5
 
7
6
  attr_accessor :privacy_policy, :marketing_policy
8
- validates_acceptance_of :privacy_policy, allow_nil: false
9
- validates_presence_of :marketing_policy
10
-
11
-
12
- # Method used to report user consent of the privacy policy and marketing
13
- #
14
- # @param options [Hash] Optional. If not provided, marketing consent will default to NO [0].
15
- #
16
- # == Options
17
- # [marketing] Consent for marketing. Acceptable values are 0 [for NO] and 1 [for YES].
18
- #
19
- # @return [Boolean] Whether or not the consent was successfully reported to ISACA
20
- def report_consent(imis_id, options={})
21
- Isaca::Request::ReportConsent.get(imis_id, options).success? if valid?
22
- end
7
+ validates :privacy_policy, acceptance: {accept: %w(0 1)}, allow_nil: false
8
+ validates :marketing_policy, acceptance: {accept: %w(0 1)}, allow_nil: false
23
9
 
24
10
  # Defining this method allows us to use some ActiveModel patterns. For example, forms will be identified
25
11
  # as sign_in instead of session_sign_in_form_object.
@@ -14,6 +14,7 @@ en:
14
14
  user_consent:
15
15
  consent_required: Your consent is required before proceeding.
16
16
  consent_submitted: You have successfully updated your privacy policy and marketing preferences.
17
+ consent_failed: An error occurred that prevented you from submitting your consent form.
17
18
  administrators:
18
19
  email_not_found: Could not find a record with the provided email.
19
20
  created: Administrator was successfully created.
@@ -1,5 +1,5 @@
1
1
  module Isaca
2
2
  module Rails
3
- VERSION = '0.4.7'
3
+ VERSION = '0.4.8'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isaca-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Orahood
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-26 00:00:00.000000000 Z
11
+ date: 2019-07-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.3'
33
+ version: '1.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.3'
40
+ version: '1.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sass-rails
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -303,8 +303,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
303
303
  - !ruby/object:Gem::Version
304
304
  version: '0'
305
305
  requirements: []
306
- rubyforge_project:
307
- rubygems_version: 2.7.7
306
+ rubygems_version: 3.0.3
308
307
  signing_key:
309
308
  specification_version: 4
310
309
  summary: Summary of Isaca::Rails.