circonus 3.0.0 → 3.1.0

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.
Files changed (2) hide show
  1. data/lib/circonus.rb +7 -6
  2. metadata +1 -1
data/lib/circonus.rb CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  require 'rubygems'
7
7
  require 'restclient'
8
- require 'cgi'
8
+ require 'uri'
9
9
  require 'pp'
10
10
  require 'yajl'
11
11
 
@@ -50,6 +50,7 @@ class Circonus
50
50
  end
51
51
 
52
52
  def _rest(type,url,headers,data=nil)
53
+ #STDERR.puts "_rest: type=#{type} url=#{url} headers=#{headers.inspect} data=#{data.inspect}"
53
54
  begin
54
55
  resource = RestClient::Resource.new url, :timeout => @options[:timeout], :open_timeout => @options[:open_timeout]
55
56
  case type
@@ -75,7 +76,7 @@ class Circonus
75
76
 
76
77
  def get(method,id)
77
78
  cid = id.to_s.split('/').last
78
- url = @url_prefix + method + '/' + CGI.escape(cid)
79
+ url = @url_prefix + method + '/' + URI.escape(cid)
79
80
  #print "url=#{url}\n"
80
81
  r,err = _rest('get',url, @headers)
81
82
  return nil,err if r.nil?
@@ -84,7 +85,7 @@ class Circonus
84
85
 
85
86
  def delete(method,id)
86
87
  cid = id.to_s.split('/').last
87
- url = @url_prefix + method + '/' + CGI.escape(cid)
88
+ url = @url_prefix + method + '/' + URI.escape(cid)
88
89
  r,err = _rest('delete',url, @headers)
89
90
  return nil,err if r.nil?
90
91
  return Yajl::Parser.parse(r)
@@ -98,7 +99,7 @@ class Circonus
98
99
 
99
100
  def update(method,id,data)
100
101
  cid = id.to_s.split('/').last
101
- r, err = _rest('put',@url_prefix + method + '/' + CGI.escape(cid), @headers, data)
102
+ r, err = _rest('put',@url_prefix + method + '/' + URI.escape(cid), @headers, data)
102
103
  return nil,err if r.nil?
103
104
  return Yajl::Parser.parse(r)
104
105
  end
@@ -106,7 +107,7 @@ class Circonus
106
107
  def list(method,filter=nil)
107
108
  url = @url_prefix + method
108
109
  if (not filter.nil?) and filter.any?
109
- query_string = filter.map { |k,v| "f_#{CGI::escape(k)}=#{CGI::escape(v)}" }.join('&')
110
+ query_string = filter.map { |k,v| "f_#{URI::escape(k)}=#{URI::escape(v)}" }.join('&')
110
111
  url += '?' + query_string
111
112
  end
112
113
  r, err = _rest('get',url,@headers)
@@ -151,7 +152,7 @@ class Circonus
151
152
  params['end'] = Time.now.to_i unless params.has_key? 'end'
152
153
  params['period'] = 300 unless params.has_key? 'period'
153
154
  params['type'] = 'numeric' unless params.has_key? 'type'
154
- url = @url_prefix + 'data' + '/' + CGI.escape(cid.to_s.split('/').last) + '_' + CGI::escape(metric)
155
+ url = @url_prefix + 'data' + '/' + URI.escape(cid.to_s.split('/').last) + '_' + URI::escape(metric)
155
156
  headers = @headers.merge({:params => params})
156
157
  r,err = _rest('get',url, headers)
157
158
  return nil,err if r.nil?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circonus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: