Module: Kloudless
- Defined in:
- lib/kloudless.rb,
lib/kloudless/file.rb,
lib/kloudless/http.rb,
lib/kloudless/link.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, TooManyRequestsError, TooManyServiceRequestsError, UnauthorizedError, UnknownError, UnsupportedMediaTypeError
Constant Summary collapse
- API_VERSION =
"v1".freeze
- API_URL =
"https://api.kloudless.com/#{API_VERSION}".freeze
- VERSION =
"1.0.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
26 27 28 29 30 31 32 33 34 |
# File 'lib/kloudless.rb', line 26 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
37 38 39 |
# File 'lib/kloudless.rb', line 37 def self.http @http || Kloudless::HTTP end |
.http=(client) ⇒ Object
41 42 43 |
# File 'lib/kloudless.rb', line 41 def self.http=(client) @http = client end |
Instance Method Details
#http ⇒ Object
45 46 47 |
# File 'lib/kloudless.rb', line 45 def http self.class.http end |