stathat 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/stathat.rb +16 -1
  3. data/stathat.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eff336712e223db2cd53060be30eb5ba11d85404
4
- data.tar.gz: 2768fc730354c4c61301b2800b0f53bbd05ce95c
3
+ metadata.gz: 7ee87bf200f2253b10ecb7b18347f3568de64a04
4
+ data.tar.gz: 9595cbb662a0c688efa180ebeb460a42d0fea6cd
5
5
  SHA512:
6
- metadata.gz: afc6a337f7578d470b6936ca93a5407e2fd3c6aec6e7806e674063c89398495c1a9f8441234c7f021595183839e0892574e3113bcd80cb91ea3ef17f28d37548
7
- data.tar.gz: cc7e758657da5fbde268a932fd7859733ff7ab33d8c8f00cde98ebe7ba785a8577c91bf747f0ce65c2f990d94e0c5aff6c5ac9f927867ff497460e6b5166e14f
6
+ metadata.gz: 4b13434236e9ea8f3e3dc8d1697311ab8c0bbfb8f3f6a46d8a3869c73d2eb015b9764e538ccf6d6738b37b4a31c1231b3aae2330a1b16e1912411ab09c7b9b07
7
+ data.tar.gz: baea8c7cb43c524395f389dd7e68abcfb090c1d653a6285dd032d4ad6ec907db71ec457d68f113c0a5f61f5834029b159cec95159581ad65351cb3a222e42ab9
@@ -1,4 +1,5 @@
1
1
  require 'net/http'
2
+ require 'cgi'
2
3
  require 'uri'
3
4
  require 'json'
4
5
  require 'thread'
@@ -11,9 +12,23 @@ module StatHat
11
12
  EZ_URL = "http://api.stathat.com/ez"
12
13
 
13
14
  class << self
15
+ # def send_to_stathat(url, args)
16
+ # uri = URI.parse(url)
17
+ # uri.query = URI.encode_www_form(args)
18
+ # resp = Net::HTTP.get(uri)
19
+ # return Response.new(resp)
20
+ # end
21
+
14
22
  def send_to_stathat(url, args)
15
23
  uri = URI.parse(url)
16
- uri.query = URI.encode_www_form(args)
24
+
25
+ begin
26
+ uri.query = URI.encode_www_form(args)
27
+ rescue NoMethodError => e
28
+ # backwards compatability for pre 1.9.x
29
+ uri.query = args.map { |arg, val| arg.to_s + "=" + CGI::escape(val.to_s) }.join('&')
30
+ end
31
+
17
32
  resp = Net::HTTP.get(uri)
18
33
  return Response.new(resp)
19
34
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{stathat}
5
- s.version = "0.1.6"
5
+ s.version = "0.1.7"
6
6
  s.authors = ["StatHat"]
7
7
  s.description = %q{Easily post stats to your StatHat account using this gem. Encapsulates full API.}
8
8
  s.email = %q{info@stathat.com}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stathat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - StatHat
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-03-30 00:00:00.000000000 Z
11
+ date: 2013-04-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Easily post stats to your StatHat account using this gem. Encapsulates
14
14
  full API.