module Kloudless

Constants

API_URL
API_VERSION
VERSION

Public Class Methods

authorize(options = {}) click to toggle source

Public: Authorize with API Key or Bearer Token. Returns nothing.

Options:

:api_key
:token

developers.kloudless.com/docs#authorization

# File lib/kloudless.rb, line 26
def self.authorize(options = {})
  Kloudless::HTTP.headers["Authorization"] = if options[:api_key]
    "ApiKey #{options[:api_key]}"
  elsif options[:token]
    "Bearer #{options[:token]}"
  else
    raise ArgumentError.new(":api_key or :token required")
  end
end
http() click to toggle source

Internal: HTTP client for easier mocking

# File lib/kloudless.rb, line 37
def self.http
  @http || Kloudless::HTTP
end
http=(client) click to toggle source
# File lib/kloudless.rb, line 41
def self.http=(client)
  @http = client
end

Public Instance Methods

http() click to toggle source
# File lib/kloudless.rb, line 45
def http
  self.class.http
end