effective_resources 2.17.5 → 2.18.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8d215c9f3f4da7bf1e7776c8a313f7e75c8e2cc611ec5bfa7aab447c9153b70
4
- data.tar.gz: 6c6775a3ae086b767a3a2277afa1bbb874001a9c0ea4de7c5c13939791b1619c
3
+ metadata.gz: 1d6cd13282f95cf3ec83e83274b89a6b2efa95750d85ff9b0c2bfed5d46eefe2
4
+ data.tar.gz: fd91b723775200c44d90440fdd661a6882f759af1ac6d2dbf28ca0b1c15f1075
5
5
  SHA512:
6
- metadata.gz: ebb84318ad63c0cd8cdedf95bab1f72784a10d9e0cd80cdf3dd667c9fbc51bbdb7325686a614c963940ca92bd1bc39f2fa498e1c4733833d8c3b63ed663fc9a0
7
- data.tar.gz: b58c8776531032a60c827a5e78224ebaf23778de79dc0bf2fc86c94dbc949da231606dfc71628ea5abd11083594ba99dfa6ee1f06de7e4dd3ca9096cc20bfcbb
6
+ metadata.gz: 49a7b12ff5a0902003b80966d3fa5102ccb31210315fb90e0e00d39161ff4ae23e42985bfc23d3a09e1e5d8ef5214cdf727543633b0a482af0c63f252ba5b5b6
7
+ data.tar.gz: 11dfc8a21c8c83553451a0ea6507ea54ccaee9707aa4b3718ee9a15f4febcd11cb7ae9e668916c18efb8e16e9ab416046852fae90f4f7be3b34b9107fc43916e
@@ -34,7 +34,11 @@ module ActsAsStatused
34
34
  status_steps :text, permitted: false
35
35
  end
36
36
 
37
- serialize :status_steps, Hash
37
+ if EffectiveResources.serialize_with_coder?
38
+ serialize :status_steps, type: Hash, coder: YAML, default: Hash.new
39
+ else
40
+ serialize :status_steps, Hash
41
+ end
38
42
 
39
43
  const_set(:STATUSES, acts_as_statused_options[:statuses])
40
44
 
@@ -41,7 +41,7 @@ module ActsAsTokened
41
41
 
42
42
  # Instance Methods
43
43
  def to_param
44
- token
44
+ token if persisted?
45
45
  end
46
46
 
47
47
  def to_global_id(**params)
@@ -55,7 +55,11 @@ module ActsAsWizard
55
55
  wizard_steps :text, permitted: false
56
56
  end
57
57
 
58
- serialize :wizard_steps, Hash
58
+ if EffectiveResources.serialize_with_coder?
59
+ serialize :wizard_steps, type: Hash, coder: YAML, default: Hash.new
60
+ else
61
+ serialize :wizard_steps, Hash
62
+ end
59
63
 
60
64
  before_save(if: -> { current_step.present? }) do
61
65
  wizard_steps[current_step.to_sym] ||= Time.zone.now
@@ -28,7 +28,7 @@ module EffectiveGem
28
28
  module ClassMethods
29
29
  def config(namespace = nil)
30
30
  namespace ||= Tenant.current if defined?(Tenant)
31
- @config.dig(namespace) || @config.dig(:effective)
31
+ (@config[namespace] if namespace) || @config[:effective]
32
32
  end
33
33
 
34
34
  def setup(namespace = nil, &block)
@@ -1,3 +1,3 @@
1
1
  module EffectiveResources
2
- VERSION = '2.17.5'.freeze
2
+ VERSION = '2.18.1'.freeze
3
3
  end
@@ -16,6 +16,11 @@ module EffectiveResources
16
16
 
17
17
  include EffectiveGem
18
18
 
19
+ # We use the newer syntax for serialize calls in rails 7+
20
+ def self.serialize_with_coder?
21
+ Gem::Version.new(Gem.loaded_specs['rails'].version.to_s) >= Gem::Version.new('7')
22
+ end
23
+
19
24
  def self.authorized?(controller, action, resource)
20
25
  @exceptions ||= [Effective::AccessDenied, (CanCan::AccessDenied if defined?(CanCan)), (Pundit::NotAuthorizedError if defined?(Pundit))].compact
21
26
 
@@ -120,7 +125,7 @@ module EffectiveResources
120
125
  end
121
126
  end
122
127
 
123
- def self.advance_date(date, business_days: 1, holidays: [:ca, :observed])
128
+ def self.advance_date(date, business_days: 1, holidays: [:us, :observed])
124
129
  raise('business_days must be an integer <= 365') unless business_days.kind_of?(Integer) && business_days <= 365
125
130
 
126
131
  business_days.times do
@@ -133,7 +138,7 @@ module EffectiveResources
133
138
  date
134
139
  end
135
140
 
136
- def self.business_day?(date, holidays: [:ca, :observed])
141
+ def self.business_day?(date, holidays: [:us, :observed])
137
142
  require 'holidays' unless defined?(Holidays)
138
143
  date.wday != 0 && date.wday != 6 && Holidays.on(date, *holidays).blank?
139
144
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.17.5
4
+ version: 2.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-24 00:00:00.000000000 Z
11
+ date: 2023-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.0
19
+ version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.0
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: sprockets-rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: sqlite3
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -126,16 +140,16 @@ dependencies:
126
140
  name: psych
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "<"
143
+ - - ">="
130
144
  - !ruby/object:Gem::Version
131
- version: '4'
145
+ version: '0'
132
146
  type: :development
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - "<"
150
+ - - ">="
137
151
  - !ruby/object:Gem::Version
138
- version: '4'
152
+ version: '0'
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: net-smtp
141
155
  requirement: !ruby/object:Gem::Requirement
@@ -274,7 +288,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
274
288
  - !ruby/object:Gem::Version
275
289
  version: '0'
276
290
  requirements: []
277
- rubygems_version: 3.3.7
291
+ rubygems_version: 3.4.10
278
292
  signing_key:
279
293
  specification_version: 4
280
294
  summary: Make any controller an effective resource controller.