artsy-eventservice 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +2 -0
- data/Gemfile.lock +2 -2
- data/README.md +3 -3
- data/lib/artsy-eventservice/artsy/event_service/publisher.rb +1 -1
- data/lib/artsy-eventservice/presenters/events/base_event.rb +9 -2
- data/lib/artsy-eventservice/version.rb +1 -1
- data/spec/artsy-eventstream/artsy/publisher_spec.rb +1 -1
- data/spec/artsy-eventstream/presenters/events/base_event_spec.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: 9c8662b50032c8b09290c4f31520b4a0f009be08
|
4
|
+
data.tar.gz: 76312d3024e20c9a291b272c118b226768256468
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4944fb73e5a0d848dd1a2796a5356bf9873f4ad3d205c8cca86470c9822ea3ee7706f14db471e0ae1a2fbf278ba3686aa17dcc254102c52982f32d22526cc18f
|
7
|
+
data.tar.gz: 14e0753f34d2e8dc8364b2705bdccda7c78271ae004e023f3f5aef5e3efc105101b7e54bb6ea4af136bddbcce2377e6eb5ff051f5d3ebbbfde8b3ea8cc103314
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ gem 'artsy-eventservice'
|
|
10
10
|
|
11
11
|
## Configuration
|
12
12
|
|
13
|
-
Add
|
13
|
+
Add artsy_eventservice.rb within config/initializers. `Artsy::EventService` uses [Bunny](http://rubybunny.info/) to connect to RabbitMQ. Here is a sample of configuration:
|
14
14
|
|
15
15
|
```ruby
|
16
16
|
# config/initializers/artsy_eventservice.rb
|
@@ -70,9 +70,9 @@ Few examples:
|
|
70
70
|
- Topic: `conversations`, routing key: `conversation.created`
|
71
71
|
- Topic: `conversations`, routing key: `conversation.dismissed`
|
72
72
|
- Topic: `invoices`, routing key: `invoice.paid`
|
73
|
-
- Topic: `invoices`, routing key: `
|
73
|
+
- Topic: `invoices`, routing key: `merchantaccount.created`
|
74
74
|
|
75
|
-
`BaseEvent` provides `routing_key` method by default which follows the same pattern mention above, you can override `routing_key` when calling `post_event`.
|
75
|
+
`BaseEvent` provides `routing_key` method by default which follows the same pattern mention above, you can override `routing_key` when calling `post_event`. In the default routing key we use `to_s.downcase.gsub('::', '-')` on class name of the `@object` so an instance of `Artsy::UserRequest` with action being `test` will lead to `artsy-userrequest.test`.
|
76
76
|
|
77
77
|
### Update to Version 1.0
|
78
78
|
In previous versions this gem was using Environment variables for configuration. On version 1.0, configuration step is now mandatory and it will no longer read environment variables directly. Make sure to go to configuration step.
|
@@ -3,12 +3,13 @@ require 'json'
|
|
3
3
|
|
4
4
|
module Events
|
5
5
|
class BaseEvent
|
6
|
+
extend Gem::Deprecate
|
6
7
|
attr_reader :verb, :subject, :object, :properties
|
8
|
+
|
7
9
|
def initialize(user: nil, action:, model:)
|
8
10
|
@subject = user
|
9
11
|
@verb = action
|
10
12
|
@object = model
|
11
|
-
@properties = nil
|
12
13
|
end
|
13
14
|
|
14
15
|
def subject
|
@@ -30,13 +31,19 @@ module Events
|
|
30
31
|
end
|
31
32
|
end
|
32
33
|
|
33
|
-
def
|
34
|
+
def to_json
|
34
35
|
JSON.generate(verb: @verb,
|
35
36
|
subject: subject,
|
36
37
|
object: object,
|
37
38
|
properties: properties)
|
38
39
|
end
|
39
40
|
|
41
|
+
def json
|
42
|
+
# Deprecated, switch to to_json
|
43
|
+
to_json
|
44
|
+
end
|
45
|
+
deprecate :json, :to_json, 2019, 12
|
46
|
+
|
40
47
|
def routing_key
|
41
48
|
"#{@object.class.to_s.downcase.gsub('::', '-')}.#{@verb}"
|
42
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artsy-eventservice
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ashkan Nasseri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|