class Quickets::Config

Attributes

printers[R]

Public Class Methods

new(printers_by_api_key) click to toggle source
# File lib/quickets/config.rb, line 15
def initialize(printers_by_api_key)
  @printers_by_api_key = printers_by_api_key
end

Public Instance Methods

check_api_key!(api_key) click to toggle source
# File lib/quickets/config.rb, line 19
def check_api_key!(api_key)
  return if valid_api_key? api_key
  fail ArgumentError, 'Invalid API key'
end
printers_for(api_key) click to toggle source
# File lib/quickets/config.rb, line 28
def printers_for(api_key)
  @printers_by_api_key.fetch(api_key)
end
valid_api_key?(api_key) click to toggle source
# File lib/quickets/config.rb, line 24
def valid_api_key?(api_key)
  @printers_by_api_key.key? api_key
end