class ESignLive::Client

Constants

VALID_ENVIRONMENTS

Attributes

environment[R]
headers[R]

Public Class Methods

new(api_key:, environment: "sandbox") click to toggle source
# File lib/esignlive/client.rb, line 12
def initialize(api_key:, environment: "sandbox")
  check_environment(environment)
  @headers = create_headers(api_key)
  @environment = environment
end

Public Instance Methods

url() click to toggle source
# File lib/esignlive/client.rb, line 18
def url
  if environment == "sandbox"
    "https://sandbox.esignlive.com/api"
  elsif environment == "production"
    "https://apps.esignlive.com/api"
  else
  end
end

Private Instance Methods

check_environment(env) click to toggle source
# File lib/esignlive/client.rb, line 36
def check_environment(env)
  unless VALID_ENVIRONMENTS.include?(env)
    raise EnvironmentError.new("environment must be set to 'sandbox' or 'production'")
  end
end
create_headers(api_key) click to toggle source
# File lib/esignlive/client.rb, line 29
def create_headers(api_key)
  {
    'Content-Type' => 'application/json',
    'Authorization' => "Basic #{api_key}"
  }
end