Class: Foscam::Model::AlarmConfig

Inherits:
Base
  • Object
show all
Includes:
Singleton
Defined in:
lib/foscam/model/alarm_config.rb

Instance Attribute Summary collapse

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

#httpObject

Returns the value of attribute http.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def http
  @http
end

#http_urlObject

Returns the value of attribute http_url.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def http_url
  @http_url
end

#input_armedObject

Returns the value of attribute input_armed.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def input_armed
  @input_armed
end

#ioin_levelObject

Returns the value of attribute ioin_level.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def ioin_level
  @ioin_level
end

#iolinkageObject

Returns the value of attribute iolinkage.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def iolinkage
  @iolinkage
end

#ioout_levelObject

Returns the value of attribute ioout_level.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def ioout_level
  @ioout_level
end

#mailObject

Returns the value of attribute mail.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def mail
  @mail
end

#motion_armedObject

Returns the value of attribute motion_armed.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def motion_armed
  @motion_armed
end

#motion_compensationObject

Returns the value of attribute motion_compensation.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def motion_compensation
  @motion_compensation
end

#motion_sensitivityObject

Returns the value of attribute motion_sensitivity.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def motion_sensitivity
  @motion_sensitivity
end

#msnObject

Returns the value of attribute msn.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def msn
  @msn
end

#presetObject

Returns the value of attribute preset.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def preset
  @preset
end

#scheduleObject

Returns the value of attribute schedule.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def schedule
  @schedule
end

#schedule_enableObject

Returns the value of attribute schedule_enable.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def schedule_enable
  @schedule_enable
end

#upload_intervalObject

Returns the value of attribute upload_interval.



8
9
10
# File 'lib/foscam/model/alarm_config.rb', line 8

def upload_interval
  @upload_interval
end

Instance Method Details

#client=(obj) ⇒ Object



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/foscam/model/alarm_config.rb', line 87

def client=(obj)
	unless obj.nil?
		AlarmConfig::client = obj
		params = client.get_params
		unless params.empty?
			self.motion_armed = params[:alarm_motion_armed]
			self.motion_sensitivity = params[:alarm_motion_sensitivity]
			self.motion_compensation = params[:alarm_motion_compensation]
			self.input_armed = params[:alarm_input_armed]
			self.ioin_level = params[:alarm_ioin_level]
			self.iolinkage = params[:alarm_iolinkage]
			self.preset = params[:alarm_preset]
			self.ioout_level = params[:alarm_ioout_level]
			self.mail = params[:alarm_mail]
			self.http = params[:alarm_http]
			self.msn = params[:alarm_msn]
			self.http_url = params[:alarm_http_url]	
			self.schedule_enable = params[:alarm_schedule_enable]
			self.schedule = params[:alarm_schedule]	
		end
	end
end

#saveObject



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/foscam/model/alarm_config.rb', line 112

def save
	run_callbacks :save do
		flag = false
		if changed? && is_valid?
			@previously_changed = changes
			flag = client.set_alarm(dirty_params_hash)
			@changed_attributes.clear if flag
		end
		flag
	end
end