herdic 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/herdic +1 -1
- data/lib/herdic/client.rb +15 -1
- data/lib/herdic/version.rb +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: 5e6a6415b3aa01cb18489c8092ba5e83fbd1fae3
|
4
|
+
data.tar.gz: f49947d5d1b82ed0703bdaf3f679e5f84880772d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 496aae96af64c3fe56b2ea4c05164c28e662461f66b8cfe04f40f6bef4da7a1d536bd50904e5c2d185b8dd8286064496c3fe2988c99876f782b637ba89680151
|
7
|
+
data.tar.gz: 4c80144839b47a70caedea5ca81a51b2e37b836088545a199477322507b8285f8abf4d5a7ac5e7c7497104bce38509f89970849b86f8e47d2e1aa3cbd7105d74
|
data/bin/herdic
CHANGED
data/lib/herdic/client.rb
CHANGED
@@ -25,8 +25,9 @@ module Herdic
|
|
25
25
|
@printer = Printer.new @options
|
26
26
|
@printer.start_message @config_file
|
27
27
|
|
28
|
-
@store
|
28
|
+
@store = Store.new @config_file
|
29
29
|
@registry = @store.data
|
30
|
+
@cookie = (@registry[:_cookie] ||= {})
|
30
31
|
end
|
31
32
|
|
32
33
|
def load_config(file)
|
@@ -76,6 +77,8 @@ module Herdic
|
|
76
77
|
register response, body
|
77
78
|
end
|
78
79
|
|
80
|
+
save_cookie response unless @options['no-cookie']
|
81
|
+
|
79
82
|
@printer.response response, body
|
80
83
|
end
|
81
84
|
|
@@ -102,6 +105,10 @@ module Herdic
|
|
102
105
|
|
103
106
|
@meta['method'].upcase!
|
104
107
|
@header = @header.map { |k, v| [k, v.to_s] }.to_h
|
108
|
+
|
109
|
+
unless @options['no-cookie'] || @cookie.empty?
|
110
|
+
@header['Cookie'] = @cookie.map { |k, v| '%s=%s' % [k, v] }.join ';'
|
111
|
+
end
|
105
112
|
end
|
106
113
|
|
107
114
|
private def register(response, body)
|
@@ -119,5 +126,12 @@ module Herdic
|
|
119
126
|
end
|
120
127
|
end
|
121
128
|
|
129
|
+
private def save_cookie(response)
|
130
|
+
Array(response.get_fields('Set-Cookie')).each do |str|
|
131
|
+
k, v = str.split(';')[0].split '='
|
132
|
+
@cookie[k] = v
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
122
136
|
end
|
123
137
|
end
|
data/lib/herdic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: herdic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuki Iwanaga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|