effective_resources 2.8.9 → 2.9.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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10642ec990cb0ad6b2426415a997aead2f5d53bcdb8a932b3f276af5e9485af9
|
4
|
+
data.tar.gz: a971535ad4974d3931be497db3595f91e1baac7483f718e3197778e84674e525
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8ee4692a6b49d21cfe3d591233f9991355cb1d4d3697d5317fceb7186eb9011db71edef3dc8b6ddedc8ba97d3d28b7c7cf80bf753c18a31b344c8cbc7393db1
|
7
|
+
data.tar.gz: 7cfa99b30169c1bb0bc316dafdc29bad35996b678affea7f21e9ab6fe469bdf4dd6a3fe013d028b8e8fb4cd4281aa809640477db683e3cb0d987bc40d62375b5
|
@@ -89,7 +89,9 @@ module ActsAsPurchasableWizard
|
|
89
89
|
raise('already has purchased submit fees') if fees.any?(&:purchased?)
|
90
90
|
|
91
91
|
order = find_or_build_submit_order()
|
92
|
+
raise('expected an Effective::Order') unless order.kind_of?(Effective::Order)
|
92
93
|
raise('already has purchased submit order') if order.purchased?
|
94
|
+
raise('unable to proceed with a voided submit order') if order.try(:voided?)
|
93
95
|
|
94
96
|
true
|
95
97
|
end
|
@@ -39,7 +39,7 @@ module ActsAsStatused
|
|
39
39
|
const_set(:STATUSES, acts_as_statused_options[:statuses])
|
40
40
|
|
41
41
|
before_validation do
|
42
|
-
self.status ||=
|
42
|
+
self.status ||= all_statuses.first
|
43
43
|
|
44
44
|
# Set an existing belongs_to automatically
|
45
45
|
if respond_to?("#{status}_by") && send("#{status}_by").blank?
|
@@ -132,25 +132,51 @@ module ActsAsStatused
|
|
132
132
|
end
|
133
133
|
|
134
134
|
# unapproved!
|
135
|
-
define_method("un#{sym}!") do
|
136
|
-
|
135
|
+
define_method("un#{sym}!") do |atts = {}|
|
136
|
+
raise 'expected a Hash of passed attributes' unless atts.kind_of?(Hash)
|
137
137
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
if respond_to?("#{sym}_by") && send("#{sym}_by").present?
|
143
|
-
self.send("#{sym}_by=", nil)
|
144
|
-
end
|
138
|
+
self.try("#{sym}_at=", nil)
|
139
|
+
self.try("#{sym}_by=", nil)
|
140
|
+
self.try("#{sym}_by_id=", nil)
|
141
|
+
self.try("#{sym}_by_type=", nil)
|
145
142
|
|
146
143
|
status_steps.delete(sym_at)
|
147
144
|
status_steps.delete(sym_by_id)
|
148
145
|
status_steps.delete(sym_by_type)
|
149
146
|
|
150
|
-
|
147
|
+
if status == sym.to_s # I was just this status
|
148
|
+
assign_attributes(status: last_completed_status || all_statuses.first)
|
149
|
+
end
|
150
|
+
|
151
|
+
# Assign atts if present
|
152
|
+
assign_attributes(atts) if atts.present?
|
153
|
+
|
154
|
+
save!
|
151
155
|
end
|
156
|
+
end
|
152
157
|
|
158
|
+
# Regular instance methods
|
159
|
+
# Sort of matches acts_as_wizard
|
160
|
+
def status_keys
|
161
|
+
self.class.const_get(:STATUSES)
|
153
162
|
end
|
163
|
+
|
164
|
+
def all_statuses
|
165
|
+
status_keys
|
166
|
+
end
|
167
|
+
|
168
|
+
def completed_statuses
|
169
|
+
all_statuses.select { |status| has_completed_status?(status) }
|
170
|
+
end
|
171
|
+
|
172
|
+
def last_completed_status
|
173
|
+
all_statuses.reverse.find { |status| has_completed_status?(status) }
|
174
|
+
end
|
175
|
+
|
176
|
+
def has_completed_status?(status)
|
177
|
+
(errors.present? ? status_steps_was : status_steps)["#{status}_at".to_sym].present?
|
178
|
+
end
|
179
|
+
|
154
180
|
end
|
155
181
|
|
156
182
|
module ClassMethods
|
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.
|
4
|
+
version: 2.9.0
|
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-08-
|
11
|
+
date: 2023-08-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|