arbor_peakflow_ruby 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d0cb86cdce4c6b9e050f079a60dea7fdc9c4fd8
4
- data.tar.gz: d84fdcef51b993c25ceec09187ff1971b75fd065
3
+ metadata.gz: 777fcdda62e6c0512f7cc900e1f8122bb6084157
4
+ data.tar.gz: f36909933df5b85e3dacec4756e5096deca87499
5
5
  SHA512:
6
- metadata.gz: 71d23cb845cb175d2c4b267116cfe20fd6617f498f4402f69a36ba36f0f350cda104529608f5470545e2bf7dbdf9d64137b765d162abd5d7c9fcd8faf0ec63cd
7
- data.tar.gz: ef3a37836b57a5770c8f7454559b3747de6b122fb4f0253cf2a90438ecbca666087f7e42e7b3e6840863adceb7bf6869010ee7e9871a6b402956ced139478874
6
+ metadata.gz: f7a427aaac57877d7cce0c1ad952941d6f613c0a938c99c4d5acfebca52b8f8478fa9f2789843a232c036ccb1bbf3c77045137ac6a6813d9d8ef6781d188c069
7
+ data.tar.gz: 76314ece226a2304594c522968396bf200eb2705d0f6ec4ddc11b8877ecb2b68128a3dfbbdaf3d2b3522c2e7db9aaffdcc1f3259fcc60bc888741b20a853070b
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Gem Version](https://badge.fury.io/rb/arbor_peakflow_ruby.svg)](http://badge.fury.io/rb/arbor_peakflow_ruby) [![Build Status](https://travis-ci.org/kkirsche/arbor_peakflow_ruby.svg?branch=master)](https://travis-ci.org/kkirsche/arbor_peakflow_ruby) [![Dependency Status](https://gemnasium.com/kkirsche/arbor_peakflow_ruby.svg)](https://gemnasium.com/kkirsche/arbor_peakflow_ruby)
1
+ [![Gem Version](https://badge.fury.io/rb/arbor_peakflow_ruby.svg)](http://badge.fury.io/rb/arbor_peakflow_ruby) [![Build Status](https://travis-ci.org/kkirsche/arbor_peakflow_ruby.svg?branch=master)](https://travis-ci.org/kkirsche/arbor_peakflow_ruby) [![Dependency Status](https://gemnasium.com/kkirsche/arbor_peakflow_ruby.svg)](https://gemnasium.com/kkirsche/arbor_peakflow_ruby) [![Code Climate](https://codeclimate.com/github/kkirsche/arbor_peakflow_ruby/badges/gpa.svg)](https://codeclimate.com/github/kkirsche/arbor_peakflow_ruby) [![Test Coverage](https://codeclimate.com/github/kkirsche/arbor_peakflow_ruby/badges/coverage.svg)](https://codeclimate.com/github/kkirsche/arbor_peakflow_ruby)
2
2
 
3
3
 
4
4
  # Arbor Peakflow in Ruby
@@ -13,15 +13,7 @@ module Arbor
13
13
  #
14
14
  # response = client.alerts 'host', 100, 'json'
15
15
  def alerts(filter = nil, limit = nil, format = 'json')
16
- response = @conn.get do |req|
17
- req.url 'arborws/alerts'
18
- req.params['api_key'] = @api_key
19
- req.params['format'] = format
20
- req.params['filter'] = filter unless filter.nil?
21
- req.params['limit'] = limit unless limit.nil?
22
- end
23
-
24
- response
16
+ url_filter_limit_format_request('arborws/alerts', filter, limit, format)
25
17
  end
26
18
  end
27
19
  end
@@ -12,15 +12,8 @@ module Arbor
12
12
  #
13
13
  # response = client.mitigations 'auto-mitigation', 10, 'json'
14
14
  def mitigations(filter = nil, limit = nil, format = 'json')
15
- response = @conn.get do |req|
16
- req.url 'arborws/mitigations/status'
17
- req.params['api_key'] = @api_key
18
- req.params['format'] = format
19
- req.params['filter'] = filter unless filter.nil?
20
- req.params['limit'] = limit unless limit.nil?
21
- end
22
-
23
- response
15
+ url_filter_limit_format_request('arborws/mitigations/status', filter,
16
+ limit, format)
24
17
  end
25
18
  end
26
19
  end
@@ -17,15 +17,8 @@ module Arbor
17
17
  #
18
18
  # response = client.configured_reports
19
19
  def configured_reports(filter = nil, limit = nil, format = 'json')
20
- response = @conn.get do |req|
21
- req.url 'arborws/reports/configured'
22
- req.params['api_key'] = @api_key
23
- req.params['format'] = format
24
- req.params['filter'] = filter unless filter.nil?
25
- req.params['limit'] = limit unless limit.nil?
26
- end
27
-
28
- response
20
+ url_filter_limit_format_request('arborws/reports/configured', filter,
21
+ limit, format)
29
22
  end
30
23
 
31
24
  # Allows you to queue a wizard report to run
@@ -64,15 +57,8 @@ module Arbor
64
57
  #
65
58
  # response = client.report_results
66
59
  def report_results(filter = nil, limit = nil, format = 'json')
67
- response = @conn.get do |req|
68
- req.url 'arborws/reports/results'
69
- req.params['api_key'] = @api_key
70
- req.params['format'] = format
71
- req.params['filter'] = filter unless filter.nil?
72
- req.params['limit'] = limit unless limit.nil?
73
- end
74
-
75
- response
60
+ url_filter_limit_format_request('arborws/reports/results', filter,
61
+ limit, format)
76
62
  end
77
63
 
78
64
  # Allows you to download a completed wizard report.
@@ -37,7 +37,7 @@ module Arbor
37
37
  include Arbor::Peakflow::TMS_Ports
38
38
  include Arbor::Peakflow::Traffic
39
39
 
40
- attr_reader :hosts, :api_key
40
+ attr_reader :hosts, :api_key, :conn
41
41
  def initialize(arguments = {})
42
42
  @hosts = arguments[:hosts] || \
43
43
  arguments[:host] || \
@@ -53,6 +53,18 @@ module Arbor
53
53
  faraday.adapter Faraday.default_adapter
54
54
  end
55
55
  end
56
+
57
+ def url_filter_limit_format_request(url, filter, limit, format)
58
+ response = @conn.get do |req|
59
+ req.url url
60
+ req.params['api_key'] = @api_key
61
+ req.params['format'] = format
62
+ req.params['limit'] = limit unless limit.nil?
63
+ req.params['filter'] = filter unless filter.nil?
64
+ end
65
+
66
+ response
67
+ end
56
68
  end
57
69
  end
58
70
  end
@@ -1,5 +1,5 @@
1
1
  module Arbor
2
2
  module Peakflow
3
- VERSION = '1.0.4'
3
+ VERSION = '1.0.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arbor_peakflow_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Kirsche