dennis-client 1.1.1 → 1.2.2

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: 4a1f20fe7792d9b35ebd46ef5534abce7aa58e95e0c6d426b8999d88a39d9080
4
- data.tar.gz: 26fb26887882aed7c9572e508267a48f9cf62179e3bfbe2c5d26a834f54d3ac8
3
+ metadata.gz: 61c18ed5fd0d210dced5c34b572748dca05080ab8877c8fdbc24f6e512506e7d
4
+ data.tar.gz: 90c52ebb6894248295fa8bf4ddb18895332187df0a323fcc9ecdabfbe6a5a229
5
5
  SHA512:
6
- metadata.gz: 94e51088eb391d0cbe4d0837fe95da4eafb601c9fd42ff0fa2db58727927094868dcab1bdaaa17b68f9f025a1fc5e0b043ca5b12d0d21933a45ce05181957544
7
- data.tar.gz: e28bc9ea027f5d667ba87a786b0a986595a20d31c064ccb12c6e870f009c51facbffa445b5fb65f911cab473af29fbd6cdff5521eba6356b4265cb9c531c095f
6
+ metadata.gz: 558621b5a497fafebde40ee5814970a5d509aab03bc814564ea57f91fd04e077af2307c26e90980ac6abe4f4228f18b08d356dd81770a72e3f33770ae2fbd93e
7
+ data.tar.gz: 73c1921e023f97853113f049e164b0a980efc4c9747079cdb2aed5fd1e8925ad66347e1d6f977f7af492365b26cf1adc398bd7303522ad4011025066f5d4102c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.2.2
data/lib/dennis/record.rb CHANGED
@@ -7,6 +7,10 @@ require 'dennis/zone_not_found_error'
7
7
  module Dennis
8
8
  class Record
9
9
 
10
+ IRREGULAR_RECORD_TYPE_NAMES = {
11
+ 'HTTPREDIRECT' => 'HTTPRedirect'
12
+ }.freeze
13
+
10
14
  class << self
11
15
 
12
16
  def all(client, zone, **options)
@@ -67,16 +71,24 @@ module Dennis
67
71
  type = hash[field_name] if field_name == :type && hash.key?(field_name)
68
72
  end
69
73
 
74
+ type = normalize_type(type)
75
+
70
76
  if hash.key?(:content)
71
77
  if type.nil?
72
78
  raise Error, 'Cannot generate record properties without a type'
73
79
  end
74
80
 
75
- arguments[:content] = { type.to_s.upcase => hash[:content] }
81
+ arguments[:content] = { type => hash[:content] }
76
82
  end
77
83
  arguments
78
84
  end
79
85
 
86
+ def normalize_type(type)
87
+ type = type.to_s.upcase
88
+ type = IRREGULAR_RECORD_TYPE_NAMES[type] if IRREGULAR_RECORD_TYPE_NAMES.key?(type)
89
+ type
90
+ end
91
+
80
92
  end
81
93
 
82
94
  def initialize(client, hash)
@@ -152,7 +164,7 @@ module Dennis
152
164
  def content
153
165
  return nil if type.nil?
154
166
 
155
- @hash.dig('content', type.to_s.upcase)&.transform_keys(&:to_sym)
167
+ @hash.dig('content', self.class.normalize_type(type))&.transform_keys(&:to_sym)
156
168
  end
157
169
 
158
170
  def update(properties)
data/lib/dennis/zone.rb CHANGED
@@ -94,6 +94,10 @@ module Dennis
94
94
  @hash['external_reference']
95
95
  end
96
96
 
97
+ def txt_record_verification_token
98
+ @hash['txt_record_verification_token']
99
+ end
100
+
97
101
  def nameservers_verified_at
98
102
  parse_time(@hash['nameservers_verified_at'])
99
103
  end
@@ -114,6 +118,10 @@ module Dennis
114
118
  @hash['always_verified']
115
119
  end
116
120
 
121
+ def verified_at
122
+ @hash['verified_at']
123
+ end
124
+
117
125
  def reverse_dns?
118
126
  @hash['reverse_dns']
119
127
  end
@@ -201,6 +209,17 @@ module Dennis
201
209
  true
202
210
  end
203
211
 
212
+ def verify
213
+ req = @client.api.create_request(:post, 'zones/:zone/verify')
214
+ req.arguments['zone'] = { id: id }
215
+ @hash = req.perform.hash['zone']
216
+ verified?
217
+ rescue ApiaClient::RequestError => e
218
+ raise unless e.code == 'zone_already_verified'
219
+
220
+ true
221
+ end
222
+
204
223
  private
205
224
 
206
225
  def parse_time(time)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dennis-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Cooke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-28 00:00:00.000000000 Z
11
+ date: 2024-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apia-client
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.1.6
70
+ rubygems_version: 3.5.22
71
71
  signing_key:
72
72
  specification_version: 4
73
73
  summary: A client library for talking to the Dennis DNS API.