purple-client 0.1.7.4 → 0.1.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 81f0cb64364ec0312d07b900ae67a2e65137d03818c6b3e2c1b8631221ea9a65
4
- data.tar.gz: 7404f01d3ba5714093d62fbac16218b263f20c43d0b29391add9fd9833ccdb29
3
+ metadata.gz: b5222522b4a3c4376e2a10f9ea7e4deece8f209d4f3fe4ac22dc9e12fe4445c7
4
+ data.tar.gz: e29a6b0c293f9dec1b84d322a46f8a00219c44890138e05b3ec507ae186eefb6
5
5
  SHA512:
6
- metadata.gz: ab18072bf25f80e0ded0dc7d3f317230fb93e400cbc9a563bf0d6be68b3c166458bf94f39877eb6dc535bce4c1e8c962b002699e3f4e08702effee65ba86e397
7
- data.tar.gz: ef5033eb7da7a10bf033583603906b31176a63222e95e5f18bbdcab613b4ac775d4cb76594419c796206d65680dfc836d88ffe8f62973b38ad867a81928a1c8d
6
+ metadata.gz: d9b273ed8a541e201b06221cb26696b9c6035bdbf06ae3d71dd37fad084b9e04a9a4b4af107284e32b98bf4076ee9ee26d67a41b34e83060b20530b2baf67ae3
7
+ data.tar.gz: 2c02a529e6df950dac3b480a0d736e3de51d822e5de6307ba9e6e8d675c8fe59623449475c664bc62300e2eb13e79e05cbd2d85bd2505eee9301f66d84239629
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Purple::Client
1
+ # Purple Client
2
2
 
3
3
  Purple::Client is a small DSL that helps you describe HTTP APIs. You define a domain, paths, and response structures, and the library generates handy methods for interacting with your service.
4
4
 
@@ -59,6 +59,36 @@ end
59
59
  JobsClient.job(123)
60
60
  ```
61
61
 
62
+ ### Simple POST request
63
+
64
+ ```ruby
65
+ class Amocrm::Client < Purple::Client
66
+ domain 'https://www.amocrm.ru'
67
+
68
+ path :oauth2 do
69
+ path :access_token, method: :post do
70
+ root_method :access_token
71
+
72
+ params do |client_id:, client_secret:, redirect_uri:, code:, grant_type: :authorization_code|
73
+ { client_id:, client_secret:, redirect_uri:, code:, grant_type: }
74
+ end
75
+
76
+ response :ok do
77
+ body(
78
+ token_type: String,
79
+ expires_in: Integer,
80
+ server_time: Integer,
81
+ access_token: String,
82
+ refresh_token: String
83
+ )
84
+ end
85
+
86
+ response :bad_request
87
+ end
88
+ end
89
+ end
90
+ ```
91
+
62
92
  ### Using authorization
63
93
 
64
94
  ```ruby
@@ -82,6 +82,10 @@ class Purple::Responses::Body
82
82
  end
83
83
  elsif value.is_a?(Array)
84
84
  object[key].each do |item|
85
+ if value[0].is_a?(Symbol)
86
+ raise "Body structure definition error in key '#{key}' of structure #{substructure}."
87
+ end
88
+
85
89
  check_structure!(item, value[0])
86
90
  end
87
91
  else
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Purple
4
- VERSION = "0.1.7.4"
4
+ VERSION = "0.1.7.5"
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.7.4
4
+ version: 0.1.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kalashnikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-12 00:00:00.000000000 Z
11
+ date: 2025-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-initializer