moysklad 0.4.4 → 0.4.6

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: fb24a3feae7f239a193de031cb2734a7fa5a601e529ad9137ff0799c3db61ec8
4
- data.tar.gz: 64cee4b18ed08c5f0ed001f5459a388544812b0d7c7448926d3d129dca397fd0
3
+ metadata.gz: 3435d7c195bd20de53d97c82ac10d8269d94fc0e35a2e1aaf1330e5939ac28cb
4
+ data.tar.gz: d6067f848aa3a3568d996a9c9f02537035661fbfb67a5f7cf24193c6114490c6
5
5
  SHA512:
6
- metadata.gz: 8abd4098182f952d5ceb473b115b095d7fcd47715bb6f16645a8f06f96ff8ff61f830315899194e0383d7f0e1fcb2aa60172b5223fa9e507fe29d8fbce99c59f
7
- data.tar.gz: 97082340b4c8ab6974c403077e5a97a9c2450a9dad81bd0e928667241aca5765257edcc94c0c0046eb1007f1007c7ce096a4114248d2e95bcffe8e820099de56
6
+ metadata.gz: 6847920c2dc4f7d99f9c45b77fe3d0e438cf606452e6cde86fe0c69846268d860ea23ffbcf759d9559acda614de7fa880921b54fcd839cc3cc96e36743118f21
7
+ data.tar.gz: 82d5e908c6888f8abc700f400d3041b23d08b1642e6deec87a5074acd6327855231de5aac8fd5bf59bdcd855af03e8d2c386bd30a68883000b2c174833270d10
@@ -1,6 +1,8 @@
1
1
  require 'faraday'
2
2
  require 'faraday/detailed_logger'
3
3
  require 'faraday_curl'
4
+ require 'faraday/gzip'
5
+ require 'faraday/encoding'
4
6
 
5
7
  require_relative 'client/errors'
6
8
 
@@ -13,6 +15,8 @@ class Moysklad::Client
13
15
  conn.response :detailed_logger, logger
14
16
  conn.request :curl, logger, :info
15
17
  end
18
+ conn.request :gzip
19
+ conn.response :encoding
16
20
 
17
21
  conn.options.timeout = ENV.fetch('MOYSKLAD_HTTP_TIMEOUT', 120)
18
22
  if Faraday::VERSION.split('.').first.to_i < 2
@@ -20,6 +24,8 @@ class Moysklad::Client
20
24
  else
21
25
  conn.request(:authorization, :basic, login, password)
22
26
  end
27
+
28
+ conn.adapter Faraday.default_adapter
23
29
  end
24
30
  end
25
31
 
@@ -39,7 +45,6 @@ class Moysklad::Client
39
45
  req.url path
40
46
  req.headers['Content-Type'] = 'application/json'
41
47
  req.headers['Accept'] = '*/*'
42
- req.headers['Accept-Encoding'] = 'gzip'
43
48
  req.body = data
44
49
  end
45
50
  parse_response result
@@ -51,7 +56,6 @@ class Moysklad::Client
51
56
  req.url path
52
57
  req.headers['Content-Type'] = 'application/json'
53
58
  req.headers['Accept'] = '*/*'
54
- req.headers['Accept-Encoding'] = 'gzip'
55
59
  req.body = data
56
60
  end
57
61
  parse_response result
@@ -63,7 +67,6 @@ class Moysklad::Client
63
67
  req.url path
64
68
  req.headers['Content-Type'] = 'application/json'
65
69
  req.headers['Accept'] = '*/*'
66
- req.headers['Accept-Encoding'] = 'gzip'
67
70
  end
68
71
  parse_response result
69
72
  end
@@ -77,7 +80,8 @@ class Moysklad::Client
77
80
  end
78
81
 
79
82
  def parse_response res
80
- body = (res.body || '').force_encoding('utf-8')
83
+ body = res.body
84
+ body.force_encoding 'utf-8' if res.body.encoding.to_s == "ASCII-8BIT" && res.headers['content-type'].include?('charset=utf-8')
81
85
  Moysklad.logger.debug "Response [#{res.status}] with body #{body}"
82
86
 
83
87
  if res.status == 200
@@ -1,3 +1,3 @@
1
1
  module Moysklad
2
- VERSION = '0.4.4'
2
+ VERSION = '0.4.6'
3
3
  end
data/moysklad.gemspec CHANGED
@@ -21,8 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = '>= 2.0.0'
22
22
 
23
23
  spec.add_runtime_dependency 'faraday'
24
+ spec.add_runtime_dependency 'faraday-gzip'
25
+ spec.add_runtime_dependency 'faraday-encoding'
24
26
  spec.add_runtime_dependency 'virtus'
25
- # spec.add_runtime_dependency 'nokogiri-happymapper'
26
27
  spec.add_runtime_dependency 'activesupport', '>=3.0.0'
27
28
 
28
29
  spec.add_development_dependency "bundler"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moysklad
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danil Pismenny
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-17 00:00:00.000000000 Z
11
+ date: 2023-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday-gzip
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: faraday-encoding
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: virtus
29
57
  requirement: !ruby/object:Gem::Requirement