stathat 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/stathat.rb +16 -1
- data/stathat.gemspec +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: 7ee87bf200f2253b10ecb7b18347f3568de64a04
|
4
|
+
data.tar.gz: 9595cbb662a0c688efa180ebeb460a42d0fea6cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b13434236e9ea8f3e3dc8d1697311ab8c0bbfb8f3f6a46d8a3869c73d2eb015b9764e538ccf6d6738b37b4a31c1231b3aae2330a1b16e1912411ab09c7b9b07
|
7
|
+
data.tar.gz: baea8c7cb43c524395f389dd7e68abcfb090c1d653a6285dd032d4ad6ec907db71ec457d68f113c0a5f61f5834029b159cec95159581ad65351cb3a222e42ab9
|
data/lib/stathat.rb
CHANGED
@@ -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
|
-
|
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
|
data/stathat.gemspec
CHANGED
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.
|
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-
|
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.
|