pnut 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pnut.rb +8 -3
- data/lib/pnut/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eeeda2c2c3813e67bd8446308e0688fc7949fa15c2fabe79f36b37f96a7f9c93
|
4
|
+
data.tar.gz: 2e5372cdd14dde4c2282993558e4e3c7aad38ed4d71e49ebf0a3190e2c1a3872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c985932c944530094910d7b143b49bbad0afe29c989ba36c66d53ea15baf7d9ddd692d761ad837c948111b561634f738e292f21dd9593497d52af32083bcee5
|
7
|
+
data.tar.gz: 94472f946a9caaae19758e332e0308227a28be77b42194f940c4c11081410f4fc85dd7ca53d500c032abcd0e7c307fcfbf21b579b4b1999b7678596a695190d5
|
data/lib/pnut.rb
CHANGED
@@ -14,7 +14,7 @@ module Pnut
|
|
14
14
|
@connection = Faraday.new("https://api.pnut.io/")
|
15
15
|
end
|
16
16
|
|
17
|
-
def request(endpoint, method: "GET", params: nil, data: nil, raw_response: false)
|
17
|
+
def request(endpoint, method: "GET", params: nil, data: nil, raw_response: false, json: true)
|
18
18
|
prepared_endpoint = "/v0#{endpoint}"
|
19
19
|
|
20
20
|
if params
|
@@ -25,10 +25,15 @@ module Pnut
|
|
25
25
|
|
26
26
|
response = @connection.send(method.downcase.to_sym, prepared_endpoint) do |req|
|
27
27
|
req.url prepared_endpoint
|
28
|
-
req.headers["Content-Type"] = "application/json"
|
29
28
|
|
29
|
+
req.headers["Content-Type"] = "application/json" if json
|
30
30
|
req.headers["Authorization"] = "Bearer #{@token}" if @token
|
31
|
-
|
31
|
+
|
32
|
+
if json
|
33
|
+
req.body = data.to_json if data
|
34
|
+
else
|
35
|
+
req.body = data if data
|
36
|
+
end
|
32
37
|
end
|
33
38
|
|
34
39
|
raw_response ? response.body : JSON.parse(response.body, object_class: OpenStruct)
|
data/lib/pnut/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pnut
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kai Wood
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|