Class: VantivSFTPReports::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vantiv_sftp_reports/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**opts) ⇒ Config

Returns a new instance of Config.



9
10
11
12
13
# File 'lib/vantiv_sftp_reports/config.rb', line 9

def initialize(**opts)
  @opts = opts.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
  @sftp_opts = opts.reject { |k, _| %i[host organization_id path username].include?(k) }
  defaults!
end

Class Method Details

.with_obj(config) ⇒ Object



5
6
7
# File 'lib/vantiv_sftp_reports/config.rb', line 5

def self.with_obj(config)
  config.is_a?(self) ? config : new(config)
end

Instance Method Details

#optsObject



15
16
17
# File 'lib/vantiv_sftp_reports/config.rb', line 15

def opts
  @opts.dup
end

#sftp_optsObject



19
20
21
# File 'lib/vantiv_sftp_reports/config.rb', line 19

def sftp_opts
  @sftp_opts.dup
end

#with(**opts) ⇒ Object



23
24
25
# File 'lib/vantiv_sftp_reports/config.rb', line 23

def with(**opts)
  self.class.new(@opts.merge(opts))
end