class Foscam::Model::Network
Constants
- client
Attributes
dns[R]
gateway[R]
ip_address[R]
mask[R]
port[R]
Public Instance Methods
client=(obj)
click to toggle source
# File lib/foscam/model/network.rb, line 37 def client=(obj) unless obj.nil? Network::client = obj params = client.get_params unless params.empty? self.ip_address = params[:ip] self.mask = params[:mask] self.gateway = params[:gateway] self.dns = params[:dns] self.port = params[:port] end end end
dns=(val)
click to toggle source
# File lib/foscam/model/network.rb, line 27 def dns=(val) dns_will_change! unless val == @dns @dns = val end
gateway=(val)
click to toggle source
# File lib/foscam/model/network.rb, line 22 def gateway=(val) gateway_will_change! unless val == @gateway @gateway = val end
ip_address=(val)
click to toggle source
# File lib/foscam/model/network.rb, line 12 def ip_address=(val) ip_address_will_change! unless val == @ip_address @ip_address = val end
mask=(val)
click to toggle source
# File lib/foscam/model/network.rb, line 17 def mask=(val) mask_will_change! unless val == @mask @mask = val end
port=(val)
click to toggle source
# File lib/foscam/model/network.rb, line 32 def port=(val) port_will_change! unless val == @port @port = val end
save()
click to toggle source
# File lib/foscam/model/network.rb, line 53 def save run_callbacks :save do flag = false if changed? && is_valid? @previously_changed = changes flag = client.set_network(dirty_params_hash) @changed_attributes.clear if flag end flag end end
Private Instance Methods
dirty_params_hash()
click to toggle source
# File lib/foscam/model/network.rb, line 67 def dirty_params_hash h = {} h.merge!({:ip => self.ip_address }) if ip_address_changed? h.merge!({:mask => self.mask }) if mask_changed? h.merge!({:gateway => self.gateway }) if gateway_changed? h.merge!({:dns => self.dns }) if dns_changed? h.merge!({:port => self.port }) if port_changed? h end