Skip to content
Browse files

[node_list] clean some things up. normalize URLS

  • Loading branch information...
1 parent 107016e commit b78a55a1c3784a225b840973fc4796b9414190b9 @ChrisLundquist ChrisLundquist committed Nov 21, 2013
Showing with 8 additions and 4 deletions.
  1. +7 −3 lib/dynect_rest.rb
  2. +1 −1 lib/dynect_rest/resource.rb
View
10 lib/dynect_rest.rb
@@ -77,7 +77,9 @@ def logout
def node_list(zone=nil, fqdn=nil)
zone ||= @zone
resource = [zone,fqdn].compact.join("/")
- get("NodeList/#{resource}")
+ get("NodeList/#{resource}").each do |ref|
+ ref.sub!(/^\/REST\//,'')
+ end
end
# Get all the entries in a zone
@@ -89,7 +91,9 @@ def node_list(zone=nil, fqdn=nil)
def all_records(zone=nil, fqdn=nil)
zone ||= @zone
resource = [zone,fqdn].compact.join("/")
- get("AllRecord/#{resource}")
+ get("AllRecord/#{resource}").each do |ref|
+ ref.sub!(/^\/REST\//,'')
+ end
end
##
@@ -222,7 +226,7 @@ def api_request(&block)
puts "I have #{e.inspect} with #{e.http_code}"
end
if e.http_code == 307
- e.response.sub!('/REST/','') if e.response =~ /^\/REST\//
+ e.response.sub!(/^\/REST\//,'')
get(e.response)
end
e.response
View
2 lib/dynect_rest/resource.rb
@@ -133,7 +133,7 @@ def to_json
def method_missing(method_symbol, *args, &block)
method_string = method_symbol.to_s
- if (args.length > 0 && method_string !~ /=$/)
+ if (args.any? && method_string !~ /=$/)
@rdata[method_string] = args.length == 1 ? args[0] : args
self
elsif @rdata.has_key?(method_string)

0 comments on commit b78a55a

Please sign in to comment.
Something went wrong with that request. Please try again.