webhooker 0.2.0 → 0.3.0

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: a277008a0b540d629182febcdcc8d6d22d8f08ca
4
- data.tar.gz: 38f244063164b4d5b2041a3ad51be361c09ac287
3
+ metadata.gz: 78ba86fc526281269f9afa07508d97a3cd67b5fb
4
+ data.tar.gz: 289ad1848cf4f469ea3f74534f07647838628ddb
5
5
  SHA512:
6
- metadata.gz: 392686f1fcbd17746d3efb0587c7bb6ef5f30a5b43ec909f67d3487c9b9d277c26ba27bd5183a1d229fa202aa570d063aa248a09d161523f171d513581d12c42
7
- data.tar.gz: 393148dac4ebcac9bad54c517f68f3447064a06ad5c6dd49e06a1af446316220a18d602a8a0eaf90986cf3dd16a3ecfb35d2ccfa34305496fb58c6e1364910bb
6
+ metadata.gz: 6b06edbcaa0334a657127059b420229610ac66f0e98ae095ccccddce6a447fb05e4c5529fcfce65a14aae757b60f141dd7fc6a30877bccb541a393fbadefe896
7
+ data.tar.gz: a872f9c2eaa92d53b826cedb8637b8ecf992bf182cc4e8cf4555dc42e9ab47375d3684d6788b09f69e7cedc48790521293d1942026e6d9f4fc673a2867287a68
@@ -2,9 +2,10 @@ require 'active_support/configurable'
2
2
 
3
3
  module Webhooker
4
4
  include ActiveSupport::Configurable
5
- config_accessor :payload_key
5
+ config_accessor :payload_key, :attributes_method
6
6
 
7
7
  configure do |c|
8
8
  c.payload_key = 'payload'
9
+ c.attributes_method = :as_json
9
10
  end
10
11
  end
@@ -29,7 +29,7 @@ module Webhooker
29
29
  data = {
30
30
  resource: model_name.singular,
31
31
  action: action.to_s,
32
- attributes: attributes.as_json,
32
+ attributes: send(*self.class.webhook_attributes_method).as_json,
33
33
  }.merge(data)
34
34
  Subscriber.find_each do |subscriber|
35
35
  TriggerJob.perform_later subscriber, data
@@ -37,7 +37,7 @@ module Webhooker
37
37
  end
38
38
 
39
39
  module ClassMethods
40
- attr_accessor :webhook_attributes
40
+ attr_accessor :webhook_attributes, :webhook_attributes_method
41
41
 
42
42
  def webhooks *args
43
43
  options = args.extract_options!
@@ -45,6 +45,7 @@ module Webhooker
45
45
  send :"after_#{action}", :"_trigger_webhook_on_#{action}"
46
46
  end
47
47
  @webhook_attributes = options[:attributes].try(:map, &:to_s)
48
+ @webhook_attributes_method = options[:attributes_method] || Webhooker.config.attributes_method
48
49
  end
49
50
  end
50
51
  end
@@ -1,3 +1,3 @@
1
1
  module Webhooker
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webhooker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kayhide
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-21 00:00:00.000000000 Z
11
+ date: 2015-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails