ksconnect 0.1.9 → 0.1.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c98509e5053c6fdaa63c5f98360954b13423b38
4
- data.tar.gz: 267ccd52e07a1637cfd99cd07fcfaac628b2306d
3
+ metadata.gz: 4cc814531c1dd2c2a488e54a8172bd508c067f7c
4
+ data.tar.gz: fb3ff0f6cac35f8149a818a8d3497abc9fa6da1d
5
5
  SHA512:
6
- metadata.gz: 28326bc46292483e69f1a3d180f7ce344aacf23235fb449de75fab3a513217aecec1579b44b74d88c3b4670d42747611e606e6c8a49c139f4f8d68a8ca36c340
7
- data.tar.gz: 2c328348be2e8e81899dbd71d76dd28dfb4e7cdacdf75d4da6304c7da857fc5b62a82597a9a019bce4fa8647cb04c7615f5ff7ff473d6e9551b8ea738ee4663a
6
+ metadata.gz: b3143f91d387077c1eefaed1392bcdb91c22e4e262bf3edfd9a120e649e54a15acd6fc3f241be38f5bbc6697b7fd56169e00d01745786d3c1848456babf7caf6
7
+ data.tar.gz: 89389a90decdb74afdd732472e4751fff2a3957efa38d6957107b80f92fac84e65216d1f3f5856d74c4a12a3e1bd0629324ad27de56dfd5ddbe33d2af5f4a41b
@@ -9,11 +9,13 @@ class KSConnect
9
9
  include Logs
10
10
  attr_reader :type
11
11
 
12
- def initialize(plugin_name, domain_name, type = :data, use_cache = true)
12
+ def initialize(plugin_name, domain_name, opts={})
13
13
  @plugin_name = plugin_name
14
14
  @domain_name = domain_name
15
- @type = type
16
- @use_cache = use_cache
15
+
16
+ @type = opts[:type] || "data"
17
+ @use_cache = opts[:use_cache] || true
18
+ @auto_notify = opts[:auto_notify] || false
17
19
 
18
20
  @cache = ActiveSupport::HashWithIndifferentAccess.new if @use_cache
19
21
  @cache_uuid = nil
@@ -22,13 +24,13 @@ class KSConnect
22
24
  def []=(field, value)
23
25
  @cache[field] = value if @use_cache
24
26
  redis.hset(key, field, value)
25
- redis.publish("core:push", { plugin_name: @plugin_name, domain_name: @domain_name, request_type: 'update' }.to_json)
27
+ redis.publish("core:push", { plugin_name: @plugin_name, domain_name: @domain_name, request_type: 'update' }.to_json) if @auto_notify
26
28
  end
27
29
 
28
30
  def setall(hash)
29
31
  @cache = @cache.merge(hash) if @use_cache
30
32
  redis.mapped_hmset(key, hash)
31
- redis.publish("core:push", { plugin_name: @plugin_name, domain_name: @domain_name, request_type: 'update' }.to_json)
33
+ redis.publish("core:push", { plugin_name: @plugin_name, domain_name: @domain_name, request_type: 'update' }.to_json) if @auto_notify
32
34
  end
33
35
 
34
36
  def [](field)
@@ -87,4 +89,4 @@ class KSConnect
87
89
  end
88
90
  end
89
91
  end
90
- end
92
+ end
@@ -15,8 +15,8 @@ class KSConnect
15
15
  @name = name
16
16
  @ip_address = ip_address
17
17
  @plugin_name = plugin_name
18
- @data = Data.new(plugin_name, name, :data)
19
- @private_data = Data.new(plugin_name, name, :private_data)
18
+ @data = Data.new(plugin_name, name, type: :data)
19
+ @private_data = Data.new(plugin_name, name, type: :private_data, auto_notify: true)
20
20
  end
21
21
 
22
22
  def update_ip_address
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ksconnect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Poon
@@ -109,4 +109,3 @@ signing_key:
109
109
  specification_version: 4
110
110
  summary: Connection API for Kloudsec
111
111
  test_files: []
112
- has_rdoc: