Class: HammerCLI::Apipie::ApiConnection
- Inherits:
-
HammerCLI::AbstractConnector
- Object
- HammerCLI::AbstractConnector
- HammerCLI::Apipie::ApiConnection
- Defined in:
- lib/hammer_cli/apipie/api_connection.rb
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
Instance Method Summary collapse
- #has_resource?(resource_name) ⇒ Boolean
-
#initialize(params, options = {}) ⇒ ApiConnection
constructor
A new instance of ApiConnection.
- #resource(resource_name) ⇒ Object
- #resources ⇒ Object
Constructor Details
#initialize(params, options = {}) ⇒ ApiConnection
Returns a new instance of ApiConnection.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/hammer_cli/apipie/api_connection.rb', line 8 def initialize(params, = {}) @logger = [:logger] @api = ApipieBindings::API.new(params, HammerCLI::SSLOptions.new.(params[:uri])) if [:reload_cache] @api.clean_cache HammerCLI.clear_cache unless @logger.nil? @logger.debug 'Apipie cache was cleared' @logger.debug 'Completion cache was cleared' end end end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
6 7 8 |
# File 'lib/hammer_cli/apipie/api_connection.rb', line 6 def api @api end |
Instance Method Details
#has_resource?(resource_name) ⇒ Boolean
29 30 31 |
# File 'lib/hammer_cli/apipie/api_connection.rb', line 29 def has_resource?(resource_name) @api.has_resource?(resource_name) end |
#resource(resource_name) ⇒ Object
25 26 27 |
# File 'lib/hammer_cli/apipie/api_connection.rb', line 25 def resource(resource_name) @api.resource(resource_name) end |
#resources ⇒ Object
21 22 23 |
# File 'lib/hammer_cli/apipie/api_connection.rb', line 21 def resources @api.resources end |