naranya_ecm-sdk 0.0.57 → 0.0.58
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 +4 -4
- data/lib/aasm/persistence/rest_persistence.rb +17 -11
- data/lib/naranya_ecm-sdk/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcb9f2aa5a4616f644664fd5f8ae14c09be7c29e
|
4
|
+
data.tar.gz: ce27bb81cf8cf06b8ca0196b7681f518bd525412
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f38aa840f75c6d4af6cf50011c355a963c4fbbb100e32694de7c465f78b92da1f966aeac3c319cdc691f67a6bc1612d489d65e72458b5de366b740a38311778
|
7
|
+
data.tar.gz: 811474c9ca72bb5a88cf954c253c823373b770b3da5417a6c73dee7010d1632a054dfb09895a38f3e5007f85b40453b49a01b3a134624a8f7515b4559ef1a0a7
|
@@ -62,7 +62,7 @@ module AASM
|
|
62
62
|
|
63
63
|
# protected
|
64
64
|
# def with_state_scope(state)
|
65
|
-
# with_scope :find => {:conditions => ["#{table_name}.#{
|
65
|
+
# with_scope :find => {:conditions => ["#{table_name}.#{aasm.attribute_name} = ?", state.to_s]} do
|
66
66
|
# yield if block_given?
|
67
67
|
# end
|
68
68
|
# end
|
@@ -80,11 +80,11 @@ module AASM
|
|
80
80
|
# #
|
81
81
|
# # NOTE: intended to be called from an event
|
82
82
|
# def aasm_write_state(state)
|
83
|
-
# old_value = self.send self.class.
|
84
|
-
# write_attribute(self.class.
|
83
|
+
# old_value = self.send self.class.aasm.attribute_name.to_sym
|
84
|
+
# write_attribute(self.class.aasm.attribute_name, state.to_s)
|
85
85
|
|
86
86
|
# unless self.save(:validate => false)
|
87
|
-
# write_attribute(self.class.
|
87
|
+
# write_attribute(self.class.aasm.attribute_name, old_value)
|
88
88
|
# return false
|
89
89
|
# end
|
90
90
|
|
@@ -104,23 +104,28 @@ module AASM
|
|
104
104
|
# #
|
105
105
|
# # NOTE: intended to be called from an event
|
106
106
|
# def aasm_write_state_without_persistence(state)
|
107
|
-
# self.off_band_changes["#{self.class.
|
107
|
+
# self.off_band_changes["#{self.class.aasm.attribute_name}_event"] = transition.event
|
108
108
|
# end
|
109
109
|
|
110
110
|
private
|
111
111
|
|
112
112
|
def aasm_ensure_initial_state
|
113
|
-
send("#{self.class.
|
113
|
+
send("#{self.class.aasm.attribute_name}=", aasm.enter_initial_state.to_s) \
|
114
|
+
if send(self.class.aasm.attribute_name).blank?
|
114
115
|
end
|
115
116
|
|
116
117
|
def aasm_fire_event(name, options, *args, &block)
|
117
118
|
local_success = super
|
118
119
|
remote_success = if local_success
|
119
|
-
data = {
|
120
|
+
data = {
|
121
|
+
name: name,
|
122
|
+
target_type: self.class.name.demodulize,
|
123
|
+
target_id: self.id
|
124
|
+
}
|
120
125
|
|
121
|
-
# byebug
|
122
126
|
unless NContent::SDK.config.state_event_delay < 1
|
123
|
-
|
127
|
+
msg = "Will wait #{NContent::SDK.config.state_event_delay} seconds"
|
128
|
+
NContent::SDK.logger.debug "#{msg} before posting the event..."
|
124
129
|
sleep NContent::SDK.config.state_event_delay
|
125
130
|
end
|
126
131
|
|
@@ -129,13 +134,14 @@ module AASM
|
|
129
134
|
req.body = ActiveSupport::JSON.encode(state_event: data)
|
130
135
|
end
|
131
136
|
|
132
|
-
state_attribute = self.class.
|
137
|
+
state_attribute = self.class.aasm.attribute_name
|
133
138
|
state_before_reload = self.send(state_attribute)
|
134
139
|
|
135
140
|
reload
|
136
141
|
state_after_reload = self.send(state_attribute)
|
137
142
|
|
138
|
-
|
143
|
+
msg = "Event: #{name} - #{state_attribute} #{state_before_reload}"
|
144
|
+
NContent::SDK.logger.debug "#{msg} -> #{state_after_reload}"
|
139
145
|
|
140
146
|
# Check that the state changed (and return the result of that check)
|
141
147
|
state_before_reload != state_after_reload
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naranya_ecm-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.58
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Quintanilla
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|