Class: BeamUp::Providers::SFTP::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/beam_up/providers/sftp.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host.



9
10
11
# File 'lib/beam_up/providers/sftp.rb', line 9

def host
  @host
end

#keyObject

Returns the value of attribute key.



9
10
11
# File 'lib/beam_up/providers/sftp.rb', line 9

def key
  @key
end

#passwordObject

Returns the value of attribute password.



9
10
11
# File 'lib/beam_up/providers/sftp.rb', line 9

def password
  @password
end

#portObject

Returns the value of attribute port.



9
10
11
# File 'lib/beam_up/providers/sftp.rb', line 9

def port
  @port
end

#remote_pathObject

Returns the value of attribute remote_path.



9
10
11
# File 'lib/beam_up/providers/sftp.rb', line 9

def remote_path
  @remote_path
end

#usernameObject

Returns the value of attribute username.



9
10
11
# File 'lib/beam_up/providers/sftp.rb', line 9

def username
  @username
end

Class Method Details

.config_keysObject



7
# File 'lib/beam_up/providers/sftp.rb', line 7

def self.config_keys = %w[host port username password key remote_path]

Instance Method Details

#validate!Object

Raises:



21
22
23
24
25
26
# File 'lib/beam_up/providers/sftp.rb', line 21

def validate!
  raise ConfigurationError, "Host must be set" unless host
  raise ConfigurationError, "Username must be set" unless username
  raise ConfigurationError, "Remote path must be set" unless remote_path
  raise ConfigurationError, "Password or key must be set" unless password || key
end

#with(options) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/beam_up/providers/sftp.rb', line 11

def with(options)
  self.host = options[:host]
  self.port = options[:port] || 22
  self.username = options[:username]
  self.password = options[:password]
  self.key = options[:key]
  self.remote_path = options[:remote_path]
  self
end