pheromone 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8a1139f6f89ed56b3c6403f3ec53e6e484129306
4
- data.tar.gz: 6d57ed3461f221dbb859e909c78843b1996d249a
3
+ metadata.gz: db7a630ce00647c2357d8e4bea2094bd9c286168
4
+ data.tar.gz: 2a7675d608b4da552e27a901ba052509553d3f8d
5
5
  SHA512:
6
- metadata.gz: db3e5e83ddfb4dd2f95ee7502fc958dcad89d38754ff901c8b3894b37503a6021bbeb7e68e1f55dad3fc34279017da71bb34adbc50611e4713bec2c0ed34be32
7
- data.tar.gz: 64cba76f28557a3cdb5672ef29539a5c21650a9cebc42e1edabe7419f13ac554d280946db82de90b6194375f7d38e9357d3c99a74de5a9733c1984d72709abbf
6
+ metadata.gz: 438cd1c71c5244fe4e5f8b1f0340f77ccf6b2b4b3302f201fa41b3bb5d692d11cfd6afcfa199a993a4611c2e3ef9f341edcc98899fcee89db00dd941a25e6eae
7
+ data.tar.gz: 0366406cf8098a29318d93b4571d4f6667fbba169b9f7885a868da030099d46efba1e72d87b0392493649c8f9aaa7bed1c17a76ef1661316d45474aaea630aaa
data/CODE_OF_CONDUCT.md CHANGED
@@ -46,4 +46,4 @@ version 1.3.0, available at
46
46
  [http://contributor-covenant.org/version/1/3/0/][version]
47
47
 
48
48
  [homepage]: http://contributor-covenant.org
49
- [version]: http://contributor-covenant.org/version/1/3/0/
49
+ [version]: http://contributor-covenant.org/version/1/3/0/
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Pheromone
2
2
 
3
- `pheromone` provides a utility function to easily send `ActiveRecord` updates to Kafka.
3
+ Pheromones are chemical substances secreted from glands and used as a means of communication.
4
+
5
+ `pheromone` is a mixin to easily send `ActiveRecord` updates to Kafka whenever there is a model update and/or create.
4
6
 
5
7
  ## Installation
6
8
 
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
1
2
  # validate message options provided to publish method in Publishable concern
2
3
  class OptionsValidator
3
- ACCEPTED_EVENT_TYPES = [:create, :update].freeze
4
+ ACCEPTED_EVENT_TYPES = %i(create update).freeze
4
5
 
5
6
  def initialize(message_options)
6
7
  @errors = {}
@@ -34,13 +35,13 @@ class OptionsValidator
34
35
  event_types = options[:event_types]
35
36
  next true unless event_types
36
37
  event_types.present? &&
37
- event_types.is_a?(Array) &&
38
- (event_types - ACCEPTED_EVENT_TYPES).empty?
38
+ event_types.is_a?(Array) &&
39
+ (event_types - ACCEPTED_EVENT_TYPES).empty?
39
40
  end
40
41
 
41
42
  add_error_message(
42
- :event_types,
43
- "Event types must be a non-empty array with types #{ACCEPTED_EVENT_TYPES.join(',')}"
43
+ :event_types,
44
+ "Event types must be a non-empty array with types #{ACCEPTED_EVENT_TYPES.join(',')}"
44
45
  )
45
46
  end
46
47
 
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Pheromone
2
- VERSION = '0.0.2'
3
+ VERSION = '0.0.3'.freeze
3
4
  end
data/lib/pheromone.rb CHANGED
@@ -23,13 +23,12 @@ require 'active_support'
23
23
  # To control how the model is serialized before being published to kafka
24
24
  # either provide a Serializer via the `serializer` key or a callback or instance
25
25
  # method name via the `message` key
26
-
27
26
  module Pheromone
28
27
  extend ActiveSupport::Concern
29
28
 
30
29
  # class methods for the model including Publishable
31
30
  module ClassMethods
32
- def publish(message_options:)
31
+ def publish(message_options)
33
32
  errors = OptionsValidator.new(message_options).validate
34
33
  raise "Errors: #{errors}" unless errors.empty?
35
34
  __send__(:after_commit, proc { dispatch_messages(message_options: message_options) })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pheromone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ankita Gupta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-16 00:00:00.000000000 Z
11
+ date: 2017-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -135,7 +135,6 @@ files:
135
135
  - bin/setup
136
136
  - lib/pheromone.rb
137
137
  - lib/pheromone/options_validator.rb
138
- - lib/pheromone/setup/waterdrop.rb
139
138
  - lib/pheromone/version.rb
140
139
  homepage: https://github.com/ankitagupta12/pheromone
141
140
  licenses:
@@ -1,7 +0,0 @@
1
- WaterDrop.setup do |config|
2
- config.send_messages = true
3
- config.connection_pool_size = ENV['KAFKA_CONNECTION_POOL_SIZE'] || 20
4
- config.connection_pool_timeout = ENV['KAFKA_CONNECTION_POOL_TIMEOUT'] || 1
5
- config.kafka.hosts = (ENV['KAFKA_HOSTS'] || '').split(',')
6
- config.raise_on_failure = true
7
- end