plyom_user 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/plyom_user/version.rb +1 -1
- data/lib/plyom_user.rb +4 -3
- data/vendor/bundle/ruby/2.0.0/bin/httparty +23 -0
- data/vendor/bundle/ruby/2.0.0/bin/rake +23 -0
- data/vendor/bundle/ruby/2.0.0/build_info/httparty-0.11.0.info +1 -0
- data/vendor/bundle/ruby/2.0.0/build_info/multi_json-1.8.2.info +1 -0
- data/vendor/bundle/ruby/2.0.0/build_info/multi_xml-0.5.5.info +1 -0
- data/vendor/bundle/ruby/2.0.0/build_info/rake-10.1.1.info +1 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/.gitignore +10 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/.travis.yml +9 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/Gemfile +15 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/Guardfile +16 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/History +303 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/MIT-LICENSE +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/README.md +79 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/Rakefile +15 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/bin/httparty +114 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/cucumber.yml +1 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/aaws.rb +32 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/basic.rb +32 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/crack.rb +19 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/custom_parsers.rb +67 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/delicious.rb +37 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/google.rb +16 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/headers_and_user_agents.rb +6 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/nokogiri_html_parser.rb +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/rubyurl.rb +14 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/tripit_sign_in.rb +33 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/twitter.rb +31 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/examples/whoismyrep.rb +10 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/basic_authentication.feature +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/command_line.feature +7 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/deals_with_http_error_codes.feature +26 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/digest_authentication.feature +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/handles_compressed_responses.feature +19 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/handles_multiple_formats.feature +34 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/steps/env.rb +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/steps/httparty_response_steps.rb +40 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/steps/httparty_steps.rb +27 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/steps/mongrel_helper.rb +94 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/steps/remote_service_steps.rb +69 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/supports_redirection.feature +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/features/supports_timeout_option.feature +13 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/httparty.gemspec +24 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/connection_adapter.rb +134 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/cookie_hash.rb +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/core_extensions.rb +32 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/exceptions.rb +26 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/hash_conversions.rb +51 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/module_inheritable_attributes.rb +56 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/net_digest_auth.rb +84 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/parser.rb +139 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/request.rb +250 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/response/headers.rb +31 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/response.rb +67 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty/version.rb +3 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/lib/httparty.rb +534 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/delicious.xml +23 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/empty.xml +0 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/google.html +3 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/generate.sh +29 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/generated/1fe462c2.0 +16 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/generated/bogushost.crt +13 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/generated/ca.crt +16 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/generated/ca.key +15 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/generated/selfsigned.crt +14 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/generated/server.crt +13 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/generated/server.key +15 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/ssl/openssl-exts.cnf +9 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/twitter.json +1 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/twitter.xml +403 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/fixtures/undefined_method_add_node_for_nil.xml +2 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/httparty/connection_adapter_spec.rb +223 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/httparty/cookie_hash_spec.rb +76 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/httparty/net_digest_auth_spec.rb +115 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/httparty/parser_spec.rb +166 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/httparty/request_spec.rb +514 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/httparty/response_spec.rb +221 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/httparty/ssl_spec.rb +62 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/httparty_spec.rb +733 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/spec.opts +2 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/spec_helper.rb +30 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/support/ssl_test_helper.rb +47 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/support/ssl_test_server.rb +80 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/spec/support/stub_response.rb +43 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/website/css/common.css +47 -0
- data/vendor/bundle/ruby/2.0.0/gems/httparty-0.11.0/website/index.html +73 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/.document +5 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/.rspec +2 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/.travis.yml +16 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/.yardopts +6 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/CHANGELOG.md +185 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/CONTRIBUTING.md +46 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/Gemfile +30 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/LICENSE.md +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/README.md +108 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/Rakefile +25 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapter.rb +57 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/gson.rb +19 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/jr_jackson.rb +19 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/json_common.rb +25 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/json_gem.rb +11 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/json_pure.rb +11 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/nsjsonserialization.rb +34 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/oj.rb +24 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/ok_json.rb +24 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/adapters/yajl.rb +19 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/convertible_hash_keys.rb +43 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/load_error.rb +11 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/options.rb +48 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/vendor/okjson.rb +606 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json/version.rb +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/lib/multi_json.rb +159 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/multi_json.gemspec +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/gson_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/jr_jackson_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/json_gem_adapter_spec.rb +9 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/json_pure_adapter_spec.rb +9 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/multi_json_spec.rb +193 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/nsjsonserialization_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/oj_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/ok_json_adapter_spec.rb +7 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/adapter.rb +230 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/json_common_adapter.rb +30 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/shared/options.rb +119 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/spec_helper.rb +73 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_json-1.8.2/spec/yajl_adapter_spec.rb +10 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/.yardopts +8 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/CHANGELOG.md +93 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/CONTRIBUTING.md +49 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/LICENSE.md +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/README.md +97 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/Rakefile +21 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/libxml.rb +30 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/libxml2_parser.rb +74 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/nokogiri.rb +32 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/ox.rb +97 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/rexml.rb +113 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml/version.rb +3 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/lib/multi_xml.rb +296 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/multi_xml.gemspec +24 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/spec/helper.rb +17 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/spec/multi_xml_spec.rb +43 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/spec/parser_shared_example.rb +694 -0
- data/vendor/bundle/ruby/2.0.0/gems/multi_xml-0.5.5/spec/speed.rb +63 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/.gemtest +0 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/CHANGES +530 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/MIT-LICENSE +21 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/README.rdoc +187 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/Rakefile +374 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/TODO +21 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/bin/rake +33 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/install.rb +80 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/alt_system.rb +108 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/application.rb +728 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/backtrace.rb +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/clean.rb +55 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/cloneable.rb +16 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/compositepublisher.rb +21 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/ftptools.rb +139 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/publisher.rb +73 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/rubyforgepublisher.rb +16 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sshpublisher.rb +50 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/contrib/sys.rb +2 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/default_loader.rb +10 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/dsl_definition.rb +157 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/early_time.rb +18 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/ext/core.rb +28 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/ext/module.rb +0 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/ext/string.rb +166 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/ext/time.rb +15 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/file_creation_task.rb +24 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/file_list.rb +416 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/file_task.rb +46 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/file_utils.rb +116 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/file_utils_ext.rb +144 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/gempackagetask.rb +2 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/invocation_chain.rb +57 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/invocation_exception_mixin.rb +16 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/linked_list.rb +103 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/loaders/makefile.rb +40 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/multi_task.rb +13 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/name_space.rb +25 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/packagetask.rb +190 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/pathmap.rb +1 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/phony.rb +15 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/private_reader.rb +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/promise.rb +99 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/pseudo_status.rb +29 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/rake_module.rb +37 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/rake_test_loader.rb +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/rdoctask.rb +2 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/ruby182_test_unit_fix.rb +27 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/rule_recursion_overflow_error.rb +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/runtest.rb +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/scope.rb +42 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task.rb +378 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task_argument_error.rb +7 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task_arguments.rb +89 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/task_manager.rb +297 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/tasklib.rb +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/testtask.rb +201 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/thread_history_display.rb +48 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/thread_pool.rb +161 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/trace_output.rb +22 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/version.rb +9 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake/win32.rb +56 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/lib/rake.rb +73 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/file_creation.rb +34 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/helper.rb +128 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/support/rakefile_definitions.rb +444 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/support/ruby_runner.rb +33 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_private_reader.rb +42 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake.rb +40 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_application.rb +517 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_application_options.rb +457 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_backtrace.rb +113 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_clean.rb +46 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_definitions.rb +79 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_directory_task.rb +57 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_dsl.rb +40 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_early_time.rb +31 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_extension.rb +59 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_file_creation_task.rb +56 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_file_list.rb +627 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_file_list_path_map.rb +8 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_file_task.rb +122 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_file_utils.rb +309 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_ftp_file.rb +74 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_functional.rb +466 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_invocation_chain.rb +64 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_linked_list.rb +84 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_makefile_loader.rb +46 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_multi_task.rb +58 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_name_space.rb +43 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_package_task.rb +79 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_path_map.rb +168 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_path_map_explode.rb +34 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_path_map_partial.rb +18 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_pseudo_status.rb +21 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_rake_test_loader.rb +20 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_reduce_compat.rb +26 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_require.rb +40 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_rules.rb +362 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_scope.rb +44 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_task.rb +376 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_task_argument_parsing.rb +103 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_task_arguments.rb +121 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_task_lib.rb +9 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_task_manager.rb +158 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_task_manager_argument_resolution.rb +19 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_task_with_arguments.rb +171 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_test_task.rb +119 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_thread_pool.rb +142 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_top_level_functions.rb +71 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_rake_win32.rb +72 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_thread_history_display.rb +101 -0
- data/vendor/bundle/ruby/2.0.0/gems/rake-10.1.1/test/test_trace_output.rb +52 -0
- data/vendor/bundle/ruby/2.0.0/specifications/httparty-0.11.0.gemspec +34 -0
- data/vendor/bundle/ruby/2.0.0/specifications/multi_json-1.8.2.gemspec +30 -0
- data/vendor/bundle/ruby/2.0.0/specifications/multi_xml-0.5.5.gemspec +30 -0
- data/vendor/bundle/ruby/2.0.0/specifications/rake-10.1.1.gemspec +34 -0
- metadata +262 -2
@@ -0,0 +1,514 @@
|
|
1
|
+
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
|
2
|
+
|
3
|
+
describe HTTParty::Request do
|
4
|
+
before do
|
5
|
+
@request = HTTParty::Request.new(Net::HTTP::Get, 'http://api.foo.com/v1', :format => :xml)
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "::NON_RAILS_QUERY_STRING_NORMALIZER" do
|
9
|
+
let(:normalizer) { HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER }
|
10
|
+
|
11
|
+
it "doesn't modify strings" do
|
12
|
+
query_string = normalizer["foo=bar&foo=baz"]
|
13
|
+
URI.unescape(query_string).should == "foo=bar&foo=baz"
|
14
|
+
end
|
15
|
+
|
16
|
+
context "when the query is an array" do
|
17
|
+
|
18
|
+
it "doesn't include brackets" do
|
19
|
+
query_string = normalizer[{:page => 1, :foo => %w(bar baz)}]
|
20
|
+
URI.unescape(query_string).should == "foo=bar&foo=baz&page=1"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "URI encodes array values" do
|
24
|
+
query_string = normalizer[{:people => ["Bob Marley", "Tim & Jon"]}]
|
25
|
+
query_string.should == "people=Bob%20Marley&people=Tim%20%26%20Jon"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when the query is a hash" do
|
30
|
+
it "correctly handles nil values" do
|
31
|
+
query_string = normalizer[{:page => 1, :per_page => nil}]
|
32
|
+
query_string.should == "page=1&per_page"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "initialization" do
|
38
|
+
it "sets parser to HTTParty::Parser" do
|
39
|
+
request = HTTParty::Request.new(Net::HTTP::Get, 'http://google.com')
|
40
|
+
request.parser.should == HTTParty::Parser
|
41
|
+
end
|
42
|
+
|
43
|
+
it "sets parser to the optional parser" do
|
44
|
+
my_parser = lambda {}
|
45
|
+
request = HTTParty::Request.new(Net::HTTP::Get, 'http://google.com', :parser => my_parser)
|
46
|
+
request.parser.should == my_parser
|
47
|
+
end
|
48
|
+
|
49
|
+
it "sets connection_adapter to HTTPParty::ConnectionAdapter" do
|
50
|
+
request = HTTParty::Request.new(Net::HTTP::Get, 'http://google.com')
|
51
|
+
request.connection_adapter.should == HTTParty::ConnectionAdapter
|
52
|
+
end
|
53
|
+
|
54
|
+
it "sets connection_adapter to the optional connection_adapter" do
|
55
|
+
my_adapter = lambda {}
|
56
|
+
request = HTTParty::Request.new(Net::HTTP::Get, 'http://google.com', :connection_adapter => my_adapter)
|
57
|
+
request.connection_adapter.should == my_adapter
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#format" do
|
62
|
+
context "request yet to be made" do
|
63
|
+
it "returns format option" do
|
64
|
+
request = HTTParty::Request.new 'get', '/', :format => :xml
|
65
|
+
request.format.should == :xml
|
66
|
+
end
|
67
|
+
|
68
|
+
it "returns nil format" do
|
69
|
+
request = HTTParty::Request.new 'get', '/'
|
70
|
+
request.format.should be_nil
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
context "request has been made" do
|
75
|
+
it "returns format option" do
|
76
|
+
request = HTTParty::Request.new 'get', '/', :format => :xml
|
77
|
+
request.last_response = stub
|
78
|
+
request.format.should == :xml
|
79
|
+
end
|
80
|
+
|
81
|
+
it "returns the content-type from the last response when the option is not set" do
|
82
|
+
request = HTTParty::Request.new 'get', '/'
|
83
|
+
response = stub
|
84
|
+
response.should_receive(:[]).with('content-type').and_return('text/json')
|
85
|
+
request.last_response = response
|
86
|
+
request.format.should == :json
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
context "options" do
|
93
|
+
it "should use basic auth when configured" do
|
94
|
+
@request.options[:basic_auth] = {:username => 'foobar', :password => 'secret'}
|
95
|
+
@request.send(:setup_raw_request)
|
96
|
+
@request.instance_variable_get(:@raw_request)['authorization'].should_not be_nil
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should use digest auth when configured" do
|
100
|
+
FakeWeb.register_uri(:get, "http://api.foo.com/v1",
|
101
|
+
:www_authenticate => 'Digest realm="Log Viewer", qop="auth", nonce="2CA0EC6B0E126C4800E56BA0C0003D3C", opaque="5ccc069c403ebaf9f0171e9517f40e41", stale=false')
|
102
|
+
|
103
|
+
@request.options[:digest_auth] = {:username => 'foobar', :password => 'secret'}
|
104
|
+
@request.send(:setup_raw_request)
|
105
|
+
|
106
|
+
raw_request = @request.instance_variable_get(:@raw_request)
|
107
|
+
raw_request.instance_variable_get(:@header)['Authorization'].should_not be_nil
|
108
|
+
end
|
109
|
+
|
110
|
+
it "should use the right http method for digest authentication" do
|
111
|
+
@post_request = HTTParty::Request.new(Net::HTTP::Post, 'http://api.foo.com/v1', :format => :xml)
|
112
|
+
FakeWeb.register_uri(:post, "http://api.foo.com/v1", {})
|
113
|
+
|
114
|
+
http = @post_request.send(:http)
|
115
|
+
@post_request.should_receive(:http).and_return(http)
|
116
|
+
http.should_not_receive(:head).and_return({'www-authenticate' => nil})
|
117
|
+
@post_request.options[:digest_auth] = {:username => 'foobar', :password => 'secret'}
|
118
|
+
@post_request.send(:setup_raw_request)
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
describe "#uri" do
|
123
|
+
context "query strings" do
|
124
|
+
it "does not add an empty query string when default_params are blank" do
|
125
|
+
@request.options[:default_params] = {}
|
126
|
+
@request.uri.query.should be_nil
|
127
|
+
end
|
128
|
+
|
129
|
+
it "respects the query string normalization proc" do
|
130
|
+
empty_proc = lambda {|qs| ""}
|
131
|
+
@request.options[:query_string_normalizer] = empty_proc
|
132
|
+
@request.options[:query] = {:foo => :bar}
|
133
|
+
URI.unescape(@request.uri.query).should == ""
|
134
|
+
end
|
135
|
+
|
136
|
+
it "does not duplicate query string parameters when uri is called twice" do
|
137
|
+
@request.options[:query] = {:foo => :bar}
|
138
|
+
@request.uri
|
139
|
+
@request.uri.query.should == "foo=bar"
|
140
|
+
end
|
141
|
+
|
142
|
+
context "when representing an array" do
|
143
|
+
it "returns a Rails style query string" do
|
144
|
+
@request.options[:query] = {:foo => %w(bar baz)}
|
145
|
+
URI.unescape(@request.uri.query).should == "foo[]=bar&foo[]=baz"
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
describe "#setup_raw_request" do
|
153
|
+
context "when query_string_normalizer is set" do
|
154
|
+
it "sets the body to the return value of the proc" do
|
155
|
+
@request.options[:query_string_normalizer] = HTTParty::Request::NON_RAILS_QUERY_STRING_NORMALIZER
|
156
|
+
@request.options[:body] = {:page => 1, :foo => %w(bar baz)}
|
157
|
+
@request.send(:setup_raw_request)
|
158
|
+
body = @request.instance_variable_get(:@raw_request).body
|
159
|
+
URI.unescape(body).should == "foo=bar&foo=baz&page=1"
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
describe 'http' do
|
165
|
+
it "should get a connection from the connection_adapter" do
|
166
|
+
http = Net::HTTP.new('google.com')
|
167
|
+
adapter = mock('adapter')
|
168
|
+
request = HTTParty::Request.new(Net::HTTP::Get, 'https://api.foo.com/v1:443', :connection_adapter => adapter)
|
169
|
+
adapter.should_receive(:call).with(request.uri, request.options).and_return(http)
|
170
|
+
request.send(:http).should be http
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
describe '#format_from_mimetype' do
|
175
|
+
it 'should handle text/xml' do
|
176
|
+
["text/xml", "text/xml; charset=iso8859-1"].each do |ct|
|
177
|
+
@request.send(:format_from_mimetype, ct).should == :xml
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
it 'should handle application/xml' do
|
182
|
+
["application/xml", "application/xml; charset=iso8859-1"].each do |ct|
|
183
|
+
@request.send(:format_from_mimetype, ct).should == :xml
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
it 'should handle text/json' do
|
188
|
+
["text/json", "text/json; charset=iso8859-1"].each do |ct|
|
189
|
+
@request.send(:format_from_mimetype, ct).should == :json
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'should handle application/json' do
|
194
|
+
["application/json", "application/json; charset=iso8859-1"].each do |ct|
|
195
|
+
@request.send(:format_from_mimetype, ct).should == :json
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
it 'should handle text/javascript' do
|
200
|
+
["text/javascript", "text/javascript; charset=iso8859-1"].each do |ct|
|
201
|
+
@request.send(:format_from_mimetype, ct).should == :json
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
205
|
+
it 'should handle application/javascript' do
|
206
|
+
["application/javascript", "application/javascript; charset=iso8859-1"].each do |ct|
|
207
|
+
@request.send(:format_from_mimetype, ct).should == :json
|
208
|
+
end
|
209
|
+
end
|
210
|
+
|
211
|
+
it "returns nil for an unrecognized mimetype" do
|
212
|
+
@request.send(:format_from_mimetype, "application/atom+xml").should be_nil
|
213
|
+
end
|
214
|
+
|
215
|
+
it "returns nil when using a default parser" do
|
216
|
+
@request.options[:parser] = lambda {}
|
217
|
+
@request.send(:format_from_mimetype, "text/json").should be_nil
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
describe 'parsing responses' do
|
222
|
+
it 'should handle xml automatically' do
|
223
|
+
xml = %q[<books><book><id>1234</id><name>Foo Bar!</name></book></books>]
|
224
|
+
@request.options[:format] = :xml
|
225
|
+
@request.send(:parse_response, xml).should == {'books' => {'book' => {'id' => '1234', 'name' => 'Foo Bar!'}}}
|
226
|
+
end
|
227
|
+
|
228
|
+
it 'should handle json automatically' do
|
229
|
+
json = %q[{"books": {"book": {"name": "Foo Bar!", "id": "1234"}}}]
|
230
|
+
@request.options[:format] = :json
|
231
|
+
@request.send(:parse_response, json).should == {'books' => {'book' => {'id' => '1234', 'name' => 'Foo Bar!'}}}
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should include any HTTP headers in the returned response" do
|
235
|
+
@request.options[:format] = :html
|
236
|
+
response = stub_response "Content"
|
237
|
+
response.initialize_http_header("key" => "value")
|
238
|
+
|
239
|
+
@request.perform.headers.should == { "key" => ["value"] }
|
240
|
+
end
|
241
|
+
|
242
|
+
describe 'with non-200 responses' do
|
243
|
+
context "3xx responses" do
|
244
|
+
it 'returns a valid object for 304 not modified' do
|
245
|
+
stub_response '', 304
|
246
|
+
resp = @request.perform
|
247
|
+
resp.code.should == 304
|
248
|
+
resp.body.should == ''
|
249
|
+
resp.should be_nil
|
250
|
+
end
|
251
|
+
|
252
|
+
it "redirects if a 300 contains a location header" do
|
253
|
+
redirect = stub_response '', 300
|
254
|
+
redirect['location'] = 'http://foo.com/foo'
|
255
|
+
ok = stub_response('<hash><foo>bar</foo></hash>', 200)
|
256
|
+
@http.stub!(:request).and_return(redirect, ok)
|
257
|
+
response = @request.perform
|
258
|
+
response.request.base_uri.to_s.should == "http://foo.com"
|
259
|
+
response.request.path.to_s.should == "http://foo.com/foo"
|
260
|
+
response.request.uri.request_uri.should == "/foo"
|
261
|
+
response.request.uri.to_s.should == "http://foo.com/foo"
|
262
|
+
response.should == {"hash" => {"foo" => "bar"}}
|
263
|
+
end
|
264
|
+
|
265
|
+
it "calls block given to perform with each redirect" do
|
266
|
+
@request = HTTParty::Request.new(Net::HTTP::Get, 'http://test.com/redirect', :format => :xml)
|
267
|
+
FakeWeb.register_uri(:get, "http://test.com/redirect", :status => [300, "REDIRECT"], :location => "http://api.foo.com/v2")
|
268
|
+
FakeWeb.register_uri(:get, "http://api.foo.com/v2", :body => "<hash><foo>bar</foo></hash>")
|
269
|
+
body = ""
|
270
|
+
response = @request.perform { |chunk| body += chunk }
|
271
|
+
body.length.should == 27
|
272
|
+
end
|
273
|
+
|
274
|
+
it "redirects if a 300 contains a relative location header" do
|
275
|
+
redirect = stub_response '', 300
|
276
|
+
redirect['location'] = '/foo/bar'
|
277
|
+
ok = stub_response('<hash><foo>bar</foo></hash>', 200)
|
278
|
+
@http.stub!(:request).and_return(redirect, ok)
|
279
|
+
response = @request.perform
|
280
|
+
response.request.base_uri.to_s.should == "http://api.foo.com"
|
281
|
+
response.request.path.to_s.should == "/foo/bar"
|
282
|
+
response.request.uri.request_uri.should == "/foo/bar"
|
283
|
+
response.request.uri.to_s.should == "http://api.foo.com/foo/bar"
|
284
|
+
response.should == {"hash" => {"foo" => "bar"}}
|
285
|
+
end
|
286
|
+
|
287
|
+
it "handles multiple redirects and relative location headers on different hosts" do
|
288
|
+
@request = HTTParty::Request.new(Net::HTTP::Get, 'http://test.com/redirect', :format => :xml)
|
289
|
+
FakeWeb.register_uri(:get, "http://test.com/redirect", :status => [300, "REDIRECT"], :location => "http://api.foo.com/v2")
|
290
|
+
FakeWeb.register_uri(:get, "http://api.foo.com/v2", :status => [300, "REDIRECT"], :location => "/v3")
|
291
|
+
FakeWeb.register_uri(:get, "http://api.foo.com/v3", :body => "<hash><foo>bar</foo></hash>")
|
292
|
+
response = @request.perform
|
293
|
+
response.request.base_uri.to_s.should == "http://api.foo.com"
|
294
|
+
response.request.path.to_s.should == "/v3"
|
295
|
+
response.request.uri.request_uri.should == "/v3"
|
296
|
+
response.request.uri.to_s.should == "http://api.foo.com/v3"
|
297
|
+
response.should == {"hash" => {"foo" => "bar"}}
|
298
|
+
end
|
299
|
+
|
300
|
+
it "returns the HTTParty::Response when the 300 does not contain a location header" do
|
301
|
+
stub_response '', 300
|
302
|
+
HTTParty::Response.should === @request.perform
|
303
|
+
end
|
304
|
+
end
|
305
|
+
|
306
|
+
it 'should return a valid object for 4xx response' do
|
307
|
+
stub_response '<foo><bar>yes</bar></foo>', 401
|
308
|
+
resp = @request.perform
|
309
|
+
resp.code.should == 401
|
310
|
+
resp.body.should == "<foo><bar>yes</bar></foo>"
|
311
|
+
resp['foo']['bar'].should == "yes"
|
312
|
+
end
|
313
|
+
|
314
|
+
it 'should return a valid object for 5xx response' do
|
315
|
+
stub_response '<foo><bar>error</bar></foo>', 500
|
316
|
+
resp = @request.perform
|
317
|
+
resp.code.should == 500
|
318
|
+
resp.body.should == "<foo><bar>error</bar></foo>"
|
319
|
+
resp['foo']['bar'].should == "error"
|
320
|
+
end
|
321
|
+
|
322
|
+
it "parses response lazily so codes can be checked prior" do
|
323
|
+
stub_response 'not xml', 500
|
324
|
+
@request.options[:format] = :xml
|
325
|
+
lambda {
|
326
|
+
response = @request.perform
|
327
|
+
response.code.should == 500
|
328
|
+
response.body.should == 'not xml'
|
329
|
+
}.should_not raise_error
|
330
|
+
end
|
331
|
+
end
|
332
|
+
end
|
333
|
+
|
334
|
+
it "should not attempt to parse empty responses" do
|
335
|
+
[204, 304].each do |code|
|
336
|
+
stub_response "", code
|
337
|
+
|
338
|
+
@request.options[:format] = :xml
|
339
|
+
@request.perform.should be_nil
|
340
|
+
end
|
341
|
+
end
|
342
|
+
|
343
|
+
it "should not fail for missing mime type" do
|
344
|
+
stub_response "Content for you"
|
345
|
+
@request.options[:format] = :html
|
346
|
+
@request.perform.should == 'Content for you'
|
347
|
+
end
|
348
|
+
|
349
|
+
describe "a request that redirects" do
|
350
|
+
before(:each) do
|
351
|
+
@redirect = stub_response("", 302)
|
352
|
+
@redirect['location'] = '/foo'
|
353
|
+
|
354
|
+
@ok = stub_response('<hash><foo>bar</foo></hash>', 200)
|
355
|
+
end
|
356
|
+
|
357
|
+
describe "once" do
|
358
|
+
before(:each) do
|
359
|
+
@http.stub!(:request).and_return(@redirect, @ok)
|
360
|
+
end
|
361
|
+
|
362
|
+
it "should be handled by GET transparently" do
|
363
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
364
|
+
end
|
365
|
+
|
366
|
+
it "should be handled by POST transparently" do
|
367
|
+
@request.http_method = Net::HTTP::Post
|
368
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
369
|
+
end
|
370
|
+
|
371
|
+
it "should be handled by DELETE transparently" do
|
372
|
+
@request.http_method = Net::HTTP::Delete
|
373
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
374
|
+
end
|
375
|
+
|
376
|
+
it "should be handled by MOVE transparently" do
|
377
|
+
@request.http_method = Net::HTTP::Move
|
378
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
379
|
+
end
|
380
|
+
|
381
|
+
it "should be handled by COPY transparently" do
|
382
|
+
@request.http_method = Net::HTTP::Copy
|
383
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
384
|
+
end
|
385
|
+
|
386
|
+
it "should be handled by PATCH transparently" do
|
387
|
+
@request.http_method = Net::HTTP::Patch
|
388
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
389
|
+
end
|
390
|
+
|
391
|
+
it "should be handled by PUT transparently" do
|
392
|
+
@request.http_method = Net::HTTP::Put
|
393
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
394
|
+
end
|
395
|
+
|
396
|
+
it "should be handled by HEAD transparently" do
|
397
|
+
@request.http_method = Net::HTTP::Head
|
398
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
399
|
+
end
|
400
|
+
|
401
|
+
it "should be handled by OPTIONS transparently" do
|
402
|
+
@request.http_method = Net::HTTP::Options
|
403
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should keep track of cookies between redirects" do
|
407
|
+
@redirect['Set-Cookie'] = 'foo=bar; name=value; HTTPOnly'
|
408
|
+
@request.perform
|
409
|
+
@request.options[:headers]['Cookie'].should match(/foo=bar/)
|
410
|
+
@request.options[:headers]['Cookie'].should match(/name=value/)
|
411
|
+
end
|
412
|
+
|
413
|
+
it 'should update cookies with rediects' do
|
414
|
+
@request.options[:headers] = {'Cookie'=> 'foo=bar;'}
|
415
|
+
@redirect['Set-Cookie'] = 'foo=tar;'
|
416
|
+
@request.perform
|
417
|
+
@request.options[:headers]['Cookie'].should match(/foo=tar/)
|
418
|
+
end
|
419
|
+
|
420
|
+
it 'should keep cookies between rediects' do
|
421
|
+
@request.options[:headers] = {'Cookie'=> 'keep=me'}
|
422
|
+
@redirect['Set-Cookie'] = 'foo=tar;'
|
423
|
+
@request.perform
|
424
|
+
@request.options[:headers]['Cookie'].should match(/keep=me/)
|
425
|
+
end
|
426
|
+
|
427
|
+
it 'should make resulting request a get request if it not already' do
|
428
|
+
@request.http_method = Net::HTTP::Delete
|
429
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
430
|
+
@request.http_method.should == Net::HTTP::Get
|
431
|
+
end
|
432
|
+
|
433
|
+
it 'should not make resulting request a get request if options[:maintain_method_across_redirects] is true' do
|
434
|
+
@request.options[:maintain_method_across_redirects] = true
|
435
|
+
@request.http_method = Net::HTTP::Delete
|
436
|
+
@request.perform.should == {"hash" => {"foo" => "bar"}}
|
437
|
+
@request.http_method.should == Net::HTTP::Delete
|
438
|
+
end
|
439
|
+
end
|
440
|
+
|
441
|
+
describe "infinitely" do
|
442
|
+
before(:each) do
|
443
|
+
@http.stub!(:request).and_return(@redirect)
|
444
|
+
end
|
445
|
+
|
446
|
+
it "should raise an exception" do
|
447
|
+
lambda { @request.perform }.should raise_error(HTTParty::RedirectionTooDeep)
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
|
452
|
+
describe "#handle_deflation" do
|
453
|
+
context "context-encoding" do
|
454
|
+
before do
|
455
|
+
@request.options[:format] = :html
|
456
|
+
@last_response = mock()
|
457
|
+
@last_response.stub!(:body).and_return('')
|
458
|
+
end
|
459
|
+
|
460
|
+
it "should inflate the gzipped body with content-encoding: gzip" do
|
461
|
+
@last_response.stub!(:[]).with("content-encoding").and_return("gzip")
|
462
|
+
@request.stub!(:last_response).and_return(@last_response)
|
463
|
+
Zlib::GzipReader.should_receive(:new).and_return(StringIO.new(''))
|
464
|
+
@request.last_response.should_receive(:delete).with('content-encoding')
|
465
|
+
@request.send(:handle_deflation)
|
466
|
+
end
|
467
|
+
|
468
|
+
it "should inflate the gzipped body with content-encoding: x-gzip" do
|
469
|
+
@last_response.stub!(:[]).with("content-encoding").and_return("x-gzip")
|
470
|
+
@request.stub!(:last_response).and_return(@last_response)
|
471
|
+
Zlib::GzipReader.should_receive(:new).and_return(StringIO.new(''))
|
472
|
+
@request.last_response.should_receive(:delete).with('content-encoding')
|
473
|
+
@request.send(:handle_deflation)
|
474
|
+
end
|
475
|
+
|
476
|
+
it "should inflate the deflated body" do
|
477
|
+
@last_response.stub!(:[]).with("content-encoding").and_return("deflate")
|
478
|
+
@request.stub!(:last_response).and_return(@last_response)
|
479
|
+
Zlib::Inflate.should_receive(:inflate).and_return('')
|
480
|
+
@request.last_response.should_receive(:delete).with('content-encoding')
|
481
|
+
@request.send(:handle_deflation)
|
482
|
+
end
|
483
|
+
end
|
484
|
+
end
|
485
|
+
|
486
|
+
context "with POST http method" do
|
487
|
+
it "should raise argument error if query is not a hash" do
|
488
|
+
lambda {
|
489
|
+
HTTParty::Request.new(Net::HTTP::Post, 'http://api.foo.com/v1', :format => :xml, :query => 'astring').perform
|
490
|
+
}.should raise_error(ArgumentError)
|
491
|
+
end
|
492
|
+
end
|
493
|
+
|
494
|
+
describe "argument validation" do
|
495
|
+
it "should raise argument error if basic_auth and digest_auth are both present" do
|
496
|
+
lambda {
|
497
|
+
HTTParty::Request.new(Net::HTTP::Post, 'http://api.foo.com/v1', :basic_auth => {}, :digest_auth => {}).perform
|
498
|
+
}.should raise_error(ArgumentError, "only one authentication method, :basic_auth or :digest_auth may be used at a time")
|
499
|
+
end
|
500
|
+
|
501
|
+
it "should raise argument error if basic_auth is not a hash" do
|
502
|
+
lambda {
|
503
|
+
HTTParty::Request.new(Net::HTTP::Post, 'http://api.foo.com/v1', :basic_auth => ["foo", "bar"]).perform
|
504
|
+
}.should raise_error(ArgumentError, ":basic_auth must be a hash")
|
505
|
+
end
|
506
|
+
|
507
|
+
it "should raise argument error if digest_auth is not a hash" do
|
508
|
+
lambda {
|
509
|
+
HTTParty::Request.new(Net::HTTP::Post, 'http://api.foo.com/v1', :digest_auth => ["foo", "bar"]).perform
|
510
|
+
}.should raise_error(ArgumentError, ":digest_auth must be a hash")
|
511
|
+
end
|
512
|
+
end
|
513
|
+
end
|
514
|
+
|