arbor_peakflow_ruby 1.0.1 → 1.0.2

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: ba7234dfa65ecdcb60555845faa036fa0728bf91
4
- data.tar.gz: 4926f76533aedf5598abe57505afc3391d73ee98
3
+ metadata.gz: 9ed1ace38b51d09a0d6d0924f1187250c90f17fe
4
+ data.tar.gz: cd053e621a4bbdf4297c52c4f65ebbe173185ad8
5
5
  SHA512:
6
- metadata.gz: 3dd464a79239adf725ab665b3d3c5a616782caf3f8a0edfa7332a895d1939d41fd0ddad4acac3044cdd4ca1a0fc7a450089ffbc6c27435dfaa43de0593273f9e
7
- data.tar.gz: 6b9f94164918ba6433774530736e10d27f49394753ebc3ca19b7dbfbdb354e99627da59f3b42f808300522d27f59a67b235d55a3863b80d2c76fb3e62d3230c7
6
+ metadata.gz: 53be512ee2b9279978f850453bf8a5dd57f83881616ea2c05b0d41640d7efb9f4b125a5b3b1a94667ab64fb374eaa806ad014df5a723d1a27f6884b212d7c35a
7
+ data.tar.gz: 49f49b6410ca86fadefbe7d34cb885704120a4d7d3af5634161b098ab5d319f2878d7b5b60a46149f4fd75ac2571b3da0055fed6cfdc8190a519d21611003f78
data/Gemfile CHANGED
@@ -5,4 +5,5 @@ gemspec
5
5
  gem 'rake', group: :test, require: nil
6
6
  gem 'minitest', group: :test, require: nil
7
7
  gem 'bundler', group: :test, require: nil
8
+ gem "codeclimate-test-reporter", group: :test, require: nil
8
9
  gem 'faraday'
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
- # == Parameters
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
@@ -1,5 +1,5 @@
1
1
  module Arbor
2
2
  module Peakflow
3
- VERSION = '1.0.1'
3
+ VERSION = '1.0.2'
4
4
  end
5
5
  end
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.1
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-26 00:00:00.000000000 Z
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: