class StackerBee::Configuration

Constants

ATTRIBUTES

Public Class Methods

new(attrs = nil) click to toggle source
# File lib/stacker_bee/configuration.rb, line 17
def initialize(attrs = nil)
  @attributes = attrs || {}
  validate_attributes
end

Public Instance Methods

api_key() click to toggle source
# File lib/stacker_bee/configuration.rb, line 44
def api_key
  attribute :api_key
end
faraday_middlewares() click to toggle source
# File lib/stacker_bee/configuration.rb, line 52
def faraday_middlewares
  attribute :faraday_middlewares, proc {}
end
logger() click to toggle source
# File lib/stacker_bee/configuration.rb, line 56
def logger
  attribute :logger
end
merge(other) click to toggle source
# File lib/stacker_bee/configuration.rb, line 64
def merge(other)
  self.class.new(to_hash.merge(other.to_hash))
end
middlewares() click to toggle source
# File lib/stacker_bee/configuration.rb, line 48
def middlewares
  attribute :middlewares, proc {}
end
secret_key() click to toggle source
# File lib/stacker_bee/configuration.rb, line 40
def secret_key
  attribute :secret_key
end
ssl_verify?() click to toggle source
# File lib/stacker_bee/configuration.rb, line 32
def ssl_verify?
  attribute :ssl_verify, true
end
to_hash() click to toggle source
# File lib/stacker_bee/configuration.rb, line 60
def to_hash
  @attributes
end
url() click to toggle source
# File lib/stacker_bee/configuration.rb, line 36
def url
  attribute :url
end

Private Instance Methods

attribute(key, value = nil) click to toggle source
# File lib/stacker_bee/configuration.rb, line 70
def attribute(key, value = nil)
  @attributes.fetch(key, value)
end
validate_attributes() click to toggle source
# File lib/stacker_bee/configuration.rb, line 22
def validate_attributes
  unknown_attributes = @attributes.keys - ATTRIBUTES
  return if unknown_attributes.empty?

  attribute_list = unknown_attributes.join(', ')
  message = "No configuration attribute exists: #{attribute_list}"
  fail NoAttributeError, message
end