diff --git a/Rakefile b/Rakefile index 7c8148a..8e972a7 100644 --- a/Rakefile +++ b/Rakefile @@ -119,7 +119,7 @@ spec = Gem::Specification.new do |s| s.author = 'Danny Coates' s.email = 'dcoates@podfitness.com' # s.executables = ['your_executable_here'] - s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*") + s.files = %w(GPL LICENSE README Rakefile) + Dir.glob("{bin,lib,spec}/**/*") s.require_path = "lib" s.bindir = "bin" end diff --git a/lib/response.rb b/lib/response.rb index fd99d30..a3852f5 100644 --- a/lib/response.rb +++ b/lib/response.rb @@ -17,8 +17,8 @@ class Response attr_reader :xml, :info def initialize(http_response) - @http_response = http_response - @xml = Document.new(@http_response.body) + #@http_response = http_response + @xml = Document.new(http_response.body) code = XPath.first(@xml, "//code").text if code.to_i > 0 msg = XPath.first(@xml, "//error/message").text @@ -26,9 +26,15 @@ def initialize(http_response) raise StandardError.new(msg) end Configuration.instance.logger.debug @xml.to_s - info_node = XPath.first(@xml, '//wc:info') - response_namespace = info_node.attribute('xmlns:wc').to_s - m = response_namespace.match(/urn\:com\.microsoft\.wc\.(.*)/) + begin + info_node = XPath.first(@xml, '//wc:info') + response_namespace = info_node.attribute('xmlns:wc').to_s + m = response_namespace.match(/urn\:com\.microsoft\.wc\.(.*)/) + rescue => e + Configuration.instance.logger.warn @xml + Configuration.instance.logger.warn e + m = nil + end if m.nil? @info = nil else @@ -39,7 +45,6 @@ def initialize(http_response) @info = nfo @info.parse_element(info_node) rescue => e - puts e Configuration.instance.logger.error e @info = nil end