Class: HammerCLI::Apipie::ApiConnection

Inherits:
HammerCLI::AbstractConnector show all
Defined in:
lib/hammer_cli/apipie/api_connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options = {})
  @logger = options[:logger]
  @api = ApipieBindings::API.new(params, HammerCLI::SSLOptions.new.get_options(params[:uri]))
  if options[: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

#apiObject (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

Returns:

  • (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

#resourcesObject



21
22
23
# File 'lib/hammer_cli/apipie/api_connection.rb', line 21

def resources
  @api.resources
end