Class: Foscam::Model::Base

Inherits:
Object
  • Object
show all
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

AlarmConfig, Device, FtpServer, MailServer, Network, User

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Base

Returns a new instance of Base.

Parameters:

  • params (Hash) (defaults to: {})

    Device attributes

Options Hash (params):

  • :resolution (Fixnum)
  • :brightness (Fixnum)
  • :contrast (Fixnum)
  • :orientation (String)


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

Parameters:

  • url (String)

    The address to your camera

  • username (String)

    username to authorize with the camera

  • password (String)

    password to authorize with the camera



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

Returns:

  • (Boolean)


43
44
45
# File 'lib/foscam/model/base.rb', line 43

def persisted?
	true
end