Class: Foscam::Model::Base
- Inherits:
-
Object
- Object
- Foscam::Model::Base
- Extended by:
- ActiveModel::Callbacks, ActiveModel::Naming, ActiveModel::Translation
- Includes:
- ActiveModel::Conversion, ActiveModel::Dirty, ActiveModel::Validations
- Defined in:
- lib/foscam/model/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#connect(params) ⇒ Object
Connects to the foscam webcam.
-
#initialize(params = {}) ⇒ Base
constructor
A new instance of Base.
-
#persisted? ⇒ Boolean
:nodoc.
Constructor Details
#initialize(params = {}) ⇒ Base
Returns a new instance of Base.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/foscam/model/base.rb', line 22 def initialize(params ={}) # Check if it is a Hash # get the parameters and set them to the attributes run_callbacks :initialize do params.each do |attr, value| self.public_send("#{attr}=", value) end if params end # Check if it is a Foscam::Client end |
Instance Method Details
#connect(params) ⇒ Object
Connects to the foscam webcam
38 39 40 |
# File 'lib/foscam/model/base.rb', line 38 def connect(params) client = ::Foscam::Client.new(params) if params.has_key?(:url) end |
#persisted? ⇒ Boolean
:nodoc
43 44 45 |
# File 'lib/foscam/model/base.rb', line 43 def persisted? true end |