class Foscam::Model::AlarmConfig

Constants

client

Attributes

http[R]
http_url[R]
input_armed[R]
ioin_level[R]
iolinkage[R]
ioout_level[R]
mail[R]
motion_armed[R]
motion_compensation[R]
motion_sensitivity[R]
msn[R]
preset[R]
schedule[R]
schedule_enable[R]
upload_interval[R]

Public Instance Methods

client=(obj) click to toggle source
# 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
http=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 62
def http=(val)
        http_will_change! unless val == @http
        @http = val
end
http_url=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 67
def http_url=(val)
        http_url_will_change! unless val == @http_url
        @http_url = val
end
input_armed=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 26
def input_armed=(val)
        input_armed_will_change! unless val == @input_armed
        @input_armed = val
end
ioin_level=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 31
def ioin_level=(val)
        ioin_level_will_change! unless val == @ioin_level
        @ioin_level = val
end
iolinkage=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 36
def iolinkage=(val)
        iolinkage_will_change! unless val == @iolinkage
        @iolinkage = val
end
ioout_level=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 46
def ioout_level=(val)
        ioout_level_will_change! unless val == @ioout_level
        @ioout_level = val
end
mail=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 51
def mail=(val)
        mail_will_change! unless val == @mail
        @mail = val
end
motion_armed=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 11
def motion_armed=(val)
        motion_armed_will_change! unless val == @motion_armed
        @motion_armed = val
end
motion_compensation=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 21
def motion_compensation=(val)
        motion_compensation_will_change! unless val == @motion_compensation
        @motion_compensation = val
end
motion_sensitivity=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 16
def motion_sensitivity=(val)
        motion_sensitivity_will_change! unless val == @motion_sensitivity
        @motion_sensitivity = val
end
msn=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 72
def msn=(val)
        msn_will_change! unless val == @msn
        @msn = val
end
preset=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 41
def preset=(val)
        preset_will_change! unless val == @preset
        @preset = val
end
save() click to toggle source
# 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
schedule=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 82
def schedule=(val)
        schedule_will_change! unless val == @schedule
        @schedule = val
end
schedule_enable=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 77
def schedule_enable=(val)
        schedule_enable_will_change! unless val == @schedule_enable
        @schedule_enable = val
end
upload_interval=(val) click to toggle source
# File lib/foscam/model/alarm_config.rb, line 57
def upload_interval=(val)
        upload_interval_will_change! unless val == @upload_interval
        @upload_interval = val
end

Private Instance Methods

dirty_params_hash() click to toggle source
# File lib/foscam/model/alarm_config.rb, line 126
def dirty_params_hash
        h = {}
        h.merge!({:motion_armed             => self.motion_armed }) if motion_armed_changed?
        h.merge!({:motion_sensitivity       => self.motion_sensitivity }) if motion_sensitivity_changed?
        h.merge!({:motion_compensation      => self.motion_compensation }) if motion_compensation_changed?
        h.merge!({:input_armed                      => self.input_armed }) if input_armed_changed?
        h.merge!({:ioin_level                       => self.ioin_level }) if ioin_level_changed?
        h.merge!({:iolinkage                        => self.iolinkage }) if iolinkage_changed?
        h.merge!({:preset                           => self.preset }) if preset_changed?
        h.merge!({:ioout_level                      => self.ioout_level }) if ioout_level_changed?
        h.merge!({:mail                             => self.mail }) if mail_changed?
        h.merge!({:upload_interval          => self.upload_interval }) if upload_interval_changed?
        h.merge!({:http                             => self.http }) if http_changed?
        h.merge!({:msn                                      => self.msn }) if msn_changed?
        # h.merge!({:http_url                       => self.http_url }) if http_url_changed?
        h.merge!({:schedule_enable          => self.schedule_enable }) if schedule_enable_changed?
        # h.merge!({:schedule                       => self.schedule }) if schedule_changed?
        h
end