Class: Foscam::Model::Network
- Includes:
- Singleton
- Defined in:
- lib/foscam/model/network.rb
Instance Attribute Summary collapse
-
#dns ⇒ Object
Returns the value of attribute dns.
-
#gateway ⇒ Object
Returns the value of attribute gateway.
-
#ip_address ⇒ Object
Returns the value of attribute ip_address.
-
#mask ⇒ Object
Returns the value of attribute mask.
-
#port ⇒ Object
Returns the value of attribute port.
Instance Method Summary collapse
Methods inherited from Base
#connect, #initialize, #persisted?
Constructor Details
This class inherits a constructor from Foscam::Model::Base
Instance Attribute Details
#dns ⇒ Object
Returns the value of attribute dns.
7 8 9 |
# File 'lib/foscam/model/network.rb', line 7 def dns @dns end |
#gateway ⇒ Object
Returns the value of attribute gateway.
7 8 9 |
# File 'lib/foscam/model/network.rb', line 7 def gateway @gateway end |
#ip_address ⇒ Object
Returns the value of attribute ip_address.
7 8 9 |
# File 'lib/foscam/model/network.rb', line 7 def ip_address @ip_address end |
#mask ⇒ Object
Returns the value of attribute mask.
7 8 9 |
# File 'lib/foscam/model/network.rb', line 7 def mask @mask end |
#port ⇒ Object
Returns the value of attribute port.
7 8 9 |
# File 'lib/foscam/model/network.rb', line 7 def port @port end |
Instance Method Details
#client=(obj) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# 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 |
#save ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 |
# 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 |