nova-api 1.4.1 → 1.4.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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/nova/api/base.rb +15 -1
- data/lib/nova/api/version.rb +3 -1
- data/lib/nova/configuration.rb +12 -3
- 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: d65ec275d59211def3addb948fd8eb041a9011c4f863475b4ae20814dc7697b2
|
4
|
+
data.tar.gz: 6485592406ff923bf58094e2c6aaf82b7778c8cdbdecc4edff6b004615b808b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0607c64dba8511a2b183982137e754c4401709dec523dcd8b72e4b1091a99b58b86459ecdee67ad7d6dd194ae515e640437ed0def9dd952d4c17ddf57637062
|
7
|
+
data.tar.gz: 8f2ba32f43f95856e1afa04096db889980203d563eef690bdba54554f8536cb0b4aaffd05c3a187e7a685362e74c23ea22948866784cf9373fe8ffbc3d6f4c08
|
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
|
|
@@ -104,6 +112,12 @@ module Nova
|
|
104
112
|
def_delegator self, :configuration
|
105
113
|
|
106
114
|
def self.set_base_uri
|
115
|
+
if configuration.debug?
|
116
|
+
debug_output $stdout
|
117
|
+
|
118
|
+
Kernel.p "[NOVA-API] Changing base URI from #{base_uri} to #{base_url}"
|
119
|
+
end
|
120
|
+
|
107
121
|
base_uri base_url
|
108
122
|
end
|
109
123
|
def_delegator self, :set_base_uri
|
data/lib/nova/api/version.rb
CHANGED
data/lib/nova/configuration.rb
CHANGED
@@ -1,13 +1,22 @@
|
|
1
1
|
module Nova
|
2
2
|
module API
|
3
3
|
class Configuration
|
4
|
-
attr_accessor :api_key, :
|
5
|
-
attr_reader :
|
6
|
-
|
4
|
+
attr_accessor :api_key, :use_staging, :debug
|
5
|
+
attr_reader :subdomain
|
6
|
+
|
7
|
+
def subdomain=(value)
|
8
|
+
Kernel.p "[NOVA-API] Changed subdomain from #{@subdomain} to #{value}" if debug?
|
9
|
+
|
10
|
+
@subdomain = value
|
11
|
+
end
|
7
12
|
|
8
13
|
def use_staging?
|
9
14
|
[true, 'true'].include?(use_staging)
|
10
15
|
end
|
16
|
+
|
17
|
+
def debug?
|
18
|
+
[true, 'true'].include?(debug)
|
19
|
+
end
|
11
20
|
end
|
12
21
|
end
|
13
22
|
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.5
|
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-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|