nova-api 1.4.1 → 1.4.3

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: ade5522e27034c1d827abb8890c13526e70b4e827af7ec55065953768ba0359b
4
+ data.tar.gz: 83a1ebc2c75b187d7173d1dde47e88298e5e3c40f77cbbe9364ca52da50e58f4
5
5
  SHA512:
6
- metadata.gz: 6279ae2790579df61cd1ba1347c3a8f0cd2730990f4f10225c0f02f0b04ee77753b21511df1b6e4a09ae809bd5578e3860fc0be50846302debf89fcda36e43fe
7
- data.tar.gz: 05b2d1731b21c2e257f207b20109bd1b80d0a053eca238b8ee43f34e8d238d0130cc35fdeabb27e680d3c681aefc583cc75c4a04f4c07e0145bf22a6d22db90c
6
+ metadata.gz: 9d9bc983dbe38b9ffe7da9a9f13ac1f5b98804e2b1d5cc1180cd8d58237084c0b94622d6929700f7eb7fda5cb4c92cc02538b0a82513531deb7724a6d76d34c0
7
+ data.tar.gz: d6a70c102842e9493a3a7d8bab966ff84c5c189f4819a5ed9c7ffde0ca374f3f3afbb5229e13bdbf579c6f7240046b50e4eaf3a19be74c4b1664818a9489b42d
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.3)
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
 
@@ -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
@@ -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.3'
4
6
  end
5
7
  end
@@ -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.1
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: 2023-10-03 00:00:00.000000000 Z
11
+ date: 2024-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler