Permalink
Browse files

[zerigo|dns] Fixed the parser. TTL and priority values can be nil and…

… should not be coerced into integers in that case.
  • Loading branch information...
1 parent caf949a commit f5cb2ad8c2bc5cd1e5f0f76b3311ce707bf9a3b9 @nirvdrum nirvdrum committed Feb 10, 2012
@@ -11,8 +11,10 @@ def reset
def end_element(name)
case name
- when 'id', 'priority', 'ttl', 'zone-id'
+ when 'id', 'zone-id'
@response[name] = value.to_i
+ when 'priority', 'ttl'
+ @response[name] = value.to_i if value
when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at'
@response[name] = value
end
@@ -12,8 +12,10 @@ def reset
def end_element(name)
case name
- when 'id', 'priority', 'ttl', 'zone-id'
+ when 'id', 'zone-id'
@host[name] = value.to_i
+ when 'priority', 'ttl'
+ @host[name] = value.to_i if value
when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at'
@host[name] = value
when 'host'
@@ -11,8 +11,10 @@ def reset
def end_element(name)
case name
- when 'id', 'priority', 'ttl', 'zone-id'
+ when 'id', 'zone-id'
@response[name] = value.to_i
+ when 'priority', 'ttl'
+ @response[name] = value.to_i if value
when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at'
@response[name] = value
end
@@ -25,8 +25,10 @@ def end_element(name)
if (@in_hosts)
#in hosts part of response
case name
- when 'id', 'priority', 'ttl', 'zone-id'
+ when 'id', 'zone-id'
@host[name] = value.to_i
+ when 'priority', 'ttl'
+ @host[name] = value.to_i if value
when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at'
@host[name] = value
when 'host'
@@ -12,8 +12,10 @@ def reset
def end_element(name)
case name
- when 'id', 'priority', 'ttl', 'zone-id'
+ when 'id', 'zone-id'
@host[name] = value.to_i
+ when 'priority', 'ttl'
+ @host[name] = value.to_i if value
when 'data', 'fqdn', 'host-type', 'hostname', 'notes', 'zone-id', 'created-at', 'updated-at'
@host[name] = value
when 'host'

0 comments on commit f5cb2ad

Please sign in to comment.