Module: Kloudless
- Defined in:
- lib/kloudless.rb,
lib/kloudless/file.rb,
lib/kloudless/http.rb,
lib/kloudless/link.rb,
lib/kloudless/team.rb,
lib/kloudless/error.rb,
lib/kloudless/event.rb,
lib/kloudless/model.rb,
lib/kloudless/folder.rb,
lib/kloudless/account.rb,
lib/kloudless/version.rb,
lib/kloudless/collection.rb,
lib/kloudless/multipart_upload.rb
Defined Under Namespace
Classes: Account, AuthenticationRequiredError, BadGatewayError, BadRequestError, Collection, Error, Event, File, Folder, FolderNotEmptyError, ForbiddenError, GatewayTimeoutError, HTTP, InsufficientStorageError, InternalErrorError, InvalidParametersError, InvalidParentFolderError, InvalidResourceTypeError, InvalidTokenError, Link, LinkErrorError, MethodNotAllowedError, Model, MultipartUpload, NamingConflictError, NotAcceptableError, NotFoundError, NotImplementedError, PermissionDeniedError, RequestFailedError, ServiceForbiddenError, ServiceNotAvailableError, ServiceUnauthorizedError, Team, TooManyRequestsError, TooManyServiceRequestsError, UnauthorizedError, UnknownError, UnsupportedMediaTypeError
Constant Summary collapse
- API_VERSION =
"v0".freeze
- API_URL =
"https://api.kloudless.com/#{API_VERSION}".freeze
- VERSION =
"0.2.1"
Class Method Summary collapse
-
.authorize(options = {}) ⇒ Object
Public: Authorize with API Key or Bearer Token.
-
.http ⇒ Object
Internal: HTTP client for easier mocking.
- .http=(client) ⇒ Object
Instance Method Summary collapse
Class Method Details
.authorize(options = {}) ⇒ Object
Public: Authorize with API Key or Bearer Token. Returns nothing.
Options:
:api_key
:token
27 28 29 30 31 32 33 34 35 |
# File 'lib/kloudless.rb', line 27 def self.( = {}) Kloudless::HTTP.headers["Authorization"] = if [:api_key] "ApiKey #{[:api_key]}" elsif [:token] "Bearer #{[:token]}" else raise ArgumentError.new(":api_key or :token required") end end |
.http ⇒ Object
Internal: HTTP client for easier mocking
38 39 40 |
# File 'lib/kloudless.rb', line 38 def self.http @http || Kloudless::HTTP end |
.http=(client) ⇒ Object
42 43 44 |
# File 'lib/kloudless.rb', line 42 def self.http=(client) @http = client end |
Instance Method Details
#http ⇒ Object
46 47 48 |
# File 'lib/kloudless.rb', line 46 def http self.class.http end |