Class: Arbor::Peakflow::Client

Inherits:
Object
  • Object
show all
Includes:
Alerts, CP5500, Managed_Object, Mitigations, Reports, Routers, TMS_Appliance, TMS_Ports, Traffic
Defined in:
lib/arbor_peakflow_ruby/client.rb

Overview

Client

The Arbor Peakflow client in charge of using Faraday to communicate with the Arbor devices.

Parameters

  • hosts, host, urls, or url: The location of the Arbor Peakflow

device cluster

  • api_key: The API key to be used when communicating with the Arbor

Peakflow API.

Example

client = Arbor::Peaklfow::Client.new host: 'http://my.arbor.device/'
                                     api_key: 'myApiKeyHere123'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Traffic

#encode_xml_for_url, #traffic

Methods included from TMS_Ports

#tms_ports

Methods included from TMS_Appliance

#tms_appliance

Methods included from Routers

#routers

Methods included from Reports

#configured_reports, #download_report, #queue_report, #report_results

Methods included from Mitigations

#mitigations

Methods included from Managed_Object

#managed_object

Methods included from CP5500

#cp5500

Methods included from Alerts

#alerts

Constructor Details

#initialize(arguments = {}) ⇒ Client

Returns a new instance of Client.



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/arbor_peakflow_ruby/client.rb', line 41

def initialize(arguments = {})
  @hosts = arguments[:hosts] || \
           arguments[:host]  || \
           arguments[:url]   || \
           arguments[:urls]  || \
           ENV.fetch('PEAKFLOW_URL')

  @api_key ||= arguments[:api_key]

  @conn = Faraday.new(@hosts, ssl: { verify: false }) do |faraday|
    faraday.request :url_encoded
    # faraday.response :logger
    faraday.adapter Faraday.default_adapter
  end
end

Instance Attribute Details

#api_keyObject (readonly)

Returns the value of attribute api_key.



40
41
42
# File 'lib/arbor_peakflow_ruby/client.rb', line 40

def api_key
  @api_key
end

#hostsObject (readonly)

Returns the value of attribute hosts.



40
41
42
# File 'lib/arbor_peakflow_ruby/client.rb', line 40

def hosts
  @hosts
end