From 78f0c846d89ab53c3730b059aa75ae1ea53abb2b Mon Sep 17 00:00:00 2001 From: John Nunemaker Date: Mon, 5 Jan 2009 01:46:36 -0500 Subject: [PATCH] Prepped for 0.2.5 release. --- History | 4 ++++ bin/httparty | 29 +++++++++++++++++++++++++---- httparty.gemspec | 12 ++++++++---- lib/httparty/version.rb | 2 +- 4 files changed, 38 insertions(+), 9 deletions(-) diff --git a/History b/History index 6caa71a..37ca407 100644 --- a/History +++ b/History @@ -1,3 +1,7 @@ +== 0.2.5 2009-01-05 +* 1 major enhancement + * Add command line interface to HTTParty (Alex Vollmer) + == 0.2.4 2008-12-23 * 1 bug fix * Fixed that mimetype detection was failing if no mimetype was returned from service (skippy) diff --git a/bin/httparty b/bin/httparty index 078fc5e..d55e90f 100755 --- a/bin/httparty +++ b/bin/httparty @@ -59,17 +59,38 @@ if ARGV.empty? STDERR.puts "USAGE: #{$0} [options] [url]" end -response = HTTParty.send(opts[:action], ARGV.first, opts) +# 1.8.6 has mistyping of transitive in if statement +module REXML + 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 + +response = HTTParty.send(opts[:action], ARGV.first, opts.merge(:format => :plain)) if opts[:pretty_print] - response.delete('_body') pp response else case opts[:format] when :json - puts JSON.pretty_generate(response['_body']) + puts JSON.pretty_generate(JSON.parse(response)) when :xml - REXML::Document.new(response['_body']).write(STDOUT, 2) + REXML::Document.new(response).write(STDOUT, 2) + puts else puts response end diff --git a/httparty.gemspec b/httparty.gemspec index d0c978c..f2d99c5 100644 --- a/httparty.gemspec +++ b/httparty.gemspec @@ -1,14 +1,18 @@ +# -*- encoding: utf-8 -*- + Gem::Specification.new do |s| s.name = %q{httparty} - s.version = "0.2.4" + s.version = "0.2.5" s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version= s.authors = ["John Nunemaker"] - s.date = %q{2008-12-23} + s.date = %q{2009-01-05} + s.default_executable = %q{httparty} s.description = %q{Makes http fun! Also, makes consuming restful web services dead easy.} s.email = %q{nunemaker@gmail.com} - s.extra_rdoc_files = ["lib/core_extensions.rb", "lib/httparty/exceptions.rb", "lib/httparty/request.rb", "lib/httparty/version.rb", "lib/httparty.rb", "lib/module_level_inheritable_attributes.rb", "README"] - s.files = ["examples/aaws.rb", "examples/basic.rb", "examples/delicious.rb", "examples/google.rb", "examples/rubyurl.rb", "examples/twitter.rb", "examples/whoismyrep.rb", "History", "httparty.gemspec", "lib/core_extensions.rb", "lib/httparty/exceptions.rb", "lib/httparty/request.rb", "lib/httparty/version.rb", "lib/httparty.rb", "lib/module_level_inheritable_attributes.rb", "Manifest", "MIT-LICENSE", "Rakefile", "README", "setup.rb", "spec/as_buggery_spec.rb", "spec/fixtures/delicious.xml", "spec/fixtures/google.html", "spec/fixtures/twitter.json", "spec/fixtures/twitter.xml", "spec/httparty/request_spec.rb", "spec/httparty_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "website/css/common.css", "website/index.html"] + s.executables = ["httparty"] + s.extra_rdoc_files = ["bin/httparty", "lib/core_extensions.rb", "lib/httparty/exceptions.rb", "lib/httparty/request.rb", "lib/httparty/version.rb", "lib/httparty.rb", "lib/module_level_inheritable_attributes.rb", "README"] + s.files = ["bin/httparty", "examples/aaws.rb", "examples/basic.rb", "examples/delicious.rb", "examples/google.rb", "examples/rubyurl.rb", "examples/twitter.rb", "examples/whoismyrep.rb", "History", "httparty.gemspec", "lib/core_extensions.rb", "lib/httparty/exceptions.rb", "lib/httparty/request.rb", "lib/httparty/version.rb", "lib/httparty.rb", "lib/module_level_inheritable_attributes.rb", "Manifest", "MIT-LICENSE", "Rakefile", "README", "setup.rb", "spec/as_buggery_spec.rb", "spec/fixtures/delicious.xml", "spec/fixtures/google.html", "spec/fixtures/twitter.json", "spec/fixtures/twitter.xml", "spec/httparty/request_spec.rb", "spec/httparty_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "website/css/common.css", "website/index.html"] s.has_rdoc = true s.homepage = %q{http://httparty.rubyforge.org} s.post_install_message = %q{When you HTTParty, you must party hard!} diff --git a/lib/httparty/version.rb b/lib/httparty/version.rb index 43e9551..a5e7de7 100644 --- a/lib/httparty/version.rb +++ b/lib/httparty/version.rb @@ -1,3 +1,3 @@ module HTTParty - Version = '0.2.4' + Version = '0.2.5' end