purple-client 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/purple/path.rb +16 -12
- data/lib/purple/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d18a27dc35385412674a327de6cb947d1b4d8efe4e4032acc9edc1513ce24da
|
4
|
+
data.tar.gz: 3611ed61c25f22b6f9f458894ca52bf611b10874051073485e9e67317529c3b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e5bc2479a7b5b259113e76ca91d1578a180afa3b792c12608bdb03d0c23b28e5ddfd1aa3ee3ecf96b32700fd140ed84dcb6330b19da3fd908ea97fa14600f2d
|
7
|
+
data.tar.gz: 30e8ca1120a40557ffda8a51c531ee06c34807e3696ff424c056bf237819765b6f0171c115da9089234088e4a4ae9b32d366a67143149112a401c7862ea1bad0
|
data/lib/purple/path.rb
CHANGED
@@ -53,20 +53,24 @@ module Purple
|
|
53
53
|
|
54
54
|
resp_structure = responses.find { |resp| resp.status_code == response.status }
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
56
|
+
if resp_structure.nil?
|
57
|
+
raise "#{client.domain}/#{full_path} returns #{response.status}, but it is not defined in the client"
|
58
|
+
else
|
59
|
+
object = if resp_structure.body.is_a?(Purple::Responses::Body)
|
60
|
+
resp_structure.body.validate!(response.body, args)
|
61
|
+
elsif resp_structure.body == :default
|
62
|
+
response.body
|
63
|
+
else
|
64
|
+
{}
|
65
|
+
end
|
63
66
|
|
64
|
-
|
67
|
+
client.callback&.call(url, params, headers, JSON.parse(response.body))
|
65
68
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
69
|
+
if block_given?
|
70
|
+
yield(resp_structure.status, object)
|
71
|
+
else
|
72
|
+
object
|
73
|
+
end
|
70
74
|
end
|
71
75
|
end
|
72
76
|
end
|
data/lib/purple/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purple-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-initializer
|
@@ -55,7 +55,7 @@ metadata:
|
|
55
55
|
homepage_uri: https://github.com/purple-magic/purple-client
|
56
56
|
source_code_uri: https://github.com/purple-magic/purple-client
|
57
57
|
changelog_uri: https://github.com/Purple-Magic/purple-client/releases
|
58
|
-
post_install_message:
|
58
|
+
post_install_message:
|
59
59
|
rdoc_options: []
|
60
60
|
require_paths:
|
61
61
|
- lib
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
73
|
rubygems_version: 3.4.6
|
74
|
-
signing_key:
|
74
|
+
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Build API wrappers faster
|
77
77
|
test_files: []
|