wovnrb 3.4.1 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -1
- data/lib/wovnrb/api_translator.rb +3 -9
- data/lib/wovnrb/store.rb +1 -1
- data/lib/wovnrb/version.rb +1 -1
- data/test/lib/api_translator_test.rb +4 -5
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13d349b3045beb3370a29aca8ebe22f93fdcdeb143a7fefe0f4ecb031b8ffda9
|
4
|
+
data.tar.gz: da704d4f640423bc7a5c85151d3e531e95d564949812a032a925326b3a278219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de57bbecbd55635636928d9de85a7e3e196098476684cdac3cc1f6f399434543dfd7cc7afa0cb947676cd9403c37d9122d82fa1c60dd20a304cf4cb3e5481ad4
|
7
|
+
data.tar.gz: aa54a84bb9b8a4d42126283ba7ca17c00214c6daf745132c1f7a4c4b50407772e8b6c8bd141f483e8d1b95b02ba3181e047a6ee51b0898daec75b688ed32881a
|
data/Rakefile
CHANGED
@@ -62,10 +62,10 @@ module Wovnrb
|
|
62
62
|
|
63
63
|
def gzip_request(html_body)
|
64
64
|
api_params = build_api_params(html_body)
|
65
|
-
compressed_body = compress_request_data(api_params)
|
65
|
+
compressed_body = compress_request_data(api_params.to_json)
|
66
66
|
request = Net::HTTP::Post.new(request_path(html_body), {
|
67
67
|
'Accept-Encoding' => 'gzip',
|
68
|
-
'Content-Type' => 'application/
|
68
|
+
'Content-Type' => 'application/json',
|
69
69
|
'Content-Encoding' => 'gzip',
|
70
70
|
'Content-Length' => compressed_body.bytesize.to_s,
|
71
71
|
'X-Request-Id' => @uuid
|
@@ -122,13 +122,7 @@ module Wovnrb
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def compress_request_data(data_hash)
|
125
|
-
|
126
|
-
"#{key}=#{CGI.escape(value)}"
|
127
|
-
end
|
128
|
-
|
129
|
-
gzip = Zlib::GzipWriter.new(StringIO.new)
|
130
|
-
gzip << encoded_data_components.join('&')
|
131
|
-
gzip.close.string
|
125
|
+
ActiveSupport::Gzip.compress(data_hash)
|
132
126
|
end
|
133
127
|
|
134
128
|
def api_uri
|
data/lib/wovnrb/store.rb
CHANGED
@@ -114,7 +114,7 @@ module Wovnrb
|
|
114
114
|
# Load Rails config.wovnrb
|
115
115
|
#
|
116
116
|
def load_settings
|
117
|
-
if Object.const_defined?(
|
117
|
+
if Object.const_defined?(:Rails) && Rails.configuration.respond_to?(:wovnrb)
|
118
118
|
@config_loaded = true
|
119
119
|
update_settings(Rails.configuration.wovnrb)
|
120
120
|
end
|
data/lib/wovnrb/version.rb
CHANGED
@@ -119,7 +119,8 @@ module Wovnrb
|
|
119
119
|
'Accept' => '*/*',
|
120
120
|
'Accept-Encoding' => 'gzip',
|
121
121
|
'Content-Length' => compressed_data.bytesize,
|
122
|
-
'Content-Type' => 'application/
|
122
|
+
'Content-Type' => 'application/json',
|
123
|
+
'Content-Encoding' => 'gzip',
|
123
124
|
'User-Agent' => 'Ruby'
|
124
125
|
}
|
125
126
|
stub_response_json = "{\"body\":\"#{translated_html.gsub("\n", '\n')}\"}"
|
@@ -157,13 +158,11 @@ module Wovnrb
|
|
157
158
|
'custom_lang_aliases' => '{"ja":"Japanese"}'
|
158
159
|
}
|
159
160
|
|
160
|
-
data.
|
161
|
+
data.to_json
|
161
162
|
end
|
162
163
|
|
163
164
|
def compress(string)
|
164
|
-
|
165
|
-
gzip << string
|
166
|
-
gzip.close.string
|
165
|
+
ActiveSupport::Gzip.compress(string)
|
167
166
|
end
|
168
167
|
end
|
169
168
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wovnrb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wovn Technologies, Inc.
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -547,7 +547,7 @@ licenses:
|
|
547
547
|
- MIT
|
548
548
|
metadata:
|
549
549
|
rubygems_mfa_required: 'true'
|
550
|
-
post_install_message:
|
550
|
+
post_install_message:
|
551
551
|
rdoc_options: []
|
552
552
|
require_paths:
|
553
553
|
- lib
|
@@ -562,8 +562,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
562
562
|
- !ruby/object:Gem::Version
|
563
563
|
version: '0'
|
564
564
|
requirements: []
|
565
|
-
rubygems_version: 3.
|
566
|
-
signing_key:
|
565
|
+
rubygems_version: 3.2.3
|
566
|
+
signing_key:
|
567
567
|
specification_version: 4
|
568
568
|
summary: Gem for WOVN.io
|
569
569
|
test_files:
|