hatenaapigraph 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +3 -0
- data/README +4 -0
- data/lib/hatena/api/graph.rb +9 -4
- metadata +2 -2
data/CHANGELOG
CHANGED
data/README
CHANGED
@@ -9,6 +9,10 @@
|
|
9
9
|
graph.post('graphname', Time.now, 10.5)
|
10
10
|
graph.post(graphname, timestamp, value)
|
11
11
|
|
12
|
+
# use proxy
|
13
|
+
graph.proxy = Net::HTTP::Proxy(proxy_host, proxy_port, proxy_user, proxy_pass)
|
14
|
+
graph.post(graphname, timestamp, value)
|
15
|
+
|
12
16
|
== Installation
|
13
17
|
|
14
18
|
# gem install hatenaapigraph
|
data/lib/hatena/api/graph.rb
CHANGED
@@ -16,7 +16,9 @@ module Hatena
|
|
16
16
|
def initialize(username, password)
|
17
17
|
@username = username
|
18
18
|
@password = password
|
19
|
+
@proxy = nil
|
19
20
|
end
|
21
|
+
attr_accessor :proxy
|
20
22
|
|
21
23
|
def post(graphname, date, value)
|
22
24
|
value = value.to_f
|
@@ -40,10 +42,13 @@ module Hatena
|
|
40
42
|
req = ::Net::HTTP::Post.new(url.path, headers)
|
41
43
|
req.form_data = params
|
42
44
|
req.basic_auth url.user, url.password if url.user
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
45
|
+
if @proxy
|
46
|
+
proxy = @proxy
|
47
|
+
else
|
48
|
+
proxy_host, proxy_port = (ENV['HTTP_PROXY'] || '').split(/:/)
|
49
|
+
proxy = ::Net::HTTP::Proxy(proxy_host, proxy_port.to_i)
|
50
|
+
end
|
51
|
+
proxy.start(url.host, url.port) {|http| http.request(req) }
|
47
52
|
end
|
48
53
|
|
49
54
|
def wsse(username, password)
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: hatenaapigraph
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-05-
|
6
|
+
version: 0.1.2
|
7
|
+
date: 2007-05-29 00:00:00 +09:00
|
8
8
|
summary: description of gem
|
9
9
|
require_paths:
|
10
10
|
- lib
|