class Hyperb::AuthObject
helper for managing auth objects used to authenticate into third party docker registries
Attributes
email[RW]
password[RW]
serveraddress[RW]
username[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/hyperb/auth_object.rb, line 9 def initialize(options = {}) @username = options[:username] || '' @email = options[:email] || '' @serveraddress = options[:serveraddress] || '' @password = options[:password].is_a?(File) ? options[:password].read : options[:password] end
Public Instance Methods
attrs()
click to toggle source
preserve this order
# File lib/hyperb/auth_object.rb, line 17 def attrs { username: username, password: password, email: email, serveraddress: serveraddress } end
blank?(val)
click to toggle source
# File lib/hyperb/auth_object.rb, line 30 def blank?(val) val.respond_to?(:empty?) ? val.empty? : !val end
build()
click to toggle source
# File lib/hyperb/auth_object.rb, line 38 def build { x_registry_auth: encode } end
encode()
click to toggle source
# File lib/hyperb/auth_object.rb, line 34 def encode Base64.urlsafe_encode64(attrs.to_json) end
valid?()
click to toggle source
# File lib/hyperb/auth_object.rb, line 26 def valid? attrs.values.none? { |atr| blank?(atr) } end