class Switches::Update
Attributes
name[RW]
node_id[RW]
type[RW]
Public Class Methods
build(item, node_id)
click to toggle source
# File lib/switches/update.rb, line 7 def self.build(item, node_id) new.tap do |update| update.type = item.type update.name = item.name update.node_id = node_id end end
load(json)
click to toggle source
# File lib/switches/update.rb, line 15 def self.load(json) attributes = JSONSerializer.deserialize(json) new(attributes) end
new(attributes = {})
click to toggle source
# File lib/switches/update.rb, line 20 def initialize(attributes = {}) @type = attributes["type"] @name = attributes["name"] @node_id = attributes["node_id"] end
Public Instance Methods
as_json()
click to toggle source
# File lib/switches/update.rb, line 30 def as_json { type: type, name: name, node_id: node_id } end
from?(node_id)
click to toggle source
# File lib/switches/update.rb, line 26 def from?(node_id) @node_id == node_id end