diff --git a/Gemfile b/Gemfile
index 96c32f5..b088ce1 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,10 +1,16 @@
-source :gemcutter
+source :rubygems
-gem 'rake'
-gem 'heroku'
-gem 'sauce'
-gem 'launchy'
-gem 'httparty', :path => 'vendor/httparty'
+# This group is for vendoring changes for a "release"
+group :vendor do
+ gem 'httparty'
+end
+
+group :development do
+ gem 'rake'
+ gem 'heroku'
+ gem 'sauce'
+ gem 'launchy'
+end
group :test do
gem 'rspec'
diff --git a/Gemfile.deploy b/Gemfile.deploy
new file mode 100644
index 0000000..153a310
--- /dev/null
+++ b/Gemfile.deploy
@@ -0,0 +1,8 @@
+source :rubygems
+
+# This group is for vendoring changes for a "release"
+group :vendor do
+ gem 'httparty'
+end
+
+# vim: ft=ruby
diff --git a/Gemfile.deploy.lock b/Gemfile.deploy.lock
new file mode 100644
index 0000000..7c94879
--- /dev/null
+++ b/Gemfile.deploy.lock
@@ -0,0 +1,14 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ httparty (0.9.0)
+ multi_json (~> 1.0)
+ multi_xml
+ multi_json (1.4.0)
+ multi_xml (0.5.1)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ httparty
diff --git a/Rakefile b/Rakefile
index f4f2317..0016d29 100644
--- a/Rakefile
+++ b/Rakefile
@@ -7,3 +7,25 @@ RSpec::Core::RakeTask.new('spec') do |t|
end
Cucumber::Rake::Task.new('cucumber')
+
+
+BUNDLER_VARS = %w(BUNDLE_GEMFILE RUBYOPT GEM_HOME)
+ def with_clean_env
+ begin
+ bundled_env = ENV.to_hash
+ BUNDLER_VARS.each{ |var| ENV.delete(var) }
+ yield
+ ensure
+ ENV.replace(bundled_env.to_hash)
+ end
+ end
+
+namespace :gems do
+ desc 'Vendor the gems in Gemfile.deploy'
+ task :vendor do
+ with_clean_env do
+ sh 'bundle install --deployment --standalone=vendor --gemfile=Gemfile.deploy --path=vendor'
+ sh 'bundle install --no-deployment'
+ end
+ end
+end
diff --git a/init.rb b/init.rb
index 28a188c..db05daf 100644
--- a/init.rb
+++ b/init.rb
@@ -1 +1,2 @@
+require File.expand_path(File.dirname(__FILE__) + '/vendor/bundler/setup.rb')
require 'sauce/heroku/cli'
diff --git a/lib/sauce/heroku/cli.rb b/lib/sauce/heroku/cli.rb
index 6edffd9..1411739 100644
--- a/lib/sauce/heroku/cli.rb
+++ b/lib/sauce/heroku/cli.rb
@@ -1,7 +1,8 @@
require 'heroku'
require 'heroku/command/base'
require 'httparty'
-require 'sauce'
+require 'json'
+#require 'sauce'
require 'yaml'
module Heroku
diff --git a/vendor/bundler/setup.rb b/vendor/bundler/setup.rb
new file mode 100644
index 0000000..829184f
--- /dev/null
+++ b/vendor/bundler/setup.rb
@@ -0,0 +1,4 @@
+path = File.expand_path('..', __FILE__)
+$:.unshift File.expand_path("#{path}/../ruby/1.9.1/gems/multi_json-1.4.0/lib")
+$:.unshift File.expand_path("#{path}/../ruby/1.9.1/gems/multi_xml-0.5.1/lib")
+$:.unshift File.expand_path("#{path}/../ruby/1.9.1/gems/httparty-0.9.0/lib")
diff --git a/vendor/ruby/1.9.1/bin/httparty b/vendor/ruby/1.9.1/bin/httparty
new file mode 100755
index 0000000..7c671f5
--- /dev/null
+++ b/vendor/ruby/1.9.1/bin/httparty
@@ -0,0 +1,19 @@
+#!/usr/bin/env ruby
+#
+# This file was generated by RubyGems.
+#
+# The application 'httparty' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require 'rubygems'
+
+version = ">= 0"
+
+if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
+ version = $1
+ ARGV.shift
+end
+
+gem 'httparty', version
+load Gem.bin_path('httparty', 'httparty', version)
diff --git a/vendor/ruby/1.9.1/cache/httparty-0.9.0.gem b/vendor/ruby/1.9.1/cache/httparty-0.9.0.gem
new file mode 100644
index 0000000..62f851d
Binary files /dev/null and b/vendor/ruby/1.9.1/cache/httparty-0.9.0.gem differ
diff --git a/vendor/ruby/1.9.1/cache/multi_json-1.4.0.gem b/vendor/ruby/1.9.1/cache/multi_json-1.4.0.gem
new file mode 100644
index 0000000..b5709ff
Binary files /dev/null and b/vendor/ruby/1.9.1/cache/multi_json-1.4.0.gem differ
diff --git a/vendor/ruby/1.9.1/cache/multi_xml-0.5.1.gem b/vendor/ruby/1.9.1/cache/multi_xml-0.5.1.gem
new file mode 100644
index 0000000..27d7aa8
Binary files /dev/null and b/vendor/ruby/1.9.1/cache/multi_xml-0.5.1.gem differ
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/.gitignore b/vendor/ruby/1.9.1/gems/httparty-0.9.0/.gitignore
new file mode 100644
index 0000000..24953a8
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/.gitignore
@@ -0,0 +1,10 @@
+Gemfile.lock
+.DS_Store
+.yardoc/
+doc/
+tmp/
+log/
+pkg/
+*.swp
+/.bundle
+.rvmrc
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/.travis.yml b/vendor/ruby/1.9.1/gems/httparty-0.9.0/.travis.yml
new file mode 100644
index 0000000..5d2b2c2
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/.travis.yml
@@ -0,0 +1,8 @@
+language: ruby
+rvm:
+ - 1.8.7
+ - ree
+ - 1.9.3
+notifications:
+ email: false
+bundler_args: --without development
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/Gemfile b/vendor/ruby/1.9.1/gems/httparty-0.9.0/Gemfile
new file mode 100644
index 0000000..0918e93
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/Gemfile
@@ -0,0 +1,15 @@
+source :rubygems
+gemspec
+
+gem 'rake'
+gem 'cucumber', '~> 0.7'
+gem 'fakeweb', '~> 1.2'
+gem 'rspec', '~> 1.3'
+gem 'mongrel', '1.2.0.pre2'
+gem 'multi_json', '~> 1.3'
+
+group :development do
+ gem 'guard'
+ gem 'guard-rspec'
+ gem 'guard-bundler'
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/Guardfile b/vendor/ruby/1.9.1/gems/httparty-0.9.0/Guardfile
new file mode 100644
index 0000000..fdb6013
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/Guardfile
@@ -0,0 +1,16 @@
+rspec_options = {
+ :version => 1,
+ :all_after_pass => false,
+ :all_on_start => false,
+}
+
+guard 'rspec', rspec_options do
+ watch(%r{^spec/.+_spec\.rb$})
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
+ watch('spec/spec_helper.rb') { "spec" }
+end
+
+guard 'bundler' do
+ watch('Gemfile')
+ watch(/^.+\.gemspec/)
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/History b/vendor/ruby/1.9.1/gems/httparty-0.9.0/History
new file mode 100644
index 0000000..09c2049
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/History
@@ -0,0 +1,293 @@
+== 0.9.0 2012-09-07
+* new
+ * [support for connection adapters](https://github.com/jnunemaker/httparty/pull/157)
+ * [allow ssl_version on ruby 1.9](https://github.com/jnunemaker/httparty/pull/159)
+
+* bug fixes
+ * [don't treat port 4430 as ssl](https://github.com/jnunemaker/httparty/commit/a296b1c97f83d7dcc6ef85720a43664c265685ac)
+ * [deep clone default options](https://github.com/jnunemaker/httparty/commit/f74227d30f9389b4b23a888c9af49fb9b8248e1f)
+ * a few net digest auth fixes
+
+== 0.8.3 2012-04-21
+* new
+ * [lazy parsing of responses](https://github.com/jnunemaker/httparty/commit/9fd5259c8dab00e426082b66af44ede2c9068f45)
+ * [add support for PATCH requests](https://github.com/jnunemaker/httparty/commit/7ab6641e37a9e31517e46f6124f38c615395d38a)
+* bug fixes
+ * [subclasses no longer override superclass options](https://github.com/jnunemaker/httparty/commit/682af8fbf672e7b3009e650da776c85cdfe78d39)
+
+== 0.8.2 2012-04-12
+* new
+ * add -r to make CLI return failure code if status >= 400
+ * allow blank username from CLI
+* bug fixes
+ * return nil for null body
+ * automatically deflate responses with a Content-Encoding: x-gzip header
+ * Do not HEAD on POST request with digest authentication
+ * add support for proxy authentication
+ * fix posting data with CLI
+ * require rexml/document if xml format from CLI
+ * support for fragmented responses
+
+== 0.8.1 2011-10-05
+* bug fixes
+ * content-encoding header should be removed when automatically inflating the body
+
+== 0.8.0 2011-09-13
+* new
+ * switch to multi json/xml for parsing by default
+* bug fixes
+ * fix redirects to relative uri's
+
+== 0.7.8 2011-06-06
+* bug fix
+ * Make response honor respond to
+ * net http timeout can also be a float
+
+== 0.7.7 2011-04-16
+* bug fix
+ * Fix NoMethodError when using the NON_RAILS_QUERY_STRING_NORMALIZER with a hash whose key is a symbol and value is nil
+
+== 0.7.5 2011-04-16
+* bug fix
+ * caused issue with latest rubygems
+
+== 0.7.4 2011-02-13
+* bug fixes
+ * Set VERIFY_NONE when using https. Ruby 1.9.2 no longer sets this for us. gh-67
+
+== 0.7.3 2011-01-20
+* bug fixes
+ * Fix digest auth for unspecified quality of protection (bjoernalbers, mtrudel, dwo)
+
+== 0.7.2 2011-01-20
+* bug fixes
+ * Fix gem dependencies
+
+== 0.7.1 2011-01-19
+* bug fixes
+ * Fix uninitialized constant HTTParty::Response::Net in 1.9.2 (cap10morgan)
+ * Other fixes for 1.9.2, full suite still fails (cap10morgan)
+
+== 0.7.0 2011-01-18
+* minor enhancements
+ * Added query methods for HTTP status codes, i.e. response.success?
+ response.created? (thanks citizenparker)
+ * Added support for ssl_ca_file and ssl_ca_path (dlitz)
+ * Allow custom query string normalization. gh-8
+ * Unlock private keys with password (freerange)
+ * Added high level request documentation (phildarnowsky)
+ * Added basic post example (pbuckley)
+ * Response object has access to its corresponding request object
+ * Added example of siginin into tripit.com
+ * Added option to follow redirects (rkj). gh-56
+* bug fixes
+ * Fixed superclass mismatch exception while running tests
+ (thanks dlitz http://github.com/dlitz/httparty/commit/48224f0615b32133afcff4718ad426df7a4b401b)
+
+== 0.6.1 2010-07-07
+* minor enhancements
+ * updated to crack 0.1.8
+* bug fixes
+ * subclasses always merge into the parent's default_options and
+ default_cookies (l4rk).
+ * subclasses play nicely with grand parents. gh-49
+
+== 0.6.0 2010-06-13
+* major enhancements
+ * Digest Auth (bartiaco, sbecker, gilles, and aaronrussell)
+ * Maintain HTTP method across redirects (bartiaco and sbecker)
+ * HTTParty::Response#response returns the Net::HTTPResponse object
+ * HTTParty::Response#headers returns a HTTParty::Response::Headers object
+ which quacks like a Hash + Net::HTTPHeader. The #headers method continues
+ to be backwards-compatible with the old Hash return value but may become
+ deprecated in the future.
+
+* minor enhancements
+ * Update crack requirement to version 0.1.7
+ You may still get a warning because Crack's version constant is out of date
+ * Timeout option can be set for all requests using HTTParty.default_timeout (taazza)
+ * Closed #38 "headers hash should downcase keys so canonical header name can be used"
+ * Closed #40 "Gzip response" wherein gziped and deflated responses are
+ automatically inflated. (carsonmcdonald)
+
+== 0.5.2 2010-01-31
+* minor enhancements
+ * Update crack requirement to version 0.1.6
+
+== 0.5.1 2010-01-30
+* bug fixes
+ * Handle 304 response correctly by returning the HTTParty::Response object instead of redirecting (seth and hellvinz)
+ * Only redirect 300 responses if the header contains a Location
+ * Don't append empty query strings to the uri. Closes #31
+ * When no_follow is enabled, only raise the RedirectionTooDeep exception when a response tries redirecting. Closes #28
+
+* major enhancements
+ * Removed rubygems dependency. I suggest adding rubygems to RUBYOPT if this causes problems for you.
+ $ export RUBYOPT='rubygems'
+ * HTTParty#debug_output prints debugging information for the current request (iwarshak)
+ * HTTParty#no_follow now available as a class-level option. Sets whether or not to follow redirects.
+
+* minor enhancements
+ * HTTParty::VERSION now available
+ * Update crack requirement to version 0.1.5
+
+== 0.5.0 2009-12-07
+* bug fixes
+ * inheritable attributes no longer mutable by subclasses (yyyc514)
+ * namespace BasicObject within HTTParty to avoid class name collisions (eric)
+
+* major enhancements
+ * Custom Parsers via class or proc
+ * Deprecation warning on HTTParty::AllowedFormats
+ moved to HTTParty::Parser::SupportedFormats
+
+* minor enhancements
+ * Curl inspired output when using the binary in verbose mode (alexvollmer)
+ * raise UnsupportedURIScheme when scheme is not HTTP or HTTPS (djspinmonkey)
+ * Allow SSL for ports other than 443 when scheme is HTTPS (stefankroes)
+ * Accept PEM certificates via HTTParty#pem (chrislo)
+ * Support HEAD and OPTION verbs (grempe)
+ * Verify SSL certificates when providing a PEM file (collectiveidea/danielmorrison)
+
+== 0.4.5 2009-09-12
+* bug fixes
+ * Fixed class-level headers overwritten by cookie management code. Closes #19
+ * Fixed "superclass mismatch for class BlankSlate" error. Closes #20
+ * Fixed reading files as post data from the command line (vesan)
+
+* minor enhancements
+ * Timeout option added; will raise a Timeout::Error after the timeout has elapsed (attack). Closes #17
+ HTTParty.get "http://github.com", :timeout => 1
+ * Building gem with Jeweler
+
+== 0.4.4 2009-07-19
+* 2 minor update
+ * :query no longer sets form data. Use body and set content type to application/x-www-form-urlencoded if you need it. :query was wrong for that.
+ * Fixed a bug in the cookies class method that caused cookies to be forgotten after the first request.
+ * Also, some general cleanup of tests and such.
+
+== 0.4.3 2009-04-23
+* 1 minor update
+ * added message to the response object
+
+== 0.4.2 2009-03-30
+* 2 minor changes
+ * response code now returns an integer instead of a string (jqr)
+ * rubyforge project setup for crack so i'm now depending on that instead of jnunemaker-crack
+
+== 0.4.1 2009-03-29
+* 1 minor fix
+ * gem 'jnunemaker-crack' instead of gem 'crack'
+
+== 0.4.0 2009-03-29
+* 1 minor change
+ * Switched xml and json parsing to crack (same code as before just moved to gem for easier reuse in other projects)
+
+== 0.3.1 2009-02-10
+* 1 minor fix, 1 minor enhancement
+ * Fixed unescaping umlauts (siebertm)
+ * Added yaml response parsing (Miha Filej)
+
+== 0.3.0 2009-01-31
+* 1 major enhancement, 1 bug fix
+ * JSON gem no longer a requirement. It was conflicting with rails json stuff so I just stole ActiveSupport's json decoding and bundled it with HTTParty.
+ * Fixed bug where query strings were being duplicated on redirects
+ * Added a bunch of specs and moved some code around.
+
+== 0.2.10 2009-01-29
+* 1 minor enhancement
+ * Made encoding on query parameters treat everything except URI::PATTERN::UNRESERVED as UNSAFE to force encoding of '+' character (Julian Russell)
+
+== 0.2.9 2009-01-29
+* 3 minor enhancements
+ * Added a 'headers' accessor to the response with a hash of any HTTP headers. (Don Peterson)
+ * Add support for a ":cookies" option to be used at the class level, or as an option on any individual call. It should be passed a hash, which will be converted to the proper format and added to the request headers when the call is made. (Don Peterson)
+ * Refactored several specs and added a full suite of cucumber features (Don Peterson)
+
+== 0.2.8 2009-01-28
+* 1 major fix
+ * fixed major bug with response where it wouldn't iterate or really work at all with parsed responses
+
+== 0.2.7 2009-01-28
+* 2 minor fixes, 2 minor enhancements, 2 major enhancements
+ * fixed undefined method add_node for nil class error that occasionally happened (juliocesar)
+ * Handle nil or unexpected values better when typecasting. (Brian Landau)
+ * More robust handling of mime types (Alex Vollmer)
+ * Fixed support for specifying headers and added support for basic auth to CLI. (Alex Vollmer)
+ * Added first class response object that includes original body and status code (Alex Vollmer)
+ * Now parsing all response types as some non-200 responses provide important information, this means no more exception raising (Alex Vollmer)
+
+== 0.2.6 2009-01-05
+* 1 minor bug fix
+ * added explicit require of time as Time#parse failed outside of rails (willcodeforfoo)
+
+== 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)
+== 0.2.3 2008-12-23
+* 1 bug fix
+ * Fixed typecasting class variable naming issue
+
+== 0.2.2 2008-12-08
+* 1 bug fix
+ * Added the missing core extension hash method to_xml_attributes
+
+== 0.2.1 2008-12-08
+* 1 bug fix
+ * Fixed that HTTParty was borking ActiveSupport and as such Rails (thanks to Rob Sanheim)
+
+== 0.2.0 2008-12-07
+* 1 major enhancement
+ * Removed ActiveSupport as a dependency. Now requires json gem for json deserialization and uses an included class to do the xml parsing.
+
+== 0.1.8 2008-11-30
+* 3 major enhancements
+ * Moved base_uri normalization into request class and out of httparty module, fixing
+ the problem where base_uri was not always being normalized.
+ * Stupid simple support for HTTParty.get/post/put/delete. (jqr)
+ * Switched gem management to Echoe from newgem.
+
+== 0.1.7 2008-11-30
+* 1 major enhancement
+ * fixed multiple class definitions overriding each others options
+
+== 0.1.6 2008-11-26
+* 1 major enhancement
+ * now passing :query to set_form_data if post request to avoid content length errors
+
+== 0.1.5 2008-11-14
+* 2 major enhancements
+ * Refactored send request method out into its own object.
+ * Added :html format if you just want to do that.
+
+== 0.1.4 2008-11-08
+* 3 major enhancements:
+ * Removed some cruft
+ * Added ability to follow redirects automatically and turn that off (Alex Vollmer)
+
+== 0.1.3 2008-08-22
+
+* 3 major enhancements:
+ * Added http_proxy key for setting proxy server and port (francxk@gmail.com)
+ * Now raises exception when http error occurs (francxk@gmail.com)
+ * Changed auto format detection from file extension to response content type (Jay Pignata)
+
+== 0.1.2 2008-08-09
+
+* 1 major enhancement:
+ * default_params were not being appended to query string if option[:query] was blank
+
+== 0.1.1 2008-07-30
+
+* 2 major enhancement:
+ * Added :basic_auth key for options when making a request
+ * :query and :body both now work with query string or hash
+
+== 0.1.0 2008-07-27
+
+* 1 major enhancement:
+ * Initial release
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/MIT-LICENSE b/vendor/ruby/1.9.1/gems/httparty-0.9.0/MIT-LICENSE
new file mode 100644
index 0000000..ea4d340
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2008 John Nunemaker
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/README.md b/vendor/ruby/1.9.1/gems/httparty-0.9.0/README.md
new file mode 100644
index 0000000..3a0fb71
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/README.md
@@ -0,0 +1,79 @@
+# httparty
+
+Makes http fun again!
+
+## Install
+
+```
+gem install httparty
+```
+
+## Requirements
+
+* multi_json and multi_xml
+* You like to party!
+
+## Examples
+
+```ruby
+# Use the class methods to get down to business quickly
+response = HTTParty.get('http://twitter.com/statuses/public_timeline.json')
+puts response.body, response.code, response.message, response.headers.inspect
+
+response.each do |item|
+ puts item['user']['screen_name']
+end
+
+# Or wrap things up in your own class
+class Twitter
+ include HTTParty
+ base_uri 'twitter.com'
+
+ def initialize(u, p)
+ @auth = {:username => u, :password => p}
+ end
+
+ # which can be :friends, :user or :public
+ # options[:query] can be things like since, since_id, count, etc.
+ def timeline(which=:friends, options={})
+ options.merge!({:basic_auth => @auth})
+ self.class.get("/statuses/#{which}_timeline.json", options)
+ end
+
+ def post(text)
+ options = { :body => {:status => text}, :basic_auth => @auth }
+ self.class.post('/statuses/update.json', options)
+ end
+end
+
+twitter = Twitter.new(config['email'], config['password'])
+pp twitter.timeline
+```
+
+See the [examples directory](http://github.com/jnunemaker/httparty/tree/master/examples) for even more goodies.
+
+## Command Line Interface
+
+httparty also includes the executable `httparty` which can be
+used to query web services and examine the resulting output. By default
+it will output the response as a pretty-printed Ruby object (useful for
+grokking the structure of output). This can also be overridden to output
+formatted XML or JSON. Execute `httparty --help` for all the
+options. Below is an example of how easy it is.
+
+```
+httparty "http://twitter.com/statuses/public_timeline.json"
+```
+
+## Help and Docs
+
+* https://groups.google.com/forum/#!forum/httparty-gem
+* http://rdoc.info/projects/jnunemaker/httparty
+
+## Contributing
+
+* Fork the project.
+* Make your feature addition or bug fix.
+* Add tests for it. This is important so I don't break it in a future version unintentionally.
+* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself in another branch so I can ignore when I pull)
+* Send me a pull request. Bonus points for topic branches.
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/Rakefile b/vendor/ruby/1.9.1/gems/httparty-0.9.0/Rakefile
new file mode 100644
index 0000000..1cf504b
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/Rakefile
@@ -0,0 +1,15 @@
+require 'bundler'
+Bundler::GemHelper.install_tasks
+
+require 'spec/rake/spectask'
+Spec::Rake::SpecTask.new(:spec) do |spec|
+ spec.ruby_opts << '-rubygems'
+ spec.libs << 'lib' << 'spec'
+ spec.spec_files = FileList['spec/**/*_spec.rb']
+ spec.spec_opts = ['--options', 'spec/spec.opts']
+end
+
+require 'cucumber/rake/task'
+Cucumber::Rake::Task.new(:features)
+
+task :default => [:spec, :features]
\ No newline at end of file
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/bin/httparty b/vendor/ruby/1.9.1/gems/httparty-0.9.0/bin/httparty
new file mode 100755
index 0000000..dbbfd0a
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/bin/httparty
@@ -0,0 +1,114 @@
+#!/usr/bin/env ruby
+
+require "optparse"
+require "pp"
+
+$:.unshift(File.join(File.dirname(__FILE__), "/../lib"))
+require "httparty"
+
+opts = {
+ :action => :get,
+ :headers => {},
+ :verbose => false
+}
+
+OptionParser.new do |o|
+ o.banner = "USAGE: #{$0} [options] [url]"
+
+ o.on("-f",
+ "--format [FORMAT]",
+ "Output format to use instead of pretty-print ruby: " +
+ "plain, json or xml") do |f|
+ opts[:output_format] = f.downcase.to_sym
+ end
+
+ o.on("-a",
+ "--action [ACTION]",
+ "HTTP action: get (default), post, put, delete, head, or options") do |a|
+ opts[:action] = a.downcase.to_sym
+ end
+
+ o.on("-d",
+ "--data [BODY]",
+ "Data to put in request body (prefix with '@' for file)") do |d|
+ if d =~ /^@/
+ opts[:body] = open(d[1..-1]).read
+ else
+ opts[:body] = d
+ end
+ end
+
+ o.on("-H", "--header [NAME:VALUE]", "Additional HTTP headers in NAME:VALUE form") do |h|
+ abort "Invalid header specification, should be Name:Value" unless h =~ /.+:.+/
+ name, value = h.split(':')
+ opts[:headers][name.strip] = value.strip
+ end
+
+ o.on("-v", "--verbose", "If set, print verbose output") do |v|
+ opts[:verbose] = true
+ end
+
+ o.on("-u", "--user [CREDS]", "Use basic authentication. Value should be user:password") do |u|
+ abort "Invalid credentials format. Must be user:password" unless u =~ /.*:.+/
+ user, password = u.split(':')
+ opts[:basic_auth] = { :username => user, :password => password }
+ end
+
+ o.on("-r", "--response-code", "Command fails if response code >= 400") do
+ opts[:response_code] = true
+ end
+
+ o.on("-h", "--help", "Show help documentation") do |h|
+ puts o
+ exit
+ end
+end.parse!
+
+
+if ARGV.empty?
+ STDERR.puts "You need to provide a URL"
+ STDERR.puts "USAGE: #{$0} [options] [url]"
+end
+
+def dump_headers(response)
+ resp_type = Net::HTTPResponse::CODE_TO_OBJ[response.code.to_s]
+ puts "#{response.code} #{resp_type.to_s.sub(/^Net::HTTP/, '')}"
+ response.headers.each do |n,v|
+ puts "#{n}: #{v}"
+ end
+ puts
+end
+
+if opts[:verbose]
+ puts "#{opts[:action].to_s.upcase} #{ARGV.first}"
+ opts[:headers].each do |n,v|
+ puts "#{n}: #{v}"
+ end
+ puts
+end
+
+response = HTTParty.send(opts[:action], ARGV.first, opts)
+if opts[:output_format].nil?
+ dump_headers(response) if opts[:verbose]
+ pp response
+else
+ print_format = opts[:output_format]
+ dump_headers(response) if opts[:verbose]
+
+ case opts[:output_format]
+ when :json
+ begin
+ require 'json'
+ puts JSON.pretty_generate(response.delegate)
+ rescue LoadError
+ puts YAML.dump(response.delegate)
+ end
+ when :xml
+ require 'rexml/document'
+ REXML::Document.new(response.body).write(STDOUT, 2)
+ puts
+ else
+ puts response
+ end
+end
+exit false if opts[:response_code] && response.code >= 400
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/cucumber.yml b/vendor/ruby/1.9.1/gems/httparty-0.9.0/cucumber.yml
new file mode 100644
index 0000000..80df8ac
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/cucumber.yml
@@ -0,0 +1 @@
+default: features --format progress
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/aaws.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/aaws.rb
new file mode 100644
index 0000000..a1f4fb2
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/aaws.rb
@@ -0,0 +1,32 @@
+require 'rubygems'
+require 'active_support'
+
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+config = YAML::load(File.read(File.join(ENV['HOME'], '.aaws')))
+
+module AAWS
+ class Book
+ include HTTParty
+ base_uri 'http://ecs.amazonaws.com'
+ default_params :Service => 'AWSECommerceService', :Operation => 'ItemSearch', :SearchIndex => 'Books'
+
+ def initialize(key)
+ self.class.default_params :AWSAccessKeyId => key
+ end
+
+ def search(options={})
+ raise ArgumentError, 'You must search for something' if options[:query].blank?
+
+ # amazon uses nasty camelized query params
+ options[:query] = options[:query].inject({}) { |h, q| h[q[0].to_s.camelize] = q[1]; h }
+
+ # make a request and return the items (NOTE: this doesn't handle errors at this point)
+ self.class.get('/onca/xml', options)['ItemSearchResponse']['Items']
+ end
+ end
+end
+
+aaws = AAWS::Book.new(config[:access_key])
+pp aaws.search(:query => {:title => 'Ruby On Rails'})
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/basic.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/basic.rb
new file mode 100644
index 0000000..d813795
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/basic.rb
@@ -0,0 +1,32 @@
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+
+# You can also use post, put, delete, head, options in the same fashion
+response = HTTParty.get('http://twitter.com/statuses/public_timeline.json')
+puts response.body, response.code, response.message, response.headers.inspect
+
+response.each do |item|
+ puts item['user']['screen_name']
+end
+
+# An example post to a minimal rails app in the development environment
+# Note that "skip_before_filter :verify_authenticity_token" must be set in the
+# "pears" controller for this example
+
+class Partay
+ include HTTParty
+ base_uri 'http://localhost:3000'
+end
+
+options = {
+ :body => {
+ :pear => { # your resource
+ :foo => '123', # your columns/data
+ :bar => 'second',
+ :baz => 'last thing'
+ }
+ }
+}
+
+pp Partay.post('/pears.xml', options)
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/crack.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/crack.rb
new file mode 100644
index 0000000..63a2aaf
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/crack.rb
@@ -0,0 +1,19 @@
+require 'rubygems'
+require 'crack'
+
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+
+class Rep
+ include HTTParty
+
+ parser(
+ Proc.new do |body, format|
+ Crack::XML.parse(body)
+ end
+ )
+end
+
+pp Rep.get('http://whoismyrepresentative.com/whoismyrep.php?zip=46544')
+pp Rep.get('http://whoismyrepresentative.com/whoismyrep.php', :query => {:zip => 46544})
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/custom_parsers.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/custom_parsers.rb
new file mode 100644
index 0000000..3a91813
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/custom_parsers.rb
@@ -0,0 +1,67 @@
+class ParseAtom
+ include HTTParty
+
+ # Support Atom along with the default parsers: xml, json, yaml, etc.
+ class Parser::Atom < HTTParty::Parser
+ SupportedFormats.merge!({"application/atom+xml" => :atom})
+
+ protected
+
+ # perform atom parsing on body
+ def atom
+ body.to_atom
+ end
+ end
+
+ parser Parser::Atom
+end
+
+
+class OnlyParseAtom
+ include HTTParty
+
+ # Only support Atom
+ class Parser::OnlyAtom < HTTParty::Parser
+ SupportedFormats = {"application/atom+xml" => :atom}
+
+ protected
+
+ # perform atom parsing on body
+ def atom
+ body.to_atom
+ end
+ end
+
+ parser Parser::OnlyAtom
+end
+
+
+class SkipParsing
+ include HTTParty
+
+ # Parse the response body however you like
+ class Parser::Simple < HTTParty::Parser
+ def parse
+ body
+ end
+ end
+
+ parser Parser::Simple
+end
+
+
+class AdHocParsing
+ include HTTParty
+ parser(
+ Proc.new do |body, format|
+ case format
+ when :json
+ body.to_json
+ when :xml
+ body.to_xml
+ else
+ body
+ end
+ end
+ )
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/delicious.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/delicious.rb
new file mode 100644
index 0000000..e6d6243
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/delicious.rb
@@ -0,0 +1,37 @@
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+config = YAML::load(File.read(File.join(ENV['HOME'], '.delicious')))
+
+class Delicious
+ include HTTParty
+ base_uri 'https://api.del.icio.us/v1'
+
+ def initialize(u, p)
+ @auth = {:username => u, :password => p}
+ end
+
+ # query params that filter the posts are:
+ # tag (optional). Filter by this tag.
+ # dt (optional). Filter by this date (CCYY-MM-DDThh:mm:ssZ).
+ # url (optional). Filter by this url.
+ # ie: posts(:query => {:tag => 'ruby'})
+ def posts(options={})
+ options.merge!({:basic_auth => @auth})
+ self.class.get('/posts/get', options)
+ end
+
+ # query params that filter the posts are:
+ # tag (optional). Filter by this tag.
+ # count (optional). Number of items to retrieve (Default:15, Maximum:100).
+ def recent(options={})
+ options.merge!({:basic_auth => @auth})
+ self.class.get('/posts/recent', options)
+ end
+end
+
+delicious = Delicious.new(config['username'], config['password'])
+pp delicious.posts(:query => {:tag => 'ruby'})
+pp delicious.recent
+
+delicious.recent['posts']['post'].each { |post| puts post['href'] }
\ No newline at end of file
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/google.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/google.rb
new file mode 100644
index 0000000..f629b4d
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/google.rb
@@ -0,0 +1,16 @@
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+
+class Google
+ include HTTParty
+ format :html
+end
+
+# google.com redirects to www.google.com so this is live test for redirection
+pp Google.get('http://google.com')
+
+puts '', '*'*70, ''
+
+# check that ssl is requesting right
+pp Google.get('https://www.google.com')
\ No newline at end of file
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/headers_and_user_agents.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/headers_and_user_agents.rb
new file mode 100644
index 0000000..8e55aff
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/headers_and_user_agents.rb
@@ -0,0 +1,6 @@
+# To send custom user agents to identify your application to a web service (or mask as a specific browser for testing), send "User-Agent" as a hash to headers as shown below.
+
+require 'httparty'
+
+APPLICATION_NAME = "Httparty"
+response = HTTParty.get('http://example.com', :headers => {"User-Agent" => APPLICATION_NAME})
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/nokogiri_html_parser.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/nokogiri_html_parser.rb
new file mode 100644
index 0000000..b45a2b8
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/nokogiri_html_parser.rb
@@ -0,0 +1,22 @@
+require 'rubygems'
+require 'nokogiri'
+
+
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+
+class HtmlParserIncluded < HTTParty::Parser
+ SupportedFormats.merge!('text/html' => :html)
+
+ def html
+ Nokogiri::HTML(body)
+ end
+end
+
+class Page
+ include HTTParty
+ parser HtmlParserIncluded
+end
+
+pp Page.get('http://www.google.com')
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/rubyurl.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/rubyurl.rb
new file mode 100644
index 0000000..65808fb
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/rubyurl.rb
@@ -0,0 +1,14 @@
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+
+class Rubyurl
+ include HTTParty
+ base_uri 'rubyurl.com'
+
+ def self.shorten( website_url )
+ post( '/api/links.json', :query => { :link => { :website_url => website_url } } )
+ end
+end
+
+pp Rubyurl.shorten( 'http://istwitterdown.com/')
\ No newline at end of file
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/tripit_sign_in.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/tripit_sign_in.rb
new file mode 100644
index 0000000..f06617d
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/tripit_sign_in.rb
@@ -0,0 +1,33 @@
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+
+class TripIt
+ include HTTParty
+ base_uri 'http://www.tripit.com'
+ debug_output
+
+ def initialize(email, password)
+ @email = email
+ response = self.class.get('/account/login')
+ response = self.class.post(
+ '/account/login',
+ :body => {
+ :login_email_address => email,
+ :login_password => password
+ },
+ :headers => {'Cookie' => response.headers['Set-Cookie']}
+ )
+ @cookie = response.request.options[:headers]['Cookie']
+ end
+
+ def account_settings
+ self.class.get('/account/edit', :headers => {'Cookie' => @cookie})
+ end
+
+ def logged_in?
+ account_settings.include? "You're logged in as #{@email}"
+ end
+end
+
+tripit = TripIt.new('email', 'password')
+puts "Logged in: #{tripit.logged_in?}"
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/twitter.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/twitter.rb
new file mode 100644
index 0000000..c7794fa
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/twitter.rb
@@ -0,0 +1,31 @@
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+config = YAML::load(File.read(File.join(ENV['HOME'], '.twitter')))
+
+class Twitter
+ include HTTParty
+ base_uri 'twitter.com'
+
+ def initialize(u, p)
+ @auth = {:username => u, :password => p}
+ end
+
+ # which can be :friends, :user or :public
+ # options[:query] can be things like since, since_id, count, etc.
+ def timeline(which=:friends, options={})
+ options.merge!({:basic_auth => @auth})
+ self.class.get("/statuses/#{which}_timeline.json", options)
+ end
+
+ def post(text)
+ options = { :query => {:status => text}, :basic_auth => @auth }
+ self.class.post('/statuses/update.json', options)
+ end
+end
+
+twitter = Twitter.new(config['email'], config['password'])
+pp twitter.timeline
+# pp twitter.timeline(:friends, :query => {:since_id => 868482746})
+# pp twitter.timeline(:friends, :query => 'since_id=868482746')
+# pp twitter.post('this is a test of 0.2.0')
\ No newline at end of file
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/whoismyrep.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/whoismyrep.rb
new file mode 100644
index 0000000..b59473c
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/examples/whoismyrep.rb
@@ -0,0 +1,10 @@
+dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
+require File.join(dir, 'httparty')
+require 'pp'
+
+class Rep
+ include HTTParty
+end
+
+pp Rep.get('http://whoismyrepresentative.com/whoismyrep.php?zip=46544')
+pp Rep.get('http://whoismyrepresentative.com/whoismyrep.php', :query => {:zip => 46544})
\ No newline at end of file
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/basic_authentication.feature b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/basic_authentication.feature
new file mode 100644
index 0000000..b467237
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/basic_authentication.feature
@@ -0,0 +1,20 @@
+Feature: Basic Authentication
+
+ As a developer
+ I want to be able to use a service that requires Basic Authentication
+ Because that is not an uncommon requirement
+
+ Scenario: Passing no credentials to a page requiring Basic Authentication
+ Given a restricted page at '/basic_auth.html'
+ When I call HTTParty#get with '/basic_auth.html'
+ Then it should return a response with a 401 response code
+
+ Scenario: Passing proper credentials to a page requiring Basic Authentication
+ Given a remote service that returns 'Authenticated Page'
+ And that service is accessed at the path '/basic_auth.html'
+ And that service is protected by Basic Authentication
+ And that service requires the username 'jcash' with the password 'maninblack'
+ When I call HTTParty#get with '/basic_auth.html' and a basic_auth hash:
+ | username | password |
+ | jcash | maninblack |
+ Then the return value should match 'Authenticated Page'
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/command_line.feature b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/command_line.feature
new file mode 100644
index 0000000..951e236
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/command_line.feature
@@ -0,0 +1,7 @@
+Feature: Command Line
+
+ As a developer
+ I want to be able to harness the power of HTTParty from the command line
+ Because that would make quick testing and debugging easy
+ And 'easy' is my middle name
+ And I'm kidding it's actually 'Danger'!
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/deals_with_http_error_codes.feature b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/deals_with_http_error_codes.feature
new file mode 100644
index 0000000..bd6dd85
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/deals_with_http_error_codes.feature
@@ -0,0 +1,26 @@
+Feature: Deals with HTTP error codes
+
+ As a developer
+ I want to be informed of non-successful responses
+ Because sometimes thing explode
+ And I should probably know what happened
+
+ Scenario: A response of '404 - Not Found'
+ Given a remote service that returns a 404 status code
+ And that service is accessed at the path '/404_service.html'
+ When I call HTTParty#get with '/404_service.html'
+ Then it should return a response with a 404 response code
+
+ Scenario: A response of '500 - Internal Server Error'
+ Given a remote service that returns a 500 status code
+ And that service is accessed at the path '/500_service.html'
+ When I call HTTParty#get with '/500_service.html'
+ Then it should return a response with a 500 response code
+
+ Scenario: A non-successful response where I need the body
+ Given a remote service that returns a 400 status code
+ And the response from the service has a body of 'Bad response'
+ And that service is accessed at the path '/400_service.html'
+ When I call HTTParty#get with '/400_service.html'
+ Then it should return a response with a 400 response code
+ And the return value should match 'Bad response'
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/digest_authentication.feature b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/digest_authentication.feature
new file mode 100644
index 0000000..456a0a7
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/digest_authentication.feature
@@ -0,0 +1,20 @@
+Feature: Digest Authentication
+
+ As a developer
+ I want to be able to use a service that requires Digest Authentication
+ Because that is not an uncommon requirement
+
+ Scenario: Passing no credentials to a page requiring Digest Authentication
+ Given a restricted page at '/digest_auth.html'
+ When I call HTTParty#get with '/digest_auth.html'
+ Then it should return a response with a 401 response code
+
+ Scenario: Passing proper credentials to a page requiring Digest Authentication
+ Given a remote service that returns 'Digest Authenticated Page'
+ And that service is accessed at the path '/digest_auth.html'
+ And that service is protected by Digest Authentication
+ And that service requires the username 'jcash' with the password 'maninblack'
+ When I call HTTParty#get with '/digest_auth.html' and a digest_auth hash:
+ | username | password |
+ | jcash | maninblack |
+ Then the return value should match 'Digest Authenticated Page'
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/handles_compressed_responses.feature b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/handles_compressed_responses.feature
new file mode 100644
index 0000000..b20bba2
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/handles_compressed_responses.feature
@@ -0,0 +1,19 @@
+Feature: Handles Compressed Responses
+
+ In order to save bandwidth
+ As a developer
+ I want to uncompress compressed responses
+
+ Scenario: Supports deflate encoding
+ Given a remote deflate service
+ And the response from the service has a body of '
Some HTML
'
+ And that service is accessed at the path '/deflate_service.html'
+ When I call HTTParty#get with '/deflate_service.html'
+ Then the return value should match '
Some HTML
'
+
+ Scenario: Supports gzip encoding
+ Given a remote gzip service
+ And the response from the service has a body of '
Some HTML
'
+ And that service is accessed at the path '/gzip_service.html'
+ When I call HTTParty#get with '/gzip_service.html'
+ Then the return value should match '
Some HTML
'
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/handles_multiple_formats.feature b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/handles_multiple_formats.feature
new file mode 100644
index 0000000..438a6ba
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/handles_multiple_formats.feature
@@ -0,0 +1,34 @@
+Feature: Handles Multiple Formats
+
+ As a developer
+ I want to be able to consume remote services of many different formats
+ And I want those formats to be automatically detected and handled
+ Because web services take many forms
+ And I don't want to have to do any extra work
+
+ Scenario: An HTML service
+ Given a remote service that returns '
Some HTML
'
+ And that service is accessed at the path '/html_service.html'
+ And the response from the service has a Content-Type of 'text/html'
+ When I call HTTParty#get with '/html_service.html'
+ Then it should return a String
+ And the return value should match '
Some HTML
'
+
+ Scenario: A JSON service
+ Given a remote service that returns '{ "jennings": "waylon", "cash": "johnny" }'
+ And that service is accessed at the path '/service.json'
+ And the response from the service has a Content-Type of 'application/json'
+ When I call HTTParty#get with '/service.json'
+ Then it should return a Hash equaling:
+ | key | value |
+ | jennings | waylon |
+ | cash | johnny |
+
+ Scenario: An XML Service
+ Given a remote service that returns 'waylon jennings'
+ And that service is accessed at the path '/service.xml'
+ And the response from the service has a Content-Type of 'text/xml'
+ When I call HTTParty#get with '/service.xml'
+ Then it should return a Hash equaling:
+ | key | value |
+ | singer | waylon jennings |
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/env.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/env.rb
new file mode 100644
index 0000000..8bf4bb3
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/env.rb
@@ -0,0 +1,22 @@
+require 'mongrel'
+require './lib/httparty'
+require 'spec/expectations'
+
+Before do
+ def new_port
+ server = TCPServer.new('0.0.0.0', nil)
+ port = server.addr[1]
+ ensure
+ server.close
+ end
+
+ port = ENV["HTTPARTY_PORT"] || new_port
+ @host_and_port = "0.0.0.0:#{port}"
+ @server = Mongrel::HttpServer.new("0.0.0.0", port)
+ @server.run
+ @request_options = {}
+end
+
+After do
+ @server.stop
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/httparty_response_steps.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/httparty_response_steps.rb
new file mode 100644
index 0000000..bf535da
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/httparty_response_steps.rb
@@ -0,0 +1,26 @@
+Then /it should return an? (\w+)$/ do |class_string|
+ @response_from_httparty.should be_an_instance_of(class_string.class)
+end
+
+Then /the return value should match '(.*)'/ do |expected_text|
+ @response_from_httparty.should eql(expected_text)
+end
+
+Then /it should return a Hash equaling:/ do |hash_table|
+ @response_from_httparty.should be_an_instance_of(Hash)
+ @response_from_httparty.keys.length.should eql(hash_table.rows.length)
+ hash_table.hashes.each do |pair|
+ key, value = pair["key"], pair["value"]
+ @response_from_httparty.keys.should include(key)
+ @response_from_httparty[key].should eql(value)
+ end
+end
+
+Then /it should return a response with a (\d+) response code/ do |code|
+ @response_from_httparty.code.should eql(code.to_i)
+end
+
+Then /it should raise (?:an|a) ([\w:]+) exception/ do |exception|
+ @exception_from_httparty.should_not be_nil
+ @exception_from_httparty.class.name.should eql(exception)
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/httparty_steps.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/httparty_steps.rb
new file mode 100644
index 0000000..b9bd268
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/httparty_steps.rb
@@ -0,0 +1,27 @@
+When /^I set my HTTParty timeout option to (\d+)$/ do |timeout|
+ @request_options[:timeout] = timeout.to_i
+end
+
+When /I call HTTParty#get with '(.*)'$/ do |url|
+ begin
+ @response_from_httparty = HTTParty.get("http://#{@host_and_port}#{url}", @request_options)
+ rescue HTTParty::RedirectionTooDeep, Timeout::Error => e
+ @exception_from_httparty = e
+ end
+end
+
+When /I call HTTParty#get with '(.*)' and a basic_auth hash:/ do |url, auth_table|
+ h = auth_table.hashes.first
+ @response_from_httparty = HTTParty.get(
+ "http://#{@host_and_port}#{url}",
+ :basic_auth => { :username => h["username"], :password => h["password"] }
+ )
+end
+
+When /I call HTTParty#get with '(.*)' and a digest_auth hash:/ do |url, auth_table|
+ h = auth_table.hashes.first
+ @response_from_httparty = HTTParty.get(
+ "http://#{@host_and_port}#{url}",
+ :digest_auth => { :username => h["username"], :password => h["password"] }
+ )
+end
\ No newline at end of file
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/mongrel_helper.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/mongrel_helper.rb
new file mode 100644
index 0000000..8841c8e
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/mongrel_helper.rb
@@ -0,0 +1,94 @@
+require 'base64'
+class BasicMongrelHandler < Mongrel::HttpHandler
+ attr_accessor :content_type, :custom_headers, :response_body, :response_code, :preprocessor, :username, :password
+
+ def initialize
+ @content_type = "text/html"
+ @response_body = ""
+ @response_code = 200
+ @custom_headers = {}
+ end
+
+ def process(request, response)
+ instance_eval &preprocessor if preprocessor
+ reply_with(response, response_code, response_body)
+ end
+
+ def reply_with(response, code, response_body)
+ response.start(code) do |head, body|
+ head["Content-Type"] = content_type
+ custom_headers.each { |k,v| head[k] = v }
+ body.write(response_body)
+ end
+ end
+end
+
+class DeflateHandler < BasicMongrelHandler
+ def process(request, response)
+ response.start do |head, body|
+ head['Content-Encoding'] = 'deflate'
+ body.write Zlib::Deflate.deflate(response_body)
+ end
+ end
+end
+
+class GzipHandler < BasicMongrelHandler
+ def process(request, response)
+ response.start do |head, body|
+ head['Content-Encoding'] = 'gzip'
+ body.write gzip(response_body)
+ end
+ end
+
+ protected
+
+ def gzip(string)
+ sio = StringIO.new('', 'r+')
+ gz = Zlib::GzipWriter.new sio
+ gz.write string
+ gz.finish
+ sio.rewind
+ sio.read
+ end
+end
+
+module BasicAuthentication
+ def self.extended(base)
+ base.custom_headers["WWW-Authenticate"] = 'Basic Realm="Super Secret Page"'
+ end
+
+ def process(request, response)
+ if authorized?(request)
+ super
+ else
+ reply_with(response, 401, "Incorrect. You have 20 seconds to comply.")
+ end
+ end
+
+ def authorized?(request)
+ request.params["HTTP_AUTHORIZATION"] == "Basic " + Base64.encode64("#{@username}:#{@password}").strip
+ end
+end
+
+module DigestAuthentication
+ def self.extended(base)
+ base.custom_headers["WWW-Authenticate"] = 'Digest realm="testrealm@host.com",qop="auth,auth-int",nonce="nonce",opaque="opaque"'
+ end
+
+ def process(request, response)
+ if authorized?(request)
+ super
+ else
+ reply_with(response, 401, "Incorrect. You have 20 seconds to comply.")
+ end
+ end
+
+ def authorized?(request)
+ request.params["HTTP_AUTHORIZATION"] =~ /Digest.*uri=/
+ end
+end
+
+def new_mongrel_redirector(target_url, relative_path = false)
+ target_url = "http://#{@host_and_port}#{target_url}" unless relative_path
+ Mongrel::RedirectHandler.new(target_url)
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/remote_service_steps.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/remote_service_steps.rb
new file mode 100644
index 0000000..da0aee2
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/steps/remote_service_steps.rb
@@ -0,0 +1,69 @@
+Given /a remote service that returns '(.*)'/ do |response_body|
+ @handler = BasicMongrelHandler.new
+ Given "the response from the service has a body of '#{response_body}'"
+end
+
+Given /a remote service that returns a (\d+) status code/ do |code|
+ @handler = BasicMongrelHandler.new
+ @handler.response_code = code
+end
+
+Given /that service is accessed at the path '(.*)'/ do |path|
+ @server.register(path, @handler)
+end
+
+Given /^that service takes (\d+) seconds to generate a response$/ do |time|
+ @server_response_time = time.to_i
+ @handler.preprocessor = Proc.new { sleep time.to_i }
+end
+
+Given /^a remote deflate service$/ do
+ @handler = DeflateHandler.new
+end
+
+Given /^a remote gzip service$/ do
+ @handler = GzipHandler.new
+end
+
+Given /the response from the service has a Content-Type of '(.*)'/ do |content_type|
+ @handler.content_type = content_type
+end
+
+Given /the response from the service has a body of '(.*)'/ do |response_body|
+ @handler.response_body = response_body
+end
+
+Given /the url '(.*)' redirects to '(.*)'/ do |redirection_url, target_url|
+ @server.register redirection_url, new_mongrel_redirector(target_url)
+end
+
+Given /that service is protected by Basic Authentication/ do
+ @handler.extend BasicAuthentication
+end
+
+Given /that service is protected by Digest Authentication/ do
+ @handler.extend DigestAuthentication
+end
+
+Given /that service requires the username '(.*)' with the password '(.*)'/ do |username, password|
+ @handler.username = username
+ @handler.password = password
+end
+
+Given /a restricted page at '(.*)'/ do |url|
+ Given "a remote service that returns 'A response I will never see'"
+ And "that service is accessed at the path '#{url}'"
+ And "that service is protected by Basic Authentication"
+ And "that service requires the username 'something' with the password 'secret'"
+end
+
+# This joins the server thread, and halts cucumber, so you can actually hit the
+# server with a browser. Runs until you kill it with Ctrl-c
+Given /I want to hit this in a browser/ do
+ @server.acceptor.join
+end
+
+Then /I wait for the server to recover/ do
+ timeout = @request_options[:timeout] || 0
+ sleep @server_response_time - timeout
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/supports_redirection.feature b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/supports_redirection.feature
new file mode 100644
index 0000000..debc7b8
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/supports_redirection.feature
@@ -0,0 +1,22 @@
+Feature: Supports Redirection
+
+ As a developer
+ I want to work with services that may redirect me
+ And I want it to follow a reasonable number of redirects
+ Because sometimes web services do that
+
+ Scenario: A service that redirects once
+ Given a remote service that returns 'Service Response'
+ And that service is accessed at the path '/landing_service.html'
+ And the url '/redirector.html' redirects to '/landing_service.html'
+ When I call HTTParty#get with '/redirector.html'
+ Then the return value should match 'Service Response'
+
+ # TODO: Look in to why this actually fails...
+ Scenario: A service that redirects to a relative URL
+
+ Scenario: A service that redirects infinitely
+ Given the url '/first.html' redirects to '/second.html'
+ And the url '/second.html' redirects to '/first.html'
+ When I call HTTParty#get with '/first.html'
+ Then it should raise an HTTParty::RedirectionTooDeep exception
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/supports_timeout_option.feature b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/supports_timeout_option.feature
new file mode 100644
index 0000000..db56463
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/features/supports_timeout_option.feature
@@ -0,0 +1,13 @@
+Feature: Supports the timeout option
+ In order to handle inappropriately slow response times
+ As a developer
+ I want my request to raise an exception after my specified timeout as elapsed
+
+ Scenario: A long running response
+ Given a remote service that returns '
Some HTML
'
+ And that service is accessed at the path '/long_running_service.html'
+ And that service takes 2 seconds to generate a response
+ When I set my HTTParty timeout option to 1
+ And I call HTTParty#get with '/long_running_service.html'
+ Then it should raise a Timeout::Error exception
+ And I wait for the server to recover
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/httparty.gemspec b/vendor/ruby/1.9.1/gems/httparty-0.9.0/httparty.gemspec
new file mode 100644
index 0000000..d9fe866
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/httparty.gemspec
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
+require "httparty/version"
+
+Gem::Specification.new do |s|
+ s.name = "httparty"
+ s.version = HTTParty::VERSION
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["John Nunemaker", "Sandro Turriate"]
+ s.email = ["nunemaker@gmail.com"]
+ s.homepage = "http://jnunemaker.github.com/httparty"
+ s.summary = %q{Makes http fun! Also, makes consuming restful web services dead easy.}
+ s.description = %q{Makes http fun! Also, makes consuming restful web services dead easy.}
+
+ s.add_dependency 'multi_json', "~> 1.0"
+ s.add_dependency 'multi_xml'
+
+ s.post_install_message = "When you HTTParty, you must party hard!"
+
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty.rb
new file mode 100644
index 0000000..9885e58
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty.rb
@@ -0,0 +1,503 @@
+require 'pathname'
+require 'net/http'
+require 'net/https'
+require 'uri'
+require 'zlib'
+require 'multi_xml'
+require 'multi_json'
+
+require 'httparty/module_inheritable_attributes'
+require 'httparty/cookie_hash'
+require 'httparty/net_digest_auth'
+require 'httparty/version'
+require 'httparty/connection_adapter'
+
+# @see HTTParty::ClassMethods
+module HTTParty
+ module AllowedFormatsDeprecation
+ def const_missing(const)
+ if const.to_s =~ /AllowedFormats$/
+ Kernel.warn("Deprecated: Use HTTParty::Parser::SupportedFormats")
+ HTTParty::Parser::SupportedFormats
+ else
+ super
+ end
+ end
+ end
+
+ extend AllowedFormatsDeprecation
+
+ def self.included(base)
+ base.extend ClassMethods
+ base.send :include, HTTParty::ModuleInheritableAttributes
+ base.send(:mattr_inheritable, :default_options)
+ base.send(:mattr_inheritable, :default_cookies)
+ base.instance_variable_set("@default_options", {})
+ base.instance_variable_set("@default_cookies", CookieHash.new)
+ end
+
+ # == Common Request Options
+ # Request methods (get, post, patch, put, delete, head, options) all take a common set of options. These are:
+ #
+ # [:+body+:] Body of the request. If passed a Hash, will try to normalize it first, by default passing it to ActiveSupport::to_params. Any other kind of object will get used as-is.
+ # [:+http_proxyaddr+:] Address of proxy server to use.
+ # [:+http_proxyport+:] Port of proxy server to use.
+ # [:+http_proxyuser+:] User for proxy server authentication.
+ # [:+http_proxypass+:] Password for proxy server authentication.
+ # [:+limit+:] Maximum number of redirects to follow. Takes precedences over :+no_follow+.
+ # [:+query+:] Query string, or a Hash representing it. Normalized according to the same rules as :+body+. If you specify this on a POST, you must use a Hash. See also HTTParty::ClassMethods.default_params.
+ # [:+timeout+:] Timeout for opening connection and reading data.
+ #
+ # There are also another set of options with names corresponding to various class methods. The methods in question are those that let you set a class-wide default, and the options override the defaults on a request-by-request basis. Those options are:
+ # * :+base_uri+: see HTTParty::ClassMethods.base_uri.
+ # * :+basic_auth+: see HTTParty::ClassMethods.basic_auth. Only one of :+basic_auth+ and :+digest_auth+ can be used at a time; if you try using both, you'll get an ArgumentError.
+ # * :+debug_output+: see HTTParty::ClassMethods.debug_output.
+ # * :+digest_auth+: see HTTParty::ClassMethods.digest_auth. Only one of :+basic_auth+ and :+digest_auth+ can be used at a time; if you try using both, you'll get an ArgumentError.
+ # * :+format+: see HTTParty::ClassMethods.format.
+ # * :+headers+: see HTTParty::ClassMethods.headers. Must be a Hash.
+ # * :+maintain_method_across_redirects+: see HTTParty::ClassMethods.maintain_method_across_redirects.
+ # * :+no_follow+: see HTTParty::ClassMethods.no_follow.
+ # * :+parser+: see HTTParty::ClassMethods.parser.
+ # * :+connection_adapter+: see HTTParty::ClassMethods.connection_adapter.
+ # * :+pem+: see HTTParty::ClassMethods.pem.
+ # * :+query_string_normalizer+: see HTTParty::ClassMethods.query_string_normalizer
+ # * :+ssl_ca_file+: see HTTParty::ClassMethods.ssl_ca_file.
+ # * :+ssl_ca_path+: see HTTParty::ClassMethods.ssl_ca_path.
+
+ module ClassMethods
+
+ extend AllowedFormatsDeprecation
+
+ # Allows setting http proxy information to be used
+ #
+ # class Foo
+ # include HTTParty
+ # http_proxy 'http://foo.com', 80, 'user', 'pass'
+ # end
+ def http_proxy(addr=nil, port=nil, user=nil, pass=nil)
+ default_options[:http_proxyaddr] = addr
+ default_options[:http_proxyport] = port
+ default_options[:http_proxyuser] = user
+ default_options[:http_proxypass] = pass
+ end
+
+ # Allows setting a base uri to be used for each request.
+ # Will normalize uri to include http, etc.
+ #
+ # class Foo
+ # include HTTParty
+ # base_uri 'twitter.com'
+ # end
+ def base_uri(uri=nil)
+ return default_options[:base_uri] unless uri
+ default_options[:base_uri] = HTTParty.normalize_base_uri(uri)
+ end
+
+ # Allows setting basic authentication username and password.
+ #
+ # class Foo
+ # include HTTParty
+ # basic_auth 'username', 'password'
+ # end
+ def basic_auth(u, p)
+ default_options[:basic_auth] = {:username => u, :password => p}
+ end
+
+ # Allows setting digest authentication username and password.
+ #
+ # class Foo
+ # include HTTParty
+ # digest_auth 'username', 'password'
+ # end
+ def digest_auth(u, p)
+ default_options[:digest_auth] = {:username => u, :password => p}
+ end
+
+ # Do not send rails style query strings.
+ # Specically, don't use bracket notation when sending an array
+ #
+ # For a query:
+ # get '/', :query => {:selected_ids => [1,2,3]}
+ #
+ # The default query string looks like this:
+ # /?selected_ids[]=1&selected_ids[]=2&selected_ids[]=3
+ #
+ # Call `disable_rails_query_string_format` to transform the query string
+ # into:
+ # /?selected_ids=1&selected_ids=2&selected_ids=3
+ #
+ # @example
+ # class Foo
+ # include HTTParty
+ # disable_rails_query_string_format
+ # end
+ def disable_rails_query_string_format
+ query_string_normalizer Request::NON_RAILS_QUERY_STRING_NORMALIZER
+ end
+
+ # Allows setting default parameters to be appended to each request.
+ # Great for api keys and such.
+ #
+ # class Foo
+ # include HTTParty
+ # default_params :api_key => 'secret', :another => 'foo'
+ # end
+ def default_params(h={})
+ raise ArgumentError, 'Default params must be a hash' unless h.is_a?(Hash)
+ default_options[:default_params] ||= {}
+ default_options[:default_params].merge!(h)
+ end
+
+ # Allows setting a default timeout for all HTTP calls
+ # Timeout is specified in seconds.
+ #
+ # class Foo
+ # include HTTParty
+ # default_timeout 10
+ # end
+ def default_timeout(t)
+ raise ArgumentError, 'Timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
+ default_options[:timeout] = t
+ end
+
+ # Set an output stream for debugging, defaults to $stderr.
+ # The output stream is passed on to Net::HTTP#set_debug_output.
+ #
+ # class Foo
+ # include HTTParty
+ # debug_output $stderr
+ # end
+ def debug_output(stream = $stderr)
+ default_options[:debug_output] = stream
+ end
+
+ # Allows setting HTTP headers to be used for each request.
+ #
+ # class Foo
+ # include HTTParty
+ # headers 'Accept' => 'text/html'
+ # end
+ def headers(h={})
+ raise ArgumentError, 'Headers must be a hash' unless h.is_a?(Hash)
+ default_options[:headers] ||= {}
+ default_options[:headers].merge!(h)
+ end
+
+ def cookies(h={})
+ raise ArgumentError, 'Cookies must be a hash' unless h.is_a?(Hash)
+ default_cookies.add_cookies(h)
+ end
+
+ # Proceed to the location header when an HTTP response dictates a redirect.
+ # Redirects are always followed by default.
+ #
+ # @example
+ # class Foo
+ # include HTTParty
+ # base_uri 'http://google.com'
+ # follow_redirects true
+ # end
+ def follow_redirects(value = true)
+ default_options[:follow_redirects] = value
+ end
+
+ # Allows setting the format with which to parse.
+ # Must be one of the allowed formats ie: json, xml
+ #
+ # class Foo
+ # include HTTParty
+ # format :json
+ # end
+ def format(f = nil)
+ if f.nil?
+ default_options[:format]
+ else
+ parser(Parser) if parser.nil?
+ default_options[:format] = f
+ validate_format
+ end
+ end
+
+ # Declare whether or not to follow redirects. When true, an
+ # {HTTParty::RedirectionTooDeep} error will raise upon encountering a
+ # redirect. You can then gain access to the response object via
+ # HTTParty::RedirectionTooDeep#response.
+ #
+ # @see HTTParty::ResponseError#response
+ #
+ # @example
+ # class Foo
+ # include HTTParty
+ # base_uri 'http://google.com'
+ # no_follow true
+ # end
+ #
+ # begin
+ # Foo.get('/')
+ # rescue HTTParty::RedirectionTooDeep => e
+ # puts e.response.body
+ # end
+ def no_follow(value = false)
+ default_options[:no_follow] = value
+ end
+
+ # Declare that you wish to maintain the chosen HTTP method across redirects.
+ # The default behavior is to follow redirects via the GET method.
+ # If you wish to maintain the original method, you can set this option to true.
+ #
+ # @example
+ # class Foo
+ # include HTTParty
+ # base_uri 'http://google.com'
+ # maintain_method_across_redirects true
+ # end
+
+ def maintain_method_across_redirects(value = true)
+ default_options[:maintain_method_across_redirects] = value
+ end
+
+ # Allows setting a PEM file to be used
+ #
+ # class Foo
+ # include HTTParty
+ # pem File.read('/home/user/my.pem'), "optional password"
+ # end
+ def pem(pem_contents, password=nil)
+ default_options[:pem] = pem_contents
+ default_options[:pem_password] = password
+ end
+
+ # Override the way query strings are normalized.
+ # Helpful for overriding the default rails normalization of Array queries.
+ #
+ # For a query:
+ # get '/', :query => {:selected_ids => [1,2,3]}
+ #
+ # The default query string normalizer returns:
+ # /?selected_ids[]=1&selected_ids[]=2&selected_ids[]=3
+ #
+ # Let's change it to this:
+ # /?selected_ids=1&selected_ids=2&selected_ids=3
+ #
+ # Pass a Proc to the query normalizer which accepts the yielded query.
+ #
+ # @example Modifying Array query strings
+ # class ServiceWrapper
+ # include HTTParty
+ #
+ # query_string_normalizer proc { |query|
+ # query.map do |key, value|
+ # value.map {|v| "#{key}=#{v}"}
+ # end.join('&')
+ # }
+ # end
+ #
+ # @param [Proc] normalizer custom query string normalizer.
+ # @yield [Hash, String] query string
+ # @yieldreturn [Array] an array that will later be joined with '&'
+ def query_string_normalizer(normalizer)
+ default_options[:query_string_normalizer] = normalizer
+ end
+
+ # Allows setting of SSL version to use. This only works in Ruby 1.9.
+ # You can get a list of valid versions from OpenSSL::SSL::SSLContext::METHODS.
+ #
+ # class Foo
+ # include HTTParty
+ # ssl_version :SSLv3
+ # end
+ def ssl_version(version)
+ default_options[:ssl_version] = version
+ end
+
+ # Allows setting an OpenSSL certificate authority file
+ #
+ # class Foo
+ # include HTTParty
+ # ssl_ca_file '/etc/ssl/certs/ca-certificates.crt'
+ # end
+ def ssl_ca_file(path)
+ default_options[:ssl_ca_file] = path
+ end
+
+ # Allows setting an OpenSSL certificate authority path (directory)
+ #
+ # class Foo
+ # include HTTParty
+ # ssl_ca_path '/etc/ssl/certs/'
+ # end
+ def ssl_ca_path(path)
+ default_options[:ssl_ca_path] = path
+ end
+
+ # Allows setting a custom parser for the response.
+ #
+ # class Foo
+ # include HTTParty
+ # parser Proc.new {|data| ...}
+ # end
+ def parser(custom_parser = nil)
+ if custom_parser.nil?
+ default_options[:parser]
+ else
+ default_options[:parser] = custom_parser
+ validate_format
+ end
+ end
+
+ # Allows setting a custom connection_adapter for the http connections
+ #
+ # @example
+ # class Foo
+ # include HTTParty
+ # connection_adapter Proc.new {|uri, options| ... }
+ # end
+ #
+ # @example provide optional configuration for your connection_adapter
+ # class Foo
+ # include HTTParty
+ # connection_adapter Proc.new {|uri, options| ... }, {:foo => :bar}
+ # end
+ #
+ # @see HTTParty::ConnectionAdapter
+ def connection_adapter(custom_adapter = nil, options = nil)
+ if custom_adapter.nil?
+ default_options[:connection_adapter]
+ else
+ default_options[:connection_adapter] = custom_adapter
+ default_options[:connection_adapter_options] = options
+ end
+ end
+
+ # Allows making a get request to a url.
+ #
+ # class Foo
+ # include HTTParty
+ # end
+ #
+ # # Simple get with full url
+ # Foo.get('http://foo.com/resource.json')
+ #
+ # # Simple get with full url and query parameters
+ # # ie: http://foo.com/resource.json?limit=10
+ # Foo.get('http://foo.com/resource.json', :query => {:limit => 10})
+ def get(path, options={}, &block)
+ perform_request Net::HTTP::Get, path, options, &block
+ end
+
+ # Allows making a post request to a url.
+ #
+ # class Foo
+ # include HTTParty
+ # end
+ #
+ # # Simple post with full url and setting the body
+ # Foo.post('http://foo.com/resources', :body => {:bar => 'baz'})
+ #
+ # # Simple post with full url using :query option,
+ # # which gets set as form data on the request.
+ # Foo.post('http://foo.com/resources', :query => {:bar => 'baz'})
+ def post(path, options={}, &block)
+ perform_request Net::HTTP::Post, path, options, &block
+ end
+
+ # Perform a PATCH request to a path
+ def patch(path, options={}, &block)
+ perform_request Net::HTTP::Patch, path, options, &block
+ end
+
+ # Perform a PUT request to a path
+ def put(path, options={}, &block)
+ perform_request Net::HTTP::Put, path, options, &block
+ end
+
+ # Perform a DELETE request to a path
+ def delete(path, options={}, &block)
+ perform_request Net::HTTP::Delete, path, options, &block
+ end
+
+ # Perform a HEAD request to a path
+ def head(path, options={}, &block)
+ perform_request Net::HTTP::Head, path, options, &block
+ end
+
+ # Perform an OPTIONS request to a path
+ def options(path, options={}, &block)
+ perform_request Net::HTTP::Options, path, options, &block
+ end
+
+ def default_options #:nodoc:
+ @default_options
+ end
+
+ private
+
+ def perform_request(http_method, path, options, &block) #:nodoc:
+ options = default_options.dup.merge(options)
+ process_cookies(options)
+ Request.new(http_method, path, options).perform(&block)
+ end
+
+ def process_cookies(options) #:nodoc:
+ return unless options[:cookies] || default_cookies.any?
+ options[:headers] ||= headers.dup
+ options[:headers]["cookie"] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string
+ end
+
+ def validate_format
+ if format && parser.respond_to?(:supports_format?) && !parser.supports_format?(format)
+ raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{parser.supported_formats.map{|f| f.to_s}.sort.join(', ')}"
+ end
+ end
+ end
+
+ def self.normalize_base_uri(url) #:nodoc:
+ normalized_url = url.dup
+ use_ssl = (normalized_url =~ /^https/) || (normalized_url =~ /:443\b/)
+ ends_with_slash = normalized_url =~ /\/$/
+
+ normalized_url.chop! if ends_with_slash
+ normalized_url.gsub!(/^https?:\/\//i, '')
+
+ "http#{'s' if use_ssl}://#{normalized_url}"
+ end
+
+ class Basement #:nodoc:
+ include HTTParty
+ end
+
+ def self.get(*args, &block)
+ Basement.get(*args, &block)
+ end
+
+ def self.post(*args, &block)
+ Basement.post(*args, &block)
+ end
+
+ def self.patch(*args, &block)
+ Basement.patch(*args, &block)
+ end
+
+ def self.put(*args, &block)
+ Basement.put(*args, &block)
+ end
+
+ def self.delete(*args, &block)
+ Basement.delete(*args, &block)
+ end
+
+ def self.head(*args, &block)
+ Basement.head(*args, &block)
+ end
+
+ def self.options(*args, &block)
+ Basement.options(*args, &block)
+ end
+end
+
+require 'httparty/core_extensions'
+require 'httparty/hash_conversions'
+require 'httparty/exceptions'
+require 'httparty/parser'
+require 'httparty/request'
+require 'httparty/response'
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/connection_adapter.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/connection_adapter.rb
new file mode 100644
index 0000000..df3e0cc
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/connection_adapter.rb
@@ -0,0 +1,116 @@
+module HTTParty
+ # Default connection adapter that returns a new Net::HTTP each time
+ #
+ # == Custom Connection Factories
+ #
+ # If you like to implement your own connection adapter, subclassing
+ # HTTPParty::ConnectionAdapter will make it easier. Just override
+ # the #connection method. The uri and options attributes will have
+ # all the info you need to construct your http connection. Whatever
+ # you return from your connection method needs to adhere to the
+ # Net::HTTP interface as this is what HTTParty expects.
+ #
+ # @example log the uri and options
+ # class LoggingConnectionAdapter < HTTParty::ConnectionAdapter
+ # def connection
+ # puts uri
+ # puts options
+ # Net::HTTP.new(uri)
+ # end
+ # end
+ #
+ # @example count number of http calls
+ # class CountingConnectionAdapter < HTTParty::ConnectionAdapter
+ # @@count = 0
+ #
+ # self.count
+ # @@count
+ # end
+ #
+ # def connection
+ # self.count += 1
+ # super
+ # end
+ # end
+ #
+ # === Configuration
+ # There is lots of configuration data available for your connection adapter
+ # in the #options attribute. It is up to you to interpret them within your
+ # connection adapter. Take a look at the implementation of
+ # HTTParty::ConnectionAdapter#connection for examples of how they are used.
+ # Something are probably interesting are as follows:
+ # * :+timeout+: timeout in seconds
+ # * :+debug_output+: see HTTParty::ClassMethods.debug_output.
+ # * :+pem+: contains pem data. see HTTParty::ClassMethods.pem.
+ # * :+ssl_ca_file+: see HTTParty::ClassMethods.ssl_ca_file.
+ # * :+ssl_ca_path+: see HTTParty::ClassMethods.ssl_ca_path.
+ # * :+connection_adapter_options+: contains the hash your passed to HTTParty.connection_adapter when you configured your connection adapter
+ class ConnectionAdapter
+
+ def self.call(uri, options)
+ new(uri, options).connection
+ end
+
+ attr_reader :uri, :options
+
+ def initialize(uri, options={})
+ raise ArgumentError, "uri must be a URI, not a #{uri.class}" unless uri.kind_of? URI
+
+ @uri = uri
+ @options = options
+ end
+
+ def connection
+ http = Net::HTTP.new(uri.host, uri.port, options[:http_proxyaddr], options[:http_proxyport], options[:http_proxyuser], options[:http_proxypass])
+
+ http.use_ssl = ssl_implied?(uri)
+
+ attach_ssl_certificates(http, options)
+
+ if options[:timeout] && (options[:timeout].is_a?(Integer) || options[:timeout].is_a?(Float))
+ http.open_timeout = options[:timeout]
+ http.read_timeout = options[:timeout]
+ end
+
+ if options[:debug_output]
+ http.set_debug_output(options[:debug_output])
+ end
+
+ return http
+ end
+
+ private
+ def ssl_implied?(uri)
+ uri.port == 443 || uri.instance_of?(URI::HTTPS)
+ end
+
+ def attach_ssl_certificates(http, options)
+ if http.use_ssl?
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+
+ # Client certificate authentication
+ if options[:pem]
+ http.cert = OpenSSL::X509::Certificate.new(options[:pem])
+ http.key = OpenSSL::PKey::RSA.new(options[:pem], options[:pem_password])
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
+ end
+
+ # SSL certificate authority file and/or directory
+ if options[:ssl_ca_file]
+ http.ca_file = options[:ssl_ca_file]
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
+ end
+
+ if options[:ssl_ca_path]
+ http.ca_path = options[:ssl_ca_path]
+ http.verify_mode = OpenSSL::SSL::VERIFY_PEER
+ end
+
+ # This is only Ruby 1.9+
+ if options[:ssl_version] && http.respond_to?(:ssl_version=)
+ http.ssl_version = options[:ssl_version]
+ end
+ end
+ end
+ end
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/cookie_hash.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/cookie_hash.rb
new file mode 100644
index 0000000..e9ea92d
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/cookie_hash.rb
@@ -0,0 +1,22 @@
+class HTTParty::CookieHash < Hash #:nodoc:
+
+ CLIENT_COOKIES = %w{path expires domain path secure HTTPOnly}
+
+ def add_cookies(value)
+ case value
+ when Hash
+ merge!(value)
+ when String
+ value.split('; ').each do |cookie|
+ array = cookie.split('=')
+ self[array[0].to_sym] = array[1]
+ end
+ else
+ raise "add_cookies only takes a Hash or a String"
+ end
+ end
+
+ def to_cookie_string
+ delete_if { |k, v| CLIENT_COOKIES.include?(k.to_s) }.collect { |k, v| "#{k}=#{v}" }.join("; ")
+ end
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/core_extensions.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/core_extensions.rb
new file mode 100644
index 0000000..b41c00e
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/core_extensions.rb
@@ -0,0 +1,32 @@
+module HTTParty
+ if defined?(::BasicObject)
+ BasicObject = ::BasicObject #:nodoc:
+ else
+ class BasicObject #:nodoc:
+ instance_methods.each { |m| undef_method m unless m =~ /^__|instance_eval/ }
+ end
+ end
+
+ unless defined?(Net::HTTP::Patch)
+ class Net::HTTP
+ def patch(path, data, initheader = nil, dest = nil, &block) #:nodoc:
+ res = nil
+ request(Patch.new(path, initheader), data) {|r|
+ r.read_body dest, &block
+ res = r
+ }
+ unless @newimpl
+ res.value
+ return res, res.body
+ end
+ res
+ end
+
+ class Patch < Net::HTTPRequest
+ METHOD = 'PATCH'
+ REQUEST_HAS_BODY = true
+ RESPONSE_HAS_BODY = true
+ end
+ end
+ end
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/exceptions.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/exceptions.rb
new file mode 100644
index 0000000..512aec7
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/exceptions.rb
@@ -0,0 +1,26 @@
+module HTTParty
+ # Exception raised when you attempt to set a non-existant format
+ class UnsupportedFormat < StandardError; end
+
+ # Exception raised when using a URI scheme other than HTTP or HTTPS
+ class UnsupportedURIScheme < StandardError; end
+
+ # @abstract Exceptions which inherit from ResponseError contain the Net::HTTP
+ # response object accessible via the {#response} method.
+ class ResponseError < StandardError
+ # Returns the response of the last request
+ # @return [Net::HTTPResponse] A subclass of Net::HTTPResponse, e.g.
+ # Net::HTTPOK
+ attr_reader :response
+
+ # Instantiate an instance of ResponseError with a Net::HTTPResponse object
+ # @param [Net::HTTPResponse]
+ def initialize(response)
+ @response = response
+ end
+ end
+
+ # Exception that is raised when request has redirected too many times.
+ # Calling {#response} returns the Net:HTTP response object.
+ class RedirectionTooDeep < ResponseError; end
+end
diff --git a/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/hash_conversions.rb b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/hash_conversions.rb
new file mode 100644
index 0000000..87e08cf
--- /dev/null
+++ b/vendor/ruby/1.9.1/gems/httparty-0.9.0/lib/httparty/hash_conversions.rb
@@ -0,0 +1,51 @@
+module HTTParty
+ module HashConversions
+ # @return This hash as a query string
+ #
+ # @example
+ # { :name => "Bob",
+ # :address => {
+ # :street => '111 Ruby Ave.',
+ # :city => 'Ruby Central',
+ # :phones => ['111-111-1111', '222-222-2222']
+ # }
+ # }.to_params
+ # #=> "name=Bob&address[city]=Ruby Central&address[phones][]=111-111-1111&address[phones][]=222-222-2222&address[street]=111 Ruby Ave."
+ def self.to_params(hash)
+ params = hash.map { |k,v| normalize_param(k,v) }.join
+ params.chop! # trailing &
+ params
+ end
+
+ # @param key