arbor_peakflow_ruby 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +3 -0
- data/lib/arbor_peakflow_ruby/actions/traffic.rb +19 -2
- data/lib/arbor_peakflow_ruby/client.rb +1 -1
- data/lib/arbor_peakflow_ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9ed1ace38b51d09a0d6d0924f1187250c90f17fe
|
4
|
+
data.tar.gz: cd053e621a4bbdf4297c52c4f65ebbe173185ad8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53be512ee2b9279978f850453bf8a5dd57f83881616ea2c05b0d41640d7efb9f4b125a5b3b1a94667ab64fb374eaa806ad014df5a723d1a27f6884b212d7c35a
|
7
|
+
data.tar.gz: 49f49b6410ca86fadefbe7d34cb885704120a4d7d3af5634161b098ab5d319f2878d7b5b60a46149f4fd75ac2571b3da0055fed6cfdc8190a519d21611003f78
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,3 +1,6 @@
|
|
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)
|
2
|
+
|
3
|
+
|
1
4
|
# Arbor Peakflow in Ruby
|
2
5
|
|
3
6
|
Welcome to Arbor Peakflow! In this library you will find the tools you need as a user and as a developer to interact with the Arbor Networks Peakflow Web Services API 6.0. Hope you enjoy!
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module Arbor
|
2
2
|
module Peakflow
|
3
|
+
# The Traffic module is for getting traffic data.
|
3
4
|
module Traffic
|
4
5
|
# The traffic function allows you to search for and retrieve XML traffic
|
5
6
|
# data.
|
@@ -15,16 +16,32 @@ module Arbor
|
|
15
16
|
# want Peakflow SP to return a binary PNG graph file of the queried
|
16
17
|
# traffic data. If you do not specify a graph argument, then Peakflow SP
|
17
18
|
# returns XML.
|
19
|
+
#
|
20
|
+
# ==== Example
|
21
|
+
#
|
22
|
+
# query = File.read('path/to/file.xml')
|
23
|
+
# client.traffic query
|
18
24
|
def traffic(query, graph = nil)
|
19
25
|
response = @conn.get do |req|
|
20
26
|
req.url 'arborws/traffic'
|
21
27
|
req.params['api_key'] = @api_key
|
22
|
-
req.params['query'] = query
|
23
|
-
req.params['graph'] = graph unless graph.nil?
|
28
|
+
req.params['query'] = encode_xml_for_url(query)
|
29
|
+
req.params['graph'] = encode_xml_for_url(graph) unless graph.nil?
|
24
30
|
end
|
25
31
|
|
26
32
|
response
|
27
33
|
end
|
34
|
+
|
35
|
+
def encode_xml_for_url(file_contents)
|
36
|
+
encoded_file =
|
37
|
+
URI.encode(
|
38
|
+
file_contents
|
39
|
+
.gsub!(/\n+/, '')
|
40
|
+
.gsub!(/(\s+)(?![^<])/, '')
|
41
|
+
).gsub!(/\?/, '%3F')
|
42
|
+
|
43
|
+
encoded_file
|
44
|
+
end
|
28
45
|
end
|
29
46
|
end
|
30
47
|
end
|
@@ -16,7 +16,7 @@ module Arbor
|
|
16
16
|
# The Arbor Peakflow client in charge of using Faraday to communicate with
|
17
17
|
# the Arbor devices.
|
18
18
|
#
|
19
|
-
#
|
19
|
+
# == Parameters
|
20
20
|
# - hosts, host, urls, or url: The location of the Arbor Peakflow
|
21
21
|
# device cluster
|
22
22
|
# - api_key: The API key to be used when communicating with the Arbor
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arbor_peakflow_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Kirsche
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Provides access to the Arbor Peakflow SP 6.0 HTTPS API
|
14
14
|
email:
|