Sha256: e4c6c249a52322f0a4eb422d48b92a7a39f0dfc47ea8f7a623f0ecc538a5833a
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
require_relative "kloudless/collection" require_relative "kloudless/error" require_relative "kloudless/http" require_relative "kloudless/model" require_relative "kloudless/account" require_relative "kloudless/file" require_relative "kloudless/multipart_upload" require_relative "kloudless/folder" require_relative "kloudless/link" require_relative "kloudless/event" require_relative "kloudless/version" require "json" require "uri" module Kloudless API_VERSION = "v1".freeze API_URL = "https://api.kloudless.com/#{API_VERSION}".freeze # Public: Authorize with API Key or Bearer Token. Returns nothing. # # Options: # :api_key # :token # # https://developers.kloudless.com/docs#authorization 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 # Internal: HTTP client for easier mocking def self.http @http || Kloudless::HTTP end def self.http=(client) @http = client end def http self.class.http end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kloudless-1.0.1 | lib/kloudless.rb |
kloudless-1.0.0 | lib/kloudless.rb |