nova-api 1.4.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/nova/api/base.rb +11 -1
- data/lib/nova/api/version.rb +3 -1
- data/lib/nova/configuration.rb +5 -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: ade5522e27034c1d827abb8890c13526e70b4e827af7ec55065953768ba0359b
|
4
|
+
data.tar.gz: 83a1ebc2c75b187d7173d1dde47e88298e5e3c40f77cbbe9364ca52da50e58f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d9bc983dbe38b9ffe7da9a9f13ac1f5b98804e2b1d5cc1180cd8d58237084c0b94622d6929700f7eb7fda5cb4c92cc02538b0a82513531deb7724a6d76d34c0
|
7
|
+
data.tar.gz: d6a70c102842e9493a3a7d8bab966ff84c5c189f4819a5ed9c7ffde0ca374f3f3afbb5229e13bdbf579c6f7240046b50e4eaf3a19be74c4b1664818a9489b42d
|
data/Gemfile.lock
CHANGED
data/lib/nova/api/base.rb
CHANGED
@@ -46,6 +46,8 @@ module Nova
|
|
46
46
|
def do_delete(endpoint)
|
47
47
|
set_base_uri
|
48
48
|
|
49
|
+
Kernel.p "[NOVA-API] Issuing DELETE to #{endpoint}, headers: #{authorization_header}" if configuration.debug?
|
50
|
+
|
49
51
|
response = self.class.delete(endpoint, headers: authorization_header)
|
50
52
|
|
51
53
|
Nova::API::Response.build(response)
|
@@ -54,6 +56,8 @@ module Nova
|
|
54
56
|
def do_patch(endpoint, data)
|
55
57
|
set_base_uri
|
56
58
|
|
59
|
+
Kernel.p "[NOVA-API] Issuing PATCH to #{endpoint}, headers: #{authorization_header}" if configuration.debug?
|
60
|
+
|
57
61
|
if data.nil? || data.empty?
|
58
62
|
response = self.class.patch(endpoint, headers: authorization_header)
|
59
63
|
|
@@ -71,6 +75,8 @@ module Nova
|
|
71
75
|
def do_post(endpoint, data)
|
72
76
|
set_base_uri
|
73
77
|
|
78
|
+
Kernel.p "[NOVA-API] Issuing POST to #{endpoint}, headers: #{authorization_header}" if configuration.debug?
|
79
|
+
|
74
80
|
response = self.class.post(endpoint, body: data, headers: authorization_header)
|
75
81
|
|
76
82
|
Nova::API::Response.build(response, self)
|
@@ -85,6 +91,8 @@ module Nova
|
|
85
91
|
def self.perform_get(endpoint, query, headers = {})
|
86
92
|
set_base_uri
|
87
93
|
|
94
|
+
Kernel.p "[NOVA-API] Issuing GET to #{endpoint}, headers: #{headers.merge(authorization_header)}" if configuration.debug?
|
95
|
+
|
88
96
|
response =
|
89
97
|
if query
|
90
98
|
self.get(endpoint, query: query, headers: headers.merge(authorization_header))
|
@@ -94,7 +102,7 @@ module Nova
|
|
94
102
|
end
|
95
103
|
|
96
104
|
def self.authorization_header
|
97
|
-
{ 'Persistent-Token': configuration.api_key }
|
105
|
+
{ 'Persistent-Token': configuration.api_key }.dup
|
98
106
|
end
|
99
107
|
def_delegator self, :authorization_header
|
100
108
|
|
@@ -105,6 +113,8 @@ module Nova
|
|
105
113
|
|
106
114
|
def self.set_base_uri
|
107
115
|
base_uri base_url
|
116
|
+
|
117
|
+
debug_output $stdout if configuration.debug?
|
108
118
|
end
|
109
119
|
def_delegator self, :set_base_uri
|
110
120
|
end
|
data/lib/nova/api/version.rb
CHANGED
data/lib/nova/configuration.rb
CHANGED
@@ -1,13 +1,17 @@
|
|
1
1
|
module Nova
|
2
2
|
module API
|
3
3
|
class Configuration
|
4
|
-
attr_accessor :api_key, :subdomain, :use_staging
|
4
|
+
attr_accessor :api_key, :subdomain, :use_staging, :debug
|
5
5
|
attr_reader :host
|
6
6
|
attr_reader :scheme
|
7
7
|
|
8
8
|
def use_staging?
|
9
9
|
[true, 'true'].include?(use_staging)
|
10
10
|
end
|
11
|
+
|
12
|
+
def debug?
|
13
|
+
[true, 'true'].include?(debug)
|
14
|
+
end
|
11
15
|
end
|
12
16
|
end
|
13
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nova-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coyô Software
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|