naranya_ecm-sdk 0.0.53 → 0.0.54
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 +20 -6
- data/lib/naranya_ecm-sdk/version.rb +1 -1
- data/lib/ncontent/sdk/config.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24ec59bfd778013ebd40fe4433c022e7e7f0ae26
|
4
|
+
data.tar.gz: f599005158ac669ab12fd0c5fc3dc29c024dcd41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f3440b7d4b6c2a2cfdc408bd31120c67079355d4986f7ab768a26aae56463075736fbcd620bcd7b33283a804fc371f73b167f13c4e95b50c6b73b882a545371
|
7
|
+
data.tar.gz: a19ac110a7f2c744c91debaed63d4664ccceeb86dd1c9e4f4f9d1863fa0918f73cbba318c46d8772b654bbb19a6372a38db0a64f2d78cc556680c2eeb94ec51d
|
@@ -114,19 +114,33 @@ module AASM
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def aasm_fire_event(name, options, *args, &block)
|
117
|
-
local_success
|
118
|
-
|
119
|
-
if local_success
|
117
|
+
local_success = super
|
118
|
+
remote_success = if local_success
|
120
119
|
data = { name: name, target_type: self.class.name.demodulize, target_id: self.id }
|
121
120
|
|
121
|
+
# byebug
|
122
|
+
unless NContent::SDK.config.state_event_delay < 1
|
123
|
+
NContent::SDK.logger.debug "Will wait #{NContent::SDK.config.state_event_delay} seconds before posting the event..."
|
124
|
+
sleep NContent::SDK.config.state_event_delay
|
125
|
+
end
|
126
|
+
|
122
127
|
response = NContent::SDK::RESTClient.post "/events.json" do |req|
|
123
128
|
req.headers[:content_type] = 'application/json'
|
124
129
|
req.body = ActiveSupport::JSON.encode(state_event: data)
|
125
130
|
end
|
126
131
|
|
127
|
-
|
128
|
-
|
129
|
-
|
132
|
+
state_attribute = self.class.aasm_column
|
133
|
+
state_before_reload = self.send(state_attribute)
|
134
|
+
|
135
|
+
reload
|
136
|
+
state_after_reload = self.send(state_attribute)
|
137
|
+
|
138
|
+
NContent::SDK.logger.debug "Event: #{name} - #{state_attribute} #{state_before_reload} -> #{state_after_reload}"
|
139
|
+
|
140
|
+
# Check that the state changed (and return the result of that check)
|
141
|
+
state_before_reload != state_after_reload
|
142
|
+
else
|
143
|
+
false
|
130
144
|
end
|
131
145
|
|
132
146
|
local_success && remote_success
|
data/lib/ncontent/sdk/config.rb
CHANGED
@@ -66,6 +66,10 @@ module NContent
|
|
66
66
|
|
67
67
|
config_accessor(:notification_processing_modules) { [] }
|
68
68
|
|
69
|
+
config_accessor :state_event_delay do
|
70
|
+
(ENV.fetch 'NCONTENT_STATE_EVENT_DELAY', "1").to_i
|
71
|
+
end
|
72
|
+
|
69
73
|
def new_relic_agent_available?
|
70
74
|
defined?(::NewRelic) && defined?(::NewRelic::Agent)
|
71
75
|
end
|