Module: AlmaApi
- Defined in:
- lib/alma_api.rb,
lib/alma_api/client.rb,
lib/alma_api/version.rb,
lib/alma_api/configuration.rb
Defined Under Namespace
Classes: Client, Configuration, Error, GatewayError, LogicalError, ServerError
Constant Summary
collapse
- DEFAULT_ERROR_CODE =
"UNKNOWN".freeze
- DEFAULT_ERROR_MESSAGE =
"Unknown cause".freeze
- GENERAL_ERROR_MESSAGE =
"Error occured while performing request. Check #cause for more details.".freeze
- GATEWAY_ERROR_CODES =
[
"GENERAL_ERROR",
"UNAUTHORIZED",
"INVALID_REQUEST",
"PER_SECOND_THRESHOLD",
"DAILY_THRESHOLD",
"REQUEST_TOO_LARGE",
"FORBIDDEN",
"ROUTING_ERROR"
].freeze
- VERSION =
"2.0.1".freeze
Class Method Summary
collapse
Class Method Details
43
44
45
46
47
48
|
# File 'lib/alma_api.rb', line 43
def configure
warn "[DEPRECATION] `AlmaApi.configure` is deprecated. Please use `AlmaApi::Client.configure` instead."
client = Client.configure
yield(client.configuration) if block_given?
client
end
|
50
51
52
53
54
55
56
57
|
# File 'lib/alma_api.rb', line 50
def validate_format!(format)
case format = format.presence&.to_s
when "json", "xml" then format
when nil then nil
else
raise ArgumentError, "Unsupported format '#{format}'. Only 'json' and 'xml' is supported."
end
end
|