Class: KSConnect::API::Plugin::Domain
- Inherits:
-
Object
- Object
- KSConnect::API::Plugin::Domain
- Defined in:
- lib/ksconnect/api/plugin/domain.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#plugin_name ⇒ Object
readonly
Returns the value of attribute plugin_name.
-
#private_data ⇒ Object
readonly
Returns the value of attribute private_data.
Instance Method Summary collapse
- #add_issue(issue_type, data) ⇒ Object
- #clear_issue(issue_type) ⇒ Object
-
#initialize(name, ip_address, plugin_name) ⇒ Domain
constructor
A new instance of Domain.
- #notify(data) ⇒ Object
- #update_ip_address ⇒ Object
Constructor Details
#initialize(name, ip_address, plugin_name) ⇒ Domain
Returns a new instance of Domain.
14 15 16 17 18 19 20 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 14 def initialize(name, ip_address, plugin_name) @name = name @ip_address = ip_address @plugin_name = plugin_name @data = Data.new(plugin_name, name, type: :data) @private_data = Data.new(plugin_name, name, type: :private_data, auto_notify: true) end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
9 10 11 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 9 def data @data end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
8 9 10 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 8 def ip_address @ip_address end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 11 def name @name end |
#plugin_name ⇒ Object (readonly)
Returns the value of attribute plugin_name.
12 13 14 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 12 def plugin_name @plugin_name end |
#private_data ⇒ Object (readonly)
Returns the value of attribute private_data.
10 11 12 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 10 def private_data @private_data end |
Instance Method Details
#add_issue(issue_type, data) ⇒ Object
36 37 38 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 36 def add_issue(issue_type, data) redis.lpush("ks:issues_push", data.merge({ domain_name: @name, plugin_name: @plugin_name, issue_type: issue_type, request_type: 'add' }).to_json) end |
#clear_issue(issue_type) ⇒ Object
40 41 42 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 40 def clear_issue(issue_type) redis.lpush("ks:issues_push", { domain_name: @name, plugin_name: @plugin_name, issue_type: issue_type, request_type: 'remove' }.to_json) end |
#notify(data) ⇒ Object
32 33 34 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 32 def notify(data) redis.lpush("ks:notifications_push", data.merge({ domain_name: @name, plugin_name: @plugin_name }).to_json) end |
#update_ip_address ⇒ Object
22 23 24 |
# File 'lib/ksconnect/api/plugin/domain.rb', line 22 def update_ip_address @ip_address = redis.hget(domains_key, name) end |