tshield 0.7.0.0 → 0.8.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b83b9aecc631ad34729ca10a0a81c100348ce053
4
- data.tar.gz: a4d455aa2268514779d2821e9a4d122f4a362571
3
+ metadata.gz: 21eb1813abe621fbbd5239e1b80aa3f0c3985aac
4
+ data.tar.gz: 63e502ed3dd6663f90befd4da0a97a91a62b7551
5
5
  SHA512:
6
- metadata.gz: 13cab70c3fe4d4eac9ce9e05473b7c90971481afc8f921845057085b06e9f40a47761ae60dd9ca219a1c9ca5d098feb5b4895128d531ad7ea32332d1880ae95d
7
- data.tar.gz: 3bc8d84d0a71421815694be292bdac26b55cdb356735bb3674cf41cee7e2af43aa33987d63ad5b4f4c1ff7fbdab3c53be1c7d19659eae5089b94d715d28ad649
6
+ metadata.gz: 7dddf275f556989113f2ab0be6fdc1a3ef431e2e223a5042eb734fcccf016d3a2c5d5bcd5d22e2f1eca70133f7f0aec5351d854eed681dd36e9d3c0f2d971496
7
+ data.tar.gz: f1795cd4c6da1c31904a45831d887d82b27affae09fca7794d7e2484e5f62b8133b495e098d6acc70f344cead810aa279d55dcb3a711a67cc507005a6bd8bc50
@@ -92,7 +92,11 @@ module TShield
92
92
  end
93
93
 
94
94
  def content
95
- @content ||= JSON.parse(File.open(destiny).read)
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
- @destiny_path = File.join(method_path, "#{@content_idx}.json")
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.to_json)
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)
@@ -1,7 +1,7 @@
1
1
  module TShield
2
2
  class Version
3
3
  MAJOR = 0
4
- MINOR = 7
4
+ MINOR = 8
5
5
  PATCH = 0
6
6
  PRE = 0
7
7
 
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.7.0.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-23 00:00:00.000000000 Z
11
+ date: 2018-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty