moysklad 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/moysklad/client.rb +12 -6
- data/lib/moysklad/version.rb +1 -1
- data/moysklad.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eba3855e983122b5158c941697b4dc46309d9a7fa81bac691a90d4dbbed6238b
|
4
|
+
data.tar.gz: 4edcfda4ffd7ff9156251a5f0f5e7d2de51c2c40c3b1fec1f5d84f77e407d9e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f19a54c763da441522e474ecd87bfbdfac9656af8e9c598132b7e8101d7dfc71a7d570386fbd78e4c188a1c4038f24c1f3c8c69878f9ab3181a9fd887ba7863
|
7
|
+
data.tar.gz: 1531d71f523c7b0d51f07b1c7beed2be02dad3b1094e714e6917aa69b9c187fa4687b71b1a54e6639350725e84178f32305729a12c7d4a7994627c2499634e38
|
data/lib/moysklad/client.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'faraday'
|
2
2
|
require 'faraday/detailed_logger'
|
3
3
|
require 'faraday_curl'
|
4
|
+
require 'faraday/gzip'
|
4
5
|
|
5
6
|
require_relative 'client/errors'
|
6
7
|
|
@@ -24,22 +25,27 @@ class Moysklad::Client
|
|
24
25
|
end
|
25
26
|
|
26
27
|
def download(path, filename)
|
27
|
-
response = client.get path
|
28
|
+
response = client.get path do |req|
|
29
|
+
req.request :gzip
|
30
|
+
end
|
28
31
|
File.open(filename, 'wb') { |fp| fp.write(response.body) }
|
29
32
|
end
|
30
33
|
|
31
34
|
def get path, params={}
|
32
35
|
logger.debug "Client: GET #{path} #{params}"
|
33
|
-
|
36
|
+
result = client.get path, params do |req|
|
37
|
+
req.request :gzip
|
38
|
+
end
|
39
|
+
parse_response result
|
34
40
|
end
|
35
41
|
|
36
42
|
def post path, data
|
37
43
|
logger.debug "Client: POST #{path}"
|
38
44
|
result = client.post do |req|
|
39
45
|
req.url path
|
46
|
+
req.request :gzip
|
40
47
|
req.headers['Content-Type'] = 'application/json'
|
41
48
|
req.headers['Accept'] = '*/*'
|
42
|
-
req.headers['Accept-Encoding'] = 'gzip'
|
43
49
|
req.body = data
|
44
50
|
end
|
45
51
|
parse_response result
|
@@ -48,10 +54,10 @@ class Moysklad::Client
|
|
48
54
|
def put path, data
|
49
55
|
logger.debug "Client: PUT #{path}"
|
50
56
|
result = client.put do |req|
|
57
|
+
req.request :gzip
|
51
58
|
req.url path
|
52
59
|
req.headers['Content-Type'] = 'application/json'
|
53
60
|
req.headers['Accept'] = '*/*'
|
54
|
-
req.headers['Accept-Encoding'] = 'gzip'
|
55
61
|
req.body = data
|
56
62
|
end
|
57
63
|
parse_response result
|
@@ -60,10 +66,10 @@ class Moysklad::Client
|
|
60
66
|
def delete path
|
61
67
|
logger.debug "Client: DELETE #{path}"
|
62
68
|
result = client.delete do |req|
|
69
|
+
req.request :gzip
|
63
70
|
req.url path
|
64
71
|
req.headers['Content-Type'] = 'application/json'
|
65
72
|
req.headers['Accept'] = '*/*'
|
66
|
-
req.headers['Accept-Encoding'] = 'gzip'
|
67
73
|
end
|
68
74
|
parse_response result
|
69
75
|
end
|
@@ -77,7 +83,7 @@ class Moysklad::Client
|
|
77
83
|
end
|
78
84
|
|
79
85
|
def parse_response res
|
80
|
-
body =
|
86
|
+
body = res.body
|
81
87
|
Moysklad.logger.debug "Response [#{res.status}] with body #{body}"
|
82
88
|
|
83
89
|
if res.status == 200
|
data/lib/moysklad/version.rb
CHANGED
data/moysklad.gemspec
CHANGED
@@ -21,6 +21,7 @@ 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'
|
24
25
|
spec.add_runtime_dependency 'virtus'
|
25
26
|
# spec.add_runtime_dependency 'nokogiri-happymapper'
|
26
27
|
spec.add_runtime_dependency 'activesupport', '>=3.0.0'
|
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
|
+
version: 0.4.5
|
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-
|
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,20 @@ 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'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: virtus
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|