Class: Axl::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/axl/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(endpoint: nil, api_version: '10.5', username: nil, password: nil) ⇒ Client

Returns a new instance of Client.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/axl/client.rb', line 12

def initialize(endpoint: nil, api_version: '10.5', username: nil, password: nil)
  wsdl_path = wsdl_path(api_version.to_s)

  if endpoint.class == String && endpoint[-1] != '/'
    # Cisco AXL API doesn't like it if you don't add a trailing slash
    endpoint << '/'
  end

  # Notice how we're disabling SSL verification. This library is meant
  # to be used within a data center. If you are worried about a MITM
  # attack happening while using this library, you have bigger problems
  # to deal with than this library's SSL strategy.
  @client = Savon.client(endpoint:        endpoint,
                         wsdl:            wsdl_path,
                         ssl_verify_mode: :none,
                         basic_auth:      [username, password],
                         namespace:       "http://www.cisco.com/AXL/API/#{api_version}")
end