class VantivSFTPReports::Config

Public Class Methods

new(**opts) click to toggle source
# 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
with_obj(config) click to toggle source
# File lib/vantiv_sftp_reports/config.rb, line 5
def self.with_obj(config)
  config.is_a?(self) ? config : new(config)
end

Public Instance Methods

opts() click to toggle source
# File lib/vantiv_sftp_reports/config.rb, line 15
def opts
  @opts.dup
end
sftp_opts() click to toggle source
# File lib/vantiv_sftp_reports/config.rb, line 19
def sftp_opts
  @sftp_opts.dup
end
with(**opts) click to toggle source
# File lib/vantiv_sftp_reports/config.rb, line 23
def with(**opts)
  self.class.new(@opts.merge(opts))
end

Private Instance Methods

defaults!() click to toggle source
# File lib/vantiv_sftp_reports/config.rb, line 39
def defaults!
  @opts[:host] ||= 'reports.iq.vantivcnp.com'
  @opts[:path] ||= 'reports'
  @opts[:port] ||= '22'
end