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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 964d0d3b7325badb2202f50fe61b2a82554138346c183c0784b313c683aa26c8
4
- data.tar.gz: b622aaf71523728ae235d8ba1d6de060c906970dbc471a0408de8e274a545482
3
+ metadata.gz: 13d349b3045beb3370a29aca8ebe22f93fdcdeb143a7fefe0f4ecb031b8ffda9
4
+ data.tar.gz: da704d4f640423bc7a5c85151d3e531e95d564949812a032a925326b3a278219
5
5
  SHA512:
6
- metadata.gz: 3ba07bb7792de8c7e2f8e53128cc69b5e5a22b7cdbeb87ec7d87f7d026fac2a3907f838e9f88234c237b119aed8ee66aa7980d79f86db3391619422ce7254a17
7
- data.tar.gz: c285d5d65556fa7953345f38c295250546dc041bea372b32ec559d7a44ef9783b8b9c36ced77b24b464dbcccf783ffd2994680e720bb147fe162080c258b20bd
6
+ metadata.gz: de57bbecbd55635636928d9de85a7e3e196098476684cdac3cc1f6f399434543dfd7cc7afa0cb947676cd9403c37d9122d82fa1c60dd20a304cf4cb3e5481ad4
7
+ data.tar.gz: aa54a84bb9b8a4d42126283ba7ca17c00214c6daf745132c1f7a4c4b50407772e8b6c8bd141f483e8d1b95b02ba3181e047a6ee51b0898daec75b688ed32881a
data/Rakefile CHANGED
@@ -6,7 +6,6 @@ require 'pry'
6
6
  Rake::TestTask.new do |t|
7
7
  t.libs << 'test'
8
8
  t.test_files = FileList['test/**/*.rb']
9
- t.options = '-p'
10
9
  end
11
10
 
12
11
  task :package do
@@ -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/octet-stream',
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
- encoded_data_components = data_hash.map do |key, value|
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?('Rails') && Rails.configuration.respond_to?(:wovnrb)
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
@@ -1,3 +1,3 @@
1
1
  module Wovnrb
2
- VERSION = '3.4.1'.freeze
2
+ VERSION = '3.5.0'.freeze
3
3
  end
@@ -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/octet-stream',
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.map { |key, value| "#{key}=#{CGI.escape(value)}" }.join('&')
161
+ data.to_json
161
162
  end
162
163
 
163
164
  def compress(string)
164
- gzip = Zlib::GzipWriter.new(StringIO.new)
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.1
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: 2021-11-25 00:00:00.000000000 Z
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.1.4
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: