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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6c4c0d659d2721126ccdec5f4abd336387cefb8970fa023e9a7592302d8dde1
4
- data.tar.gz: 2335c27aebae36fd3f8d3f64a8276859dab12d230605c40a8c382fb856f30845
3
+ metadata.gz: d65ec275d59211def3addb948fd8eb041a9011c4f863475b4ae20814dc7697b2
4
+ data.tar.gz: 6485592406ff923bf58094e2c6aaf82b7778c8cdbdecc4edff6b004615b808b3
5
5
  SHA512:
6
- metadata.gz: 6279ae2790579df61cd1ba1347c3a8f0cd2730990f4f10225c0f02f0b04ee77753b21511df1b6e4a09ae809bd5578e3860fc0be50846302debf89fcda36e43fe
7
- data.tar.gz: 05b2d1731b21c2e257f207b20109bd1b80d0a053eca238b8ee43f34e8d238d0130cc35fdeabb27e680d3c681aefc583cc75c4a04f4c07e0145bf22a6d22db90c
6
+ metadata.gz: b0607c64dba8511a2b183982137e754c4401709dec523dcd8b72e4b1091a99b58b86459ecdee67ad7d6dd194ae515e640437ed0def9dd952d4c17ddf57637062
7
+ data.tar.gz: 8f2ba32f43f95856e1afa04096db889980203d563eef690bdba54554f8536cb0b4aaffd05c3a187e7a685362e74c23ea22948866784cf9373fe8ffbc3d6f4c08
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nova-api (1.4.1)
4
+ nova-api (1.4.5)
5
5
  dry-struct (~> 1.6)
6
6
  dry-types (~> 1.7)
7
7
  httparty (~> 0.1)
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
@@ -1,5 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Nova
2
4
  module API
3
- VERSION = "1.4.1"
5
+ VERSION = '1.4.5'
4
6
  end
5
7
  end
@@ -1,13 +1,22 @@
1
1
  module Nova
2
2
  module API
3
3
  class Configuration
4
- attr_accessor :api_key, :subdomain, :use_staging
5
- attr_reader :host
6
- attr_reader :scheme
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.1
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: 2023-10-03 00:00:00.000000000 Z
11
+ date: 2024-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler