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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52d949ade3816a9c300a86183d10aadf41052ce9b5532651bbb45824f6e731ca
4
- data.tar.gz: 0a0b9f5bf1ff5f4f8acbd45a813d0c79251422c133bc11566b40fca97f51ed61
3
+ metadata.gz: 9d18a27dc35385412674a327de6cb947d1b4d8efe4e4032acc9edc1513ce24da
4
+ data.tar.gz: 3611ed61c25f22b6f9f458894ca52bf611b10874051073485e9e67317529c3b5
5
5
  SHA512:
6
- metadata.gz: b2b509535d9dac1de4611d17a8eee8a51d16c6621762d59212fbde9aa1c0b99197349e2fed2b829f3335f04e1da88485618730f922aef7be8b086bfc38ded3e2
7
- data.tar.gz: 24ef0a418979210df30bd2fc3c8e33bc5d6b3d9899b6d2dd72c44683689553b0a1b1e59dba8a77645b57295455d9cc71cb937ac4f2bb0ef9d7867d2f779a0885
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
- object = if resp_structure.body.is_a?(Purple::Responses::Body)
57
- resp_structure.body.validate!(response.body, args)
58
- elsif resp_structure.body == :default
59
- response.body
60
- else
61
- {}
62
- end
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
- client.callback&.call(url, params, headers, JSON.parse(response.body))
67
+ client.callback&.call(url, params, headers, JSON.parse(response.body))
65
68
 
66
- if block_given?
67
- yield(resp_structure.status, object)
68
- else
69
- object
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Purple
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
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.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: 2024-12-10 00:00:00.000000000 Z
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: []