tshield 0.7.0.0 → 0.8.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tshield/request.rb +18 -7
- data/lib/tshield/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: 21eb1813abe621fbbd5239e1b80aa3f0c3985aac
|
4
|
+
data.tar.gz: 63e502ed3dd6663f90befd4da0a97a91a62b7551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7dddf275f556989113f2ab0be6fdc1a3ef431e2e223a5042eb734fcccf016d3a2c5d5bcd5d22e2f1eca70133f7f0aec5351d854eed681dd36e9d3c0f2d971496
|
7
|
+
data.tar.gz: f1795cd4c6da1c31904a45831d887d82b27affae09fca7794d7e2484e5f62b8133b495e098d6acc70f344cead810aa279d55dcb3a711a67cc507005a6bd8bc50
|
data/lib/tshield/request.rb
CHANGED
@@ -92,7 +92,11 @@ module TShield
|
|
92
92
|
end
|
93
93
|
|
94
94
|
def content
|
95
|
-
@content
|
95
|
+
return @content if @content
|
96
|
+
|
97
|
+
@content = JSON.parse(File.open(destiny).read)
|
98
|
+
@content['body'] = File.open(destiny(true)).read unless @content['body']
|
99
|
+
@content
|
96
100
|
end
|
97
101
|
|
98
102
|
def file_exists
|
@@ -113,9 +117,7 @@ module TShield
|
|
113
117
|
@key ||= Digest::SHA1.hexdigest "#{@url}|#{method}"
|
114
118
|
end
|
115
119
|
|
116
|
-
def destiny
|
117
|
-
return @destiny_path if @destiny_path
|
118
|
-
|
120
|
+
def destiny(iscontent = false)
|
119
121
|
request_path = File.join('requests')
|
120
122
|
Dir.mkdir(request_path) unless File.exists?(request_path)
|
121
123
|
|
@@ -132,14 +134,23 @@ module TShield
|
|
132
134
|
|
133
135
|
method_path = File.join(path_path, method)
|
134
136
|
Dir.mkdir(method_path) unless File.exists?(method_path)
|
135
|
-
|
136
|
-
|
137
|
+
|
138
|
+
destiny_name = iscontent ? "#{@content_idx}.content" : "#{@content_idx}.json"
|
139
|
+
File.join(method_path, destiny_name)
|
137
140
|
end
|
138
141
|
|
139
142
|
def write(content)
|
143
|
+
f = File.open(destiny(true), 'w')
|
144
|
+
f.write(content[:body])
|
145
|
+
f.close
|
146
|
+
|
147
|
+
body = content.delete :body
|
148
|
+
|
140
149
|
f = File.open(destiny, 'w')
|
141
|
-
f.write(content
|
150
|
+
f.write(JSON.pretty_generate(content))
|
142
151
|
f.close
|
152
|
+
|
153
|
+
content[:body] = body
|
143
154
|
end
|
144
155
|
|
145
156
|
def safe_dir(url)
|
data/lib/tshield/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tshield
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diego Rubin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|