class OrionWholesale::User

Constants

USER_DIR
USER_FILENAME_PREFIX

Public Class Methods

new(options = {}) click to toggle source
# File lib/orion_wholesale/user.rb, line 7
def initialize(options = {})
  requires!(options, :username, :password, :account_id)
  @options = options
end

Public Instance Methods

authenticated?() click to toggle source
# File lib/orion_wholesale/user.rb, line 12
def authenticated?
  tempfile = get_most_recent_file(USER_FILENAME_PREFIX, USER_DIR)

  File.open(tempfile).each_with_index do |row, i|
    row = row.split("\t")

    return true if row[0].strip.downcase == @options[:account_id].strip.downcase
  end

  false
rescue OrionWholesale::NotAuthenticated
  false
end