purple-client 0.1.6 → 0.1.7.1
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 +4 -4
- data/README.md +23 -0
- data/lib/purple/client.rb +1 -2
- data/lib/purple/path.rb +6 -0
- data/lib/purple/response.rb +1 -0
- data/lib/purple/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 39f3cee0069620b8f540e7103eb4aa27fa0b7384a0b473c586dde47f6cebd62d
|
4
|
+
data.tar.gz: fe5c9ac61f1795b3994124c53ce1c5a31657a6e429e42e60c016b1c32a1909df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bf2ea0e3cd4aca1b327ad57da1711775a1bb14208163f41a8d6632232c1e45b5abba8a70c2b2953acd10288f5ad111ac83bf315e5056496801c8942d4163636
|
7
|
+
data.tar.gz: 5e544d9b54f7938fdca2f71ae58a6ce9e11815eae8d545511bab5afc7e5a4e93edb4dbdc30da572dd57e4a8fc9e412b8001533f303ebed7dfb667185c055fa64
|
data/README.md
CHANGED
@@ -151,6 +151,29 @@ extracted from the call and passed to your callback. In the example above the
|
|
151
151
|
available inside the callback so you can associate the stored event with a
|
152
152
|
record of your choice.
|
153
153
|
|
154
|
+
### Boolean response types
|
155
|
+
|
156
|
+
If you have boolean types `true` or `false` in your response, use
|
157
|
+
`Purple::Boolean` in the response configuration.
|
158
|
+
|
159
|
+
```ruby
|
160
|
+
class AccountsClient < Purple::Client
|
161
|
+
domain 'https://api.example.com'
|
162
|
+
|
163
|
+
path :accounts do
|
164
|
+
response :ok do
|
165
|
+
body(
|
166
|
+
last_name: String,
|
167
|
+
first_name: String,
|
168
|
+
is_creator: Purple::Boolean,
|
169
|
+
is_premium: Purple::Boolean,
|
170
|
+
)
|
171
|
+
end
|
172
|
+
root_method :accounts
|
173
|
+
end
|
174
|
+
end
|
175
|
+
```
|
176
|
+
|
154
177
|
## Development
|
155
178
|
|
156
179
|
After checking out the repo, run `bin/setup` to install dependencies. Then run
|
data/lib/purple/client.rb
CHANGED
@@ -65,9 +65,8 @@ module Purple
|
|
65
65
|
|
66
66
|
define_singleton_method method_name do |*call_args, **kw_args, &block|
|
67
67
|
if current_path.is_param
|
68
|
-
value =
|
68
|
+
value = call_args.first
|
69
69
|
current_path.with(value)
|
70
|
-
kw_args[current_path.name] = value
|
71
70
|
end
|
72
71
|
|
73
72
|
callback_arguments = additional_callback_arguments.map do |arg|
|
data/lib/purple/path.rb
CHANGED
@@ -74,6 +74,12 @@ module Purple
|
|
74
74
|
connection.get(url, params)
|
75
75
|
when :post
|
76
76
|
connection.post(url, params.to_json)
|
77
|
+
when :put
|
78
|
+
connection.put(url, params.to_json)
|
79
|
+
when :delete
|
80
|
+
connection.delete(url, params)
|
81
|
+
when :patch
|
82
|
+
connection.patch(url, params.to_json)
|
77
83
|
end
|
78
84
|
|
79
85
|
resp_structure = responses.find { |resp| resp.status_code == response.status }
|
data/lib/purple/response.rb
CHANGED
data/lib/purple/version.rb
CHANGED