1
0
Fork 0
mirror of https://github.com/jnunemaker/httparty synced 2023-03-27 23:23:07 -04:00

Added docs for exceptions and moved rexml fix into core extensions from /bin/httparty

This commit is contained in:
John Nunemaker 2009-01-30 23:23:47 -05:00
parent 37685a6540
commit e999ce11af
3 changed files with 24 additions and 21 deletions

View file

@ -73,27 +73,6 @@ if ARGV.empty?
STDERR.puts "USAGE: #{$0} [options] [url]"
end
# 1.8.6 has mistyping of transitive in if statement
module REXML #:nodoc:
class Document < Element
def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output)
output = Output.new( output, xml_decl.encoding )
end
formatter = if indent > -1
if transitive
REXML::Formatters::Transitive.new( indent, ie_hack )
else
REXML::Formatters::Pretty.new( indent, ie_hack )
end
else
REXML::Formatters::Default.new( ie_hack )
end
formatter.write( self, output )
end
end
end
if opts[:output_format].nil?
response = HTTParty.send(opts[:action], ARGV.first, opts)
puts "Status: #{response.code}"

View file

@ -351,3 +351,24 @@ end
class BlankSlate #:nodoc:
instance_methods.each { |m| undef_method m unless m =~ /^__/ }
end
# 1.8.6 has mistyping of transitive in if statement
module REXML #:nodoc:
class Document < Element #:nodoc:
def write( output=$stdout, indent=-1, transitive=false, ie_hack=false )
if xml_decl.encoding != "UTF-8" && !output.kind_of?(Output)
output = Output.new( output, xml_decl.encoding )
end
formatter = if indent > -1
if transitive
REXML::Formatters::Transitive.new( indent, ie_hack )
else
REXML::Formatters::Pretty.new( indent, ie_hack )
end
else
REXML::Formatters::Default.new( ie_hack )
end
formatter.write( self, output )
end
end
end

View file

@ -1,4 +1,7 @@
module HTTParty
# Exception raised when you attempt to set a non-existant format
class UnsupportedFormat < StandardError; end
# Exception that is raised when request has redirected too many times
class RedirectionTooDeep < StandardError; end
end