Class: Arbor::Peakflow::Client
- Inherits:
-
Object
- Object
- Arbor::Peakflow::Client
- 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
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
Instance Method Summary collapse
-
#initialize(arguments = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Traffic
Methods included from TMS_Ports
Methods included from TMS_Appliance
Methods included from Routers
Methods included from Reports
#configured_reports, #download_report, #queue_report, #report_results
Methods included from Mitigations
Methods included from Managed_Object
Methods included from CP5500
Methods included from 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_key ⇒ Object (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 |
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
40 41 42 |
# File 'lib/arbor_peakflow_ruby/client.rb', line 40 def hosts @hosts end |