Module: ResourceSpace
- Defined in:
- lib/resourcespace.rb,
lib/resourcespace/user.rb,
lib/resourcespace/client.rb,
lib/resourcespace/errors.rb,
lib/resourcespace/search.rb,
lib/resourcespace/version.rb,
lib/resourcespace/metadata.rb,
lib/resourcespace/resource.rb,
lib/resourcespace/collection.rb,
lib/resourcespace/configuration.rb
Overview
ResourceSpace Ruby client for interacting with ResourceSpace Digital Asset Management API
Defined Under Namespace
Classes: AuthenticationError, AuthorizationError, Client, ClientError, Collection, Configuration, ConfigurationError, ConflictError, Error, Metadata, NetworkError, NotFoundError, ParseError, QuotaExceededError, RateLimitError, Resource, Search, ServerError, TimeoutError, UploadError, User, ValidationError
Constant Summary collapse
- VERSION =
The current version of the ResourceSpace Ruby gem
"0.1.2"
Class Attribute Summary collapse
-
.configuration ⇒ Configuration
Global configuration for the ResourceSpace gem.
Class Method Summary collapse
-
.config ⇒ Configuration
Get the current configuration or create a new one.
-
.configure {|Configuration| ... } ⇒ Configuration
Configure the ResourceSpace gem globally.
-
.from_response(status_code, message = nil, response_body = nil) ⇒ Error
Method to create appropriate error based on HTTP status code.
-
.reset_config! ⇒ Configuration
Reset the configuration to defaults.
Class Attribute Details
.configuration ⇒ Configuration
Global configuration for the ResourceSpace gem
37 38 39 |
# File 'lib/resourcespace.rb', line 37 def configuration @configuration end |
Class Method Details
.config ⇒ Configuration
Get the current configuration or create a new one
60 61 62 |
# File 'lib/resourcespace.rb', line 60 def config self.configuration ||= Configuration.new end |
.configure {|Configuration| ... } ⇒ Configuration
Configure the ResourceSpace gem globally
51 52 53 54 55 |
# File 'lib/resourcespace.rb', line 51 def configure self.configuration ||= Configuration.new yield(configuration) if block_given? configuration end |
.from_response(status_code, message = nil, response_body = nil) ⇒ Error
Method to create appropriate error based on HTTP status code
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/resourcespace/errors.rb', line 89 def self.from_response(status_code, = nil, response_body = nil) case status_code when 400 ValidationError.new(, status_code: status_code, response_body: response_body) when 401 AuthenticationError.new(, status_code: status_code, response_body: response_body) when 403 AuthorizationError.new(, status_code: status_code, response_body: response_body) when 404 NotFoundError.new(, status_code: status_code, response_body: response_body) when 409 ConflictError.new(, status_code: status_code, response_body: response_body) when 429 RateLimitError.new(, status_code: status_code, response_body: response_body) when 400..499 ClientError.new(, status_code: status_code, response_body: response_body) when 500..599 ServerError.new(, status_code: status_code, response_body: response_body) else Error.new(, status_code: status_code, response_body: response_body) end end |
.reset_config! ⇒ Configuration
Reset the configuration to defaults
67 68 69 |
# File 'lib/resourcespace.rb', line 67 def reset_config! self.configuration = Configuration.new end |