dennis-client 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/dennis/record.rb +14 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5cc24c081e0f116f540b21297571db2085bd804ac7a02a0e47640ef67b98640
4
- data.tar.gz: 40d4ea9f6c15e24205cf7efe24102d21a45a49a904f06fd1aa2a6cdf3f947478
3
+ metadata.gz: 61c18ed5fd0d210dced5c34b572748dca05080ab8877c8fdbc24f6e512506e7d
4
+ data.tar.gz: 90c52ebb6894248295fa8bf4ddb18895332187df0a323fcc9ecdabfbe6a5a229
5
5
  SHA512:
6
- metadata.gz: 9de0679c724335d2e79b888bafea3923093c1e8496f1878e9b8c27ad78ef2d1b194a8d57ec3dfd8ea1159045cac513247eb4e1b4ce0e393b3b564dfb684f7a24
7
- data.tar.gz: 6a98a48071e3bf5afae1d82a0c1193fd6f5bf9da10116d0ef064b92fa3195bf0e10665fea57e8c36939885d4de3e8e55b809911e2f136fa5bfe0261348cc0697
6
+ metadata.gz: 558621b5a497fafebde40ee5814970a5d509aab03bc814564ea57f91fd04e077af2307c26e90980ac6abe4f4228f18b08d356dd81770a72e3f33770ae2fbd93e
7
+ data.tar.gz: 73c1921e023f97853113f049e164b0a980efc4c9747079cdb2aed5fd1e8925ad66347e1d6f977f7af492365b26cf1adc398bd7303522ad4011025066f5d4102c
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.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)
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.2.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: 2024-11-06 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