fluffy-ruby 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fluffy/api.rb +13 -0
- data/lib/fluffy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd1f2cc767052443b946825acf9e028ba98da81d
|
4
|
+
data.tar.gz: 96f2024ad746cce397b1dfc6ee7ac24c6956d804
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac7f882c0267749c2d48ea8273b4d340d43227bcc1e6b2cb5b249fa92529b83db9e9e176345a30d069e45653f3d480425a28a42e991267e737b95546304e54c3
|
7
|
+
data.tar.gz: dd8212175c7dc2672ec511cc1c089e14956236d6de8003b37b93792dff56177e916777108189e0776ad321dbfe0e9802ed8cbd39a5d631bab3fdf0fc63a8ca0a
|
data/lib/fluffy/api.rb
CHANGED
@@ -49,6 +49,19 @@ module Fluffy
|
|
49
49
|
data['message']
|
50
50
|
end
|
51
51
|
|
52
|
+
# Perform a HTTP PATCH request
|
53
|
+
#
|
54
|
+
# @param endpoint [Array[String], String] HTTP API endpoint
|
55
|
+
# @param params [Hash] HTTP API body
|
56
|
+
# @return [Hash, nil] API JSON response
|
57
|
+
#
|
58
|
+
def patch(endpoint:, params: {})
|
59
|
+
resp = self.http.patch([self.url, endpoint.is_a?(Array) ? endpoint.join('/') : endpoint].join('/'), params.to_json, {'Content-Type' => 'application/json', 'Accept' => 'application/json'})
|
60
|
+
data = JSON.parse(resp.body)
|
61
|
+
raise APIError.new(data['message'], data['error'], resp.status) if resp.status >= 400
|
62
|
+
data['message']
|
63
|
+
end
|
64
|
+
|
52
65
|
# Perform a HTTP DELETE request
|
53
66
|
#
|
54
67
|
# @param endpoint [Array[String], String] HTTP API endpoint
|
data/lib/fluffy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluffy-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matteo Cerutti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|