draisine 0.7.10 → 0.7.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/draisine/soap_controller.rb +6 -2
- data/lib/draisine/jobs/job_base.rb +1 -0
- data/lib/draisine/soap_handler.rb +3 -3
- data/lib/draisine/util/encoding.rb +7 -0
- data/lib/draisine/util/salesforce_comparisons.rb +1 -1
- data/lib/draisine/version.rb +1 -1
- data/lib/draisine.rb +2 -0
- data/lib/ext/active_job.rb +31 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e02084ec5e958abc727a572424931988333da60c
|
4
|
+
data.tar.gz: 263bfc31d6f0f5728cefaae6533f929b1a23b4e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 667c1187aa466afe49c43335ca603786db538985481a288d4c14f781226ee05ff009ace0c970c603e61d027f146f7426b8b53ffd3e3727ab6a017742e2ef7ce1
|
7
|
+
data.tar.gz: babbfc5d421361b6ff4d6cc7cfd6e70ffd1c615df1611dc675b0b7c6c9a4a6bad1b3e5efc967444cf94bd32f5c51f554911ccb00adafd07124d3933ff28d2347
|
@@ -5,7 +5,7 @@ module Draisine
|
|
5
5
|
before_filter :validate_ip
|
6
6
|
|
7
7
|
def update
|
8
|
-
message =
|
8
|
+
message = incoming_xml
|
9
9
|
if Draisine.sync_soap_operations?
|
10
10
|
Draisine::SoapUpdateJob.perform_now(message)
|
11
11
|
else
|
@@ -16,7 +16,7 @@ module Draisine
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def delete
|
19
|
-
message =
|
19
|
+
message = incoming_xml
|
20
20
|
if Draisine.sync_soap_operations?
|
21
21
|
Draisine::SoapDeleteJob.perform_now(message)
|
22
22
|
else
|
@@ -45,5 +45,9 @@ module Draisine
|
|
45
45
|
</soapenv:Envelope>
|
46
46
|
EOF
|
47
47
|
end
|
48
|
+
|
49
|
+
def incoming_xml
|
50
|
+
Draisine::Encoding.convert_to_utf_and_sanitize(request.body.read)
|
51
|
+
end
|
48
52
|
end
|
49
53
|
end
|
@@ -44,7 +44,7 @@ module Draisine
|
|
44
44
|
when String
|
45
45
|
Hash.from_xml(message_xml)
|
46
46
|
else
|
47
|
-
|
47
|
+
fail ArgumentError, "unknown message type: #{message_xml.inspect}"
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -57,13 +57,13 @@ module Draisine
|
|
57
57
|
def assert_valid_organization_id!(message)
|
58
58
|
unless diggable_to?(message, ['Envelope', 'Body', 'notifications', 'OrganizationId']) &&
|
59
59
|
message['Envelope']['Body']['notifications']['OrganizationId'] == Draisine.organization_id
|
60
|
-
fail InvalidOrganizationError, "a message from invalid organization id received"
|
60
|
+
fail InvalidOrganizationError, "a message from invalid organization id received, source xml: #{message.inspect}"
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
64
|
def assert_valid_message!(message)
|
65
65
|
unless diggable_to?(message, ['Envelope', 'Body', 'notifications', 'Notification'])
|
66
|
-
fail ArgumentError, "malformed xml inbound message from salesforce"
|
66
|
+
fail ArgumentError, "malformed xml inbound message from salesforce, source xml: #{message.inspect}"
|
67
67
|
end
|
68
68
|
assert_valid_organization_id!(message)
|
69
69
|
end
|
data/lib/draisine/version.rb
CHANGED
data/lib/draisine.rb
CHANGED
@@ -2,6 +2,7 @@ require "active_support"
|
|
2
2
|
require "active_support/core_ext"
|
3
3
|
require "active_support/concern"
|
4
4
|
require "active_job/base"
|
5
|
+
require "ext/active_job"
|
5
6
|
|
6
7
|
require "databasedotcom"
|
7
8
|
require "ext/databasedotcom"
|
@@ -25,6 +26,7 @@ require "draisine/util/hash_diff"
|
|
25
26
|
require "draisine/util/parse_time"
|
26
27
|
require "draisine/util/salesforce_comparisons"
|
27
28
|
require "draisine/util/caching_client"
|
29
|
+
require "draisine/util/encoding"
|
28
30
|
|
29
31
|
require "draisine/query_mechanisms"
|
30
32
|
require "draisine/partitioner"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# Borrowed from:
|
2
|
+
# https://github.com/isaacseymour/activejob-retry/blob/master/lib/active_job/retry/deserialize_monkey_patch.rb
|
3
|
+
# Unneccessary after rails 5+
|
4
|
+
|
5
|
+
# In Rails 4.2, ActiveJob externally applies deserialized job ID, queue name, arguments to
|
6
|
+
# the instantiated job in `ActiveJob::Base.deserialize`, which cannot be overridden in
|
7
|
+
# subclasses. https://github.com/rails/rails/pull/18260 changes this to delegate as much
|
8
|
+
# of the deserialization as possible to the instance, i.e. `ActiveJob::Base#deserialize`,
|
9
|
+
# which can be overridden. This allows us to store extra information in the queue (i.e.
|
10
|
+
# retry_attempt), which is essential for ActiveJob::Retry.
|
11
|
+
#
|
12
|
+
# This monkey patch is automatically applied if necessary when ActiveJob::Retry is
|
13
|
+
# required.
|
14
|
+
|
15
|
+
unless ActiveJob::Base.method_defined?(:deserialize)
|
16
|
+
module ActiveJob
|
17
|
+
class Base
|
18
|
+
def self.deserialize(job_data)
|
19
|
+
job = job_data['job_class'].constantize.new
|
20
|
+
job.deserialize(job_data)
|
21
|
+
job
|
22
|
+
end
|
23
|
+
|
24
|
+
def deserialize(job_data)
|
25
|
+
self.job_id = job_data['job_id']
|
26
|
+
self.queue_name = job_data['queue_name']
|
27
|
+
self.serialized_arguments = job_data['arguments']
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: draisine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Abramov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -203,10 +203,12 @@ files:
|
|
203
203
|
- lib/draisine/syncer.rb
|
204
204
|
- lib/draisine/type_mapper.rb
|
205
205
|
- lib/draisine/util/caching_client.rb
|
206
|
+
- lib/draisine/util/encoding.rb
|
206
207
|
- lib/draisine/util/hash_diff.rb
|
207
208
|
- lib/draisine/util/parse_time.rb
|
208
209
|
- lib/draisine/util/salesforce_comparisons.rb
|
209
210
|
- lib/draisine/version.rb
|
211
|
+
- lib/ext/active_job.rb
|
210
212
|
- lib/ext/databasedotcom.rb
|
211
213
|
- lib/generators/draisine/delta_migration_generator.rb
|
212
214
|
- lib/generators/draisine/integration_generator.rb
|