Class: Foscam::Model::FtpServer
- Includes:
- Singleton
- Defined in:
- lib/foscam/model/ftp_server.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#schedule ⇒ Object
readonly
Returns the value of attribute schedule.
-
#upload_interval ⇒ Object
Returns the value of attribute upload_interval.
-
#username ⇒ Object
Returns the value of attribute username.
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
#address ⇒ Object
Returns the value of attribute address.
22 23 24 |
# File 'lib/foscam/model/ftp_server.rb', line 22 def address @address end |
#dir ⇒ Object
Returns the value of attribute dir.
22 23 24 |
# File 'lib/foscam/model/ftp_server.rb', line 22 def dir @dir end |
#password ⇒ Object
Returns the value of attribute password.
22 23 24 |
# File 'lib/foscam/model/ftp_server.rb', line 22 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
22 23 24 |
# File 'lib/foscam/model/ftp_server.rb', line 22 def port @port end |
#schedule ⇒ Object (readonly)
Returns the value of attribute schedule.
22 23 24 |
# File 'lib/foscam/model/ftp_server.rb', line 22 def schedule @schedule end |
#upload_interval ⇒ Object
Returns the value of attribute upload_interval.
22 23 24 |
# File 'lib/foscam/model/ftp_server.rb', line 22 def upload_interval @upload_interval end |
#username ⇒ Object
Returns the value of attribute username.
22 23 24 |
# File 'lib/foscam/model/ftp_server.rb', line 22 def username @username end |
Instance Method Details
#clear ⇒ Object
85 86 87 88 89 90 91 92 93 |
# File 'lib/foscam/model/ftp_server.rb', line 85 def clear run_callbacks :clear do flag = false params = {:dir => "", :user => "", :pwd => "", :svr => "", :port => 21, :upload_interval => 0} flag = client.set_ftp(params) @changed_attributes.clear if flag flag end end |
#client=(obj) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/foscam/model/ftp_server.rb', line 56 def client=(obj) unless obj.nil? FtpServer::client = obj params = client.get_params unless params.empty? self.dir = params[:ftp_dir] self.address = params[:ftp_svr] self.port = params[:ftp_port] self.username = params[:ftp_user] self.password = params[:ftp_pwd] self.upload_interval = params[:ftp_upload_interval] end end end |
#save ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/foscam/model/ftp_server.rb', line 73 def save run_callbacks :save do flag = false if changed? && is_valid? @previously_changed = changes flag = client.set_ftp(dirty_params_hash) @changed_attributes.clear if flag end flag end end |