Module: Dynect

Defined in:
lib/dynect4r.rb

Defined Under Namespace

Classes: Client, DynectError, IllegalOperationError, InternalErrorError, InvalidDataError, InvalidRequestError, InvalidVersionError, Logger, MissingDataError, NotFoundError, OperationFailedError, OperationTimedOut, PermissionDeniedError, RedirectError, Response, ServiceUnavailableError, TargetExistsError, UnknownErrorError

Class Method Summary collapse

Class Method Details

.args_for_rtype(rtype, rdata) ⇒ Object

return a hash of arguments for the specified rtype



180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/dynect4r.rb', line 180

def args_for_rtype(rtype, rdata)

  arg_array = case rtype
  when 'A', 'AAAA'
    ['address']
  when 'CNAME'
    ['cname']
  when 'DNSKEY', 'KEY'
    ['flags', 'protocol', 'algorithm', 'public_key']
  when 'DS'
    ['keytag', 'algorithm', 'digtype', 'digest']
  when 'LOC'
    ['version', 'size', 'horiz_pre', 'vert_pre' 'latitude', 'longitude', 'altitude']
  when 'MX'
    ['preference', 'exchange']
  when 'NS'
    ['nsdname']
  when 'PTR'
    ['ptrdname']
  when 'RP'
    ['mbox', 'txtdname']
  when 'SOA'
    ['rname']
  when 'SRV'
    ['priority', 'weight', 'port', 'target']
  when 'TXT'
    ['txtdata']
  else
    []
  end

  if rtype == 'TXT'
    rdata = { arg_array[0] => rdata }
  else
    rdata.split.inject({}) { |memo,obj| memo[arg_array[memo.length]] = obj; memo }
  end
end

.rtype_to_resource(rtype) ⇒ Object

return the appropriate rest resource for the given rtype



175
176
177
# File 'lib/dynect4r.rb', line 175

def rtype_to_resource(rtype)
  rtype.upcase + 'Record'
end