Module: Infreemation
- Defined in:
- lib/infreemation.rb,
lib/infreemation/api.rb,
lib/infreemation/errors.rb,
lib/infreemation/request.rb,
lib/infreemation/version.rb
Overview
This module is the main entry point of the Gem
Defined Under Namespace
Modules: Errors Classes: API, Request
Constant Summary collapse
- ConfigurationError =
Class.new(StandardError)
- Exception =
A base error
Class.new(StandardError)
- GenericError =
A generic error
Class.new(RuntimeError)
- AuthenticationError =
An API authentication error
Class.new(RuntimeError)
- RequestError =
A request error
Class.new(RuntimeError)
- ResponseError =
A response error
Class.new(RuntimeError)
- MissingParameterError =
A missing parameter error
Class.new(RuntimeError)
- InvalidParameterError =
An invalid parameter error
Class.new(RuntimeError)
- MissingOrInvalidParameterError =
A missing or invalid parameter error
Class.new(RuntimeError)
- ERROR_MAPPINGS =
{ 2 => AuthenticationError, # key or username invalid 3 => MissingOrInvalidParameterError, # start date 4 => InvalidParameterError, # FOI type 5 => MissingParameterError, # requester 6 => MissingParameterError, # contact 7 => MissingParameterError, # contacttype 8 => MissingParameterError, # body 9 => MissingParameterError, # rt 10 => AuthenticationError, # key missing 11 => AuthenticationError, # username missing 12 => RequestError # no data }.freeze
- VERSION =
'0.2.4'
Class Attribute Summary collapse
- .api_key ⇒ Object
-
.logger ⇒ Object
Returns the value of attribute logger.
- .url ⇒ Object
- .username ⇒ Object
Class Method Summary collapse
Class Attribute Details
.api_key ⇒ Object
25 26 27 28 29 |
# File 'lib/infreemation.rb', line 25 def api_key @api_key || raise( ConfigurationError, 'Infreemation.api_key not configured' ) end |
.logger ⇒ Object
Returns the value of attribute logger.
16 17 18 |
# File 'lib/infreemation.rb', line 16 def logger @logger end |
.url ⇒ Object
19 20 21 22 23 |
# File 'lib/infreemation.rb', line 19 def url @url || raise( ConfigurationError, 'Infreemation.url not configured' ) end |
.username ⇒ Object
31 32 33 34 35 |
# File 'lib/infreemation.rb', line 31 def username @username || raise( ConfigurationError, 'Infreemation.username not configured' ) end |
Class Method Details
.log(level, message) ⇒ Object
37 38 39 |
# File 'lib/infreemation.rb', line 37 def log(level, ) logger&.send(level, name) { } end |