dns_adapter 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3506341cbfc07d85e3262c0d63babbb2a6c99b1d
4
- data.tar.gz: 112869d06cafd627e5ec1a60bfd4a739dd6a011d
3
+ metadata.gz: bb25bfecdff375e7d6abe98038656a500af985a4
4
+ data.tar.gz: 67e87217294a27c5710313ec79c08ffb4d8914cf
5
5
  SHA512:
6
- metadata.gz: 6db23681d6a5e687b9be426315d5f666f839f81d95db29570ff2b401760108d0811da361655e649b6e14e9dbfb228a5f9e5c41debea38030d15c2ab90dae0c22
7
- data.tar.gz: 0df0c0eb06854afb3c56a09231d0c26f006465028d12884b931a3b5d92ba7441366a992009bb9f98e51a444c483c243abdcba032dc6c747ee89c93dabdc83943
6
+ metadata.gz: 92c01fbc730c1239eb1bcf6a64f5c3185d77b15d9311a7d146c808bc59e95eda13cf04be8ae3a4b770f33427a9583cdbbba845a17907877090f5756ff402b9d0
7
+ data.tar.gz: e80b36bb31ff0e7d7e694baf630938f678e85fc075b2f7f5daa27c97de21b19a7ae6eecde3147755a56d549364700c5726bcd416a4b17be6505264d7f19821ff
@@ -97,21 +97,25 @@ module DNSAdapter
97
97
  records.map do |r|
98
98
  val = r[type]
99
99
  raise DNSAdapter::TimeoutError if val == TIMEOUT
100
- val = normalize_value(val, type)
101
- {
102
- type: type,
103
- RECORD_TYPE_TO_ATTR_NAME_MAP[type] => val
104
- }
100
+ value_to_hash(val, type).merge(type: type)
105
101
  end
106
102
  end
107
103
 
108
- def normalize_value(value, type)
104
+ def value_to_hash(value, type)
109
105
  if type == 'MX' && value.is_a?(Array)
110
- value.last
106
+ mx_hash(value)
111
107
  elsif (type == 'TXT' || type == 'SPF') && value.is_a?(Array)
112
- value.join('')
108
+ { text: value.join('') }
113
109
  else
114
- value
110
+ { RECORD_TYPE_TO_ATTR_NAME_MAP[type] => value }
111
+ end
112
+ end
113
+
114
+ def mx_hash(value)
115
+ if value.size > 1
116
+ { preference: value.first, exchange: value.last }
117
+ else
118
+ { exchange: value.last }
115
119
  end
116
120
  end
117
121
  end
@@ -17,6 +17,7 @@ module DNSAdapter
17
17
  {
18
18
  type: 'MX',
19
19
  exchange: record.exchange.to_s,
20
+ preference: record.preference,
20
21
  ttl: record.ttl
21
22
  }
22
23
  end
@@ -1,3 +1,3 @@
1
1
  module DNSAdapter
2
- VERSION = '0.0.7'.freeze
2
+ VERSION = '0.0.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dns_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter M. Goldstein
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-24 00:00:00.000000000 Z
11
+ date: 2016-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler