class DK::ConfigAdapter

Public Class Methods

new(data, file = nil) click to toggle source
Calls superclass method DK::Adapter::new
# File lib/draftking/config.rb, line 16
def initialize(data, file = nil)
  super(data)
  @file = file
end

Public Instance Methods

adapt() click to toggle source
# File lib/draftking/config.rb, line 21
def adapt
  if @data.keys.include?('consumer_key')
    r = OpenStruct.new
    r.user_commands = []
    r.api_keys = @data
    puts "Config #{@file} needs to be updated!"
    print 'Enter a name for this configuration: '
    r.config_name = DK::Config.get_input
    Config.save_file(config: r, filename: @file)
  end
  r || @data
end