class PrintNode::Auth

Handles which credentials we are using @author Jake Torrance @author PrintNode

Public Class Methods

new(value_a, value_b = nil) click to toggle source

Initalizes our credentials

@param value_a [String] two arguments : this will be an email address. With one, it is an API-Key. @param value_b [String] The password relative to the email set in value_a.

# File lib/printnode/auth.rb, line 11
def initialize(value_a, value_b = nil)
  if value_b
    @email = value_a
    @password = value_b
  else
    @apikey = value_a
  end
end

Public Instance Methods

credentials() click to toggle source

Returns correctly formatted credentials for HTTP::Request.basic_auth

Returns:

An array of with our credentials.

# File lib/printnode/auth.rb, line 23
def credentials
  @apikey ? [@apikey, ''] : [@email, @password]
end