allegro_api_client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (296) hide show
  1. checksums.yaml +7 -0
  2. data/.bundle/config +3 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +25 -0
  5. data/README.md +19 -0
  6. data/apiclient.gemspec +24 -0
  7. data/gems/ruby/2.1.0/bin/httparty +23 -0
  8. data/gems/ruby/2.1.0/bin/rake +23 -0
  9. data/gems/ruby/2.1.0/build_info/git_repository-0.0.11.info +1 -0
  10. data/gems/ruby/2.1.0/build_info/httparty-0.13.1.info +1 -0
  11. data/gems/ruby/2.1.0/build_info/multi_xml-0.5.5.info +1 -0
  12. data/gems/ruby/2.1.0/build_info/rake-10.3.2.info +1 -0
  13. data/gems/ruby/2.1.0/cache/git_repository-0.0.11.gem +0 -0
  14. data/gems/ruby/2.1.0/cache/httparty-0.13.1.gem +0 -0
  15. data/gems/ruby/2.1.0/cache/multi_xml-0.5.5.gem +0 -0
  16. data/gems/ruby/2.1.0/cache/rake-10.3.2.gem +0 -0
  17. data/gems/ruby/2.1.0/gems/git_repository-0.0.11/lib/git_repository.rb +62 -0
  18. data/gems/ruby/2.1.0/gems/httparty-0.13.1/.gitignore +10 -0
  19. data/gems/ruby/2.1.0/gems/httparty-0.13.1/.travis.yml +7 -0
  20. data/gems/ruby/2.1.0/gems/httparty-0.13.1/Gemfile +14 -0
  21. data/gems/ruby/2.1.0/gems/httparty-0.13.1/Guardfile +16 -0
  22. data/gems/ruby/2.1.0/gems/httparty-0.13.1/History +303 -0
  23. data/gems/ruby/2.1.0/gems/httparty-0.13.1/MIT-LICENSE +20 -0
  24. data/gems/ruby/2.1.0/gems/httparty-0.13.1/README.md +74 -0
  25. data/gems/ruby/2.1.0/gems/httparty-0.13.1/Rakefile +12 -0
  26. data/gems/ruby/2.1.0/gems/httparty-0.13.1/bin/httparty +117 -0
  27. data/gems/ruby/2.1.0/gems/httparty-0.13.1/cucumber.yml +1 -0
  28. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/aaws.rb +32 -0
  29. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/basic.rb +28 -0
  30. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/crack.rb +19 -0
  31. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/custom_parsers.rb +67 -0
  32. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/delicious.rb +37 -0
  33. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/google.rb +16 -0
  34. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/headers_and_user_agents.rb +6 -0
  35. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/nokogiri_html_parser.rb +22 -0
  36. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/rubyurl.rb +14 -0
  37. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/stackexchange.rb +24 -0
  38. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/tripit_sign_in.rb +33 -0
  39. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/twitter.rb +31 -0
  40. data/gems/ruby/2.1.0/gems/httparty-0.13.1/examples/whoismyrep.rb +10 -0
  41. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/basic_authentication.feature +20 -0
  42. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/command_line.feature +7 -0
  43. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/deals_with_http_error_codes.feature +26 -0
  44. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/digest_authentication.feature +20 -0
  45. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/handles_compressed_responses.feature +27 -0
  46. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/handles_multiple_formats.feature +57 -0
  47. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/steps/env.rb +22 -0
  48. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/steps/httparty_response_steps.rb +52 -0
  49. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/steps/httparty_steps.rb +43 -0
  50. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/steps/mongrel_helper.rb +94 -0
  51. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/steps/remote_service_steps.rb +74 -0
  52. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/supports_read_timeout_option.feature +13 -0
  53. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/supports_redirection.feature +22 -0
  54. data/gems/ruby/2.1.0/gems/httparty-0.13.1/features/supports_timeout_option.feature +13 -0
  55. data/gems/ruby/2.1.0/gems/httparty-0.13.1/httparty.gemspec +26 -0
  56. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty.rb +600 -0
  57. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/connection_adapter.rb +187 -0
  58. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/cookie_hash.rb +22 -0
  59. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/core_extensions.rb +32 -0
  60. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/exceptions.rb +29 -0
  61. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/hash_conversions.rb +51 -0
  62. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/logger/apache_logger.rb +22 -0
  63. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/logger/curl_logger.rb +48 -0
  64. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/logger/logger.rb +18 -0
  65. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/module_inheritable_attributes.rb +56 -0
  66. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/net_digest_auth.rb +84 -0
  67. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/parser.rb +141 -0
  68. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/request.rb +331 -0
  69. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/response.rb +72 -0
  70. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/response/headers.rb +31 -0
  71. data/gems/ruby/2.1.0/gems/httparty-0.13.1/lib/httparty/version.rb +3 -0
  72. data/gems/ruby/2.1.0/gems/httparty-0.13.1/script/release +42 -0
  73. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/delicious.xml +23 -0
  74. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/empty.xml +0 -0
  75. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/google.html +3 -0
  76. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/generate.sh +29 -0
  77. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/generated/1fe462c2.0 +16 -0
  78. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/generated/bogushost.crt +13 -0
  79. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/generated/ca.crt +16 -0
  80. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/generated/ca.key +15 -0
  81. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/generated/selfsigned.crt +14 -0
  82. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/generated/server.crt +13 -0
  83. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/generated/server.key +15 -0
  84. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/ssl/openssl-exts.cnf +9 -0
  85. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/twitter.csv +2 -0
  86. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/twitter.json +1 -0
  87. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/twitter.xml +403 -0
  88. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/fixtures/undefined_method_add_node_for_nil.xml +2 -0
  89. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/connection_adapter_spec.rb +354 -0
  90. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/cookie_hash_spec.rb +83 -0
  91. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/exception_spec.rb +23 -0
  92. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/logger/apache_logger_spec.rb +26 -0
  93. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/logger/curl_logger_spec.rb +18 -0
  94. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/logger/logger_spec.rb +22 -0
  95. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/net_digest_auth_spec.rb +152 -0
  96. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/parser_spec.rb +165 -0
  97. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/request_spec.rb +638 -0
  98. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/response_spec.rb +221 -0
  99. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty/ssl_spec.rb +74 -0
  100. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/httparty_spec.rb +764 -0
  101. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/spec.opts +2 -0
  102. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/spec_helper.rb +37 -0
  103. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/support/ssl_test_helper.rb +47 -0
  104. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/support/ssl_test_server.rb +80 -0
  105. data/gems/ruby/2.1.0/gems/httparty-0.13.1/spec/support/stub_response.rb +43 -0
  106. data/gems/ruby/2.1.0/gems/httparty-0.13.1/website/css/common.css +47 -0
  107. data/gems/ruby/2.1.0/gems/httparty-0.13.1/website/index.html +73 -0
  108. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/.yardopts +8 -0
  109. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/CHANGELOG.md +93 -0
  110. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/CONTRIBUTING.md +49 -0
  111. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/LICENSE.md +20 -0
  112. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/README.md +97 -0
  113. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/Rakefile +21 -0
  114. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/lib/multi_xml.rb +296 -0
  115. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/libxml.rb +30 -0
  116. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/libxml2_parser.rb +74 -0
  117. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/nokogiri.rb +32 -0
  118. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/ox.rb +97 -0
  119. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/lib/multi_xml/parsers/rexml.rb +113 -0
  120. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/lib/multi_xml/version.rb +3 -0
  121. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/multi_xml.gemspec +24 -0
  122. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/spec/helper.rb +17 -0
  123. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/spec/multi_xml_spec.rb +43 -0
  124. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/spec/parser_shared_example.rb +694 -0
  125. data/gems/ruby/2.1.0/gems/multi_xml-0.5.5/spec/speed.rb +63 -0
  126. data/gems/ruby/2.1.0/gems/rake-10.3.2/.autotest +7 -0
  127. data/gems/ruby/2.1.0/gems/rake-10.3.2/.gemtest +0 -0
  128. data/gems/ruby/2.1.0/gems/rake-10.3.2/.rubocop.yml +27 -0
  129. data/gems/ruby/2.1.0/gems/rake-10.3.2/.togglerc +7 -0
  130. data/gems/ruby/2.1.0/gems/rake-10.3.2/CONTRIBUTING.rdoc +34 -0
  131. data/gems/ruby/2.1.0/gems/rake-10.3.2/History.rdoc +609 -0
  132. data/gems/ruby/2.1.0/gems/rake-10.3.2/MIT-LICENSE +21 -0
  133. data/gems/ruby/2.1.0/gems/rake-10.3.2/Manifest.txt +162 -0
  134. data/gems/ruby/2.1.0/gems/rake-10.3.2/README.rdoc +137 -0
  135. data/gems/ruby/2.1.0/gems/rake-10.3.2/Rakefile +81 -0
  136. data/gems/ruby/2.1.0/gems/rake-10.3.2/bin/rake +33 -0
  137. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/command_line_usage.rdoc +158 -0
  138. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/example/Rakefile1 +38 -0
  139. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/example/Rakefile2 +35 -0
  140. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/example/a.c +6 -0
  141. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/example/b.c +6 -0
  142. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/example/main.c +11 -0
  143. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/glossary.rdoc +43 -0
  144. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/jamis.rb +591 -0
  145. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/proto_rake.rdoc +127 -0
  146. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/rake.1.gz +0 -0
  147. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/rakefile.rdoc +653 -0
  148. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/rational.rdoc +151 -0
  149. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.4.14.rdoc +23 -0
  150. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.4.15.rdoc +35 -0
  151. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.5.0.rdoc +53 -0
  152. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.5.3.rdoc +78 -0
  153. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.5.4.rdoc +46 -0
  154. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.6.0.rdoc +141 -0
  155. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.7.0.rdoc +119 -0
  156. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.7.1.rdoc +59 -0
  157. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.7.2.rdoc +121 -0
  158. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.7.3.rdoc +47 -0
  159. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.8.0.rdoc +114 -0
  160. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.8.2.rdoc +165 -0
  161. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.8.3.rdoc +112 -0
  162. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.8.4.rdoc +147 -0
  163. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.8.5.rdoc +53 -0
  164. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.8.6.rdoc +37 -0
  165. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.8.7.rdoc +55 -0
  166. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.9.0.rdoc +112 -0
  167. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.9.1.rdoc +52 -0
  168. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.9.2.2.rdoc +55 -0
  169. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.9.2.rdoc +49 -0
  170. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.9.3.rdoc +102 -0
  171. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.9.4.rdoc +60 -0
  172. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.9.5.rdoc +55 -0
  173. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-0.9.6.rdoc +64 -0
  174. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-10.0.0.rdoc +178 -0
  175. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-10.0.1.rdoc +58 -0
  176. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-10.0.2.rdoc +53 -0
  177. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-10.0.3.rdoc +191 -0
  178. data/gems/ruby/2.1.0/gems/rake-10.3.2/doc/release_notes/rake-10.1.0.rdoc +61 -0
  179. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake.rb +78 -0
  180. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/alt_system.rb +110 -0
  181. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/application.rb +783 -0
  182. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/backtrace.rb +23 -0
  183. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/clean.rb +76 -0
  184. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cloneable.rb +16 -0
  185. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/.document +0 -0
  186. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/compositepublisher.rb +21 -0
  187. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/ftptools.rb +137 -0
  188. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/publisher.rb +81 -0
  189. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/rubyforgepublisher.rb +18 -0
  190. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sshpublisher.rb +61 -0
  191. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/contrib/sys.rb +4 -0
  192. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/cpu_counter.rb +109 -0
  193. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/default_loader.rb +14 -0
  194. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/dsl_definition.rb +198 -0
  195. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/early_time.rb +21 -0
  196. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/core.rb +25 -0
  197. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/module.rb +1 -0
  198. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/string.rb +173 -0
  199. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ext/time.rb +15 -0
  200. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_creation_task.rb +24 -0
  201. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_list.rb +414 -0
  202. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_task.rb +46 -0
  203. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils.rb +116 -0
  204. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/file_utils_ext.rb +144 -0
  205. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/gempackagetask.rb +4 -0
  206. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_chain.rb +56 -0
  207. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/invocation_exception_mixin.rb +16 -0
  208. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/linked_list.rb +103 -0
  209. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/loaders/makefile.rb +40 -0
  210. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/multi_task.rb +13 -0
  211. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/name_space.rb +38 -0
  212. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/packagetask.rb +202 -0
  213. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pathmap.rb +3 -0
  214. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/phony.rb +15 -0
  215. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/private_reader.rb +20 -0
  216. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/promise.rb +99 -0
  217. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/pseudo_status.rb +29 -0
  218. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_module.rb +38 -0
  219. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rake_test_loader.rb +22 -0
  220. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rdoctask.rb +4 -0
  221. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/ruby182_test_unit_fix.rb +29 -0
  222. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/rule_recursion_overflow_error.rb +20 -0
  223. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/runtest.rb +27 -0
  224. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/scope.rb +42 -0
  225. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task.rb +383 -0
  226. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_argument_error.rb +7 -0
  227. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_arguments.rb +98 -0
  228. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/task_manager.rb +310 -0
  229. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/tasklib.rb +24 -0
  230. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/testtask.rb +212 -0
  231. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_history_display.rb +48 -0
  232. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/thread_pool.rb +164 -0
  233. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/trace_output.rb +22 -0
  234. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/version.rb +7 -0
  235. data/gems/ruby/2.1.0/gems/rake-10.3.2/lib/rake/win32.rb +56 -0
  236. data/gems/ruby/2.1.0/gems/rake-10.3.2/rakelib/publish.rake +20 -0
  237. data/gems/ruby/2.1.0/gems/rake-10.3.2/rakelib/test_times.rake +25 -0
  238. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/file_creation.rb +34 -0
  239. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/helper.rb +127 -0
  240. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/support/rakefile_definitions.rb +478 -0
  241. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/support/ruby_runner.rb +33 -0
  242. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_private_reader.rb +42 -0
  243. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake.rb +40 -0
  244. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application.rb +641 -0
  245. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_application_options.rb +466 -0
  246. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_backtrace.rb +119 -0
  247. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_clean.rb +55 -0
  248. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_cpu_counter.rb +50 -0
  249. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_definitions.rb +79 -0
  250. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_directory_task.rb +63 -0
  251. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_dsl.rb +40 -0
  252. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_early_time.rb +31 -0
  253. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_extension.rb +59 -0
  254. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_creation_task.rb +56 -0
  255. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list.rb +627 -0
  256. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_list_path_map.rb +8 -0
  257. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_task.rb +186 -0
  258. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_file_utils.rb +309 -0
  259. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_ftp_file.rb +74 -0
  260. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_functional.rb +482 -0
  261. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_invocation_chain.rb +64 -0
  262. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_linked_list.rb +84 -0
  263. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_makefile_loader.rb +46 -0
  264. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_multi_task.rb +58 -0
  265. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_name_space.rb +57 -0
  266. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_package_task.rb +79 -0
  267. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map.rb +168 -0
  268. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_explode.rb +34 -0
  269. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_path_map_partial.rb +18 -0
  270. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_pseudo_status.rb +21 -0
  271. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rake_test_loader.rb +20 -0
  272. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_reduce_compat.rb +26 -0
  273. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_require.rb +40 -0
  274. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_rules.rb +388 -0
  275. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_scope.rb +44 -0
  276. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task.rb +392 -0
  277. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_argument_parsing.rb +109 -0
  278. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_arguments.rb +127 -0
  279. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_lib.rb +9 -0
  280. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager.rb +178 -0
  281. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_manager_argument_resolution.rb +19 -0
  282. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_task_with_arguments.rb +171 -0
  283. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_test_task.rb +141 -0
  284. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_thread_pool.rb +142 -0
  285. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_top_level_functions.rb +71 -0
  286. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_rake_win32.rb +72 -0
  287. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_thread_history_display.rb +101 -0
  288. data/gems/ruby/2.1.0/gems/rake-10.3.2/test/test_trace_output.rb +52 -0
  289. data/gems/ruby/2.1.0/specifications/git_repository-0.0.11.gemspec +16 -0
  290. data/gems/ruby/2.1.0/specifications/httparty-0.13.1.gemspec +36 -0
  291. data/gems/ruby/2.1.0/specifications/multi_xml-0.5.5.gemspec +31 -0
  292. data/gems/ruby/2.1.0/specifications/rake-10.3.2.gemspec +43 -0
  293. data/rakefile.rb +33 -0
  294. data/src/APIClient.rb +23 -0
  295. data/test/test_git_repository_commit.rb +19 -0
  296. metadata +395 -0
@@ -0,0 +1,74 @@
1
+ Given /a remote service that returns '(.*)'/ do |response_body|
2
+ @handler = BasicMongrelHandler.new
3
+ Given "the response from the service has a body of '#{response_body}'"
4
+ end
5
+
6
+ Given /^a remote service that returns:$/ do |response_body|
7
+ @handler = BasicMongrelHandler.new
8
+ @handler.response_body = response_body
9
+ end
10
+
11
+ Given /a remote service that returns a (\d+) status code/ do |code|
12
+ @handler = BasicMongrelHandler.new
13
+ @handler.response_code = code
14
+ end
15
+
16
+ Given /that service is accessed at the path '(.*)'/ do |path|
17
+ @server.register(path, @handler)
18
+ end
19
+
20
+ Given /^that service takes (\d+) seconds to generate a response$/ do |time|
21
+ @server_response_time = time.to_i
22
+ @handler.preprocessor = Proc.new { sleep time.to_i }
23
+ end
24
+
25
+ Given /^a remote deflate service$/ do
26
+ @handler = DeflateHandler.new
27
+ end
28
+
29
+ Given /^a remote gzip service$/ do
30
+ @handler = GzipHandler.new
31
+ end
32
+
33
+ Given /the response from the service has a Content-Type of '(.*)'/ do |content_type|
34
+ @handler.content_type = content_type
35
+ end
36
+
37
+ Given /the response from the service has a body of '(.*)'/ do |response_body|
38
+ @handler.response_body = response_body
39
+ end
40
+
41
+ Given /the url '(.*)' redirects to '(.*)'/ do |redirection_url, target_url|
42
+ @server.register redirection_url, new_mongrel_redirector(target_url)
43
+ end
44
+
45
+ Given /that service is protected by Basic Authentication/ do
46
+ @handler.extend BasicAuthentication
47
+ end
48
+
49
+ Given /that service is protected by Digest Authentication/ do
50
+ @handler.extend DigestAuthentication
51
+ end
52
+
53
+ Given /that service requires the username '(.*)' with the password '(.*)'/ do |username, password|
54
+ @handler.username = username
55
+ @handler.password = password
56
+ end
57
+
58
+ Given /a restricted page at '(.*)'/ do |url|
59
+ Given "a remote service that returns 'A response I will never see'"
60
+ And "that service is accessed at the path '#{url}'"
61
+ And "that service is protected by Basic Authentication"
62
+ And "that service requires the username 'something' with the password 'secret'"
63
+ end
64
+
65
+ # This joins the server thread, and halts cucumber, so you can actually hit the
66
+ # server with a browser. Runs until you kill it with Ctrl-c
67
+ Given /I want to hit this in a browser/ do
68
+ @server.acceptor.join
69
+ end
70
+
71
+ Then /I wait for the server to recover/ do
72
+ timeout = @request_options[:timeout] || 0
73
+ sleep @server_response_time - timeout
74
+ end
@@ -0,0 +1,13 @@
1
+ Feature: Supports the read timeout option
2
+ In order to handle inappropriately slow response times
3
+ As a developer
4
+ I want my request to raise an exception after my specified read_timeout as elapsed
5
+
6
+ Scenario: A long running response
7
+ Given a remote service that returns '<h1>Some HTML</h1>'
8
+ And that service is accessed at the path '/long_running_service.html'
9
+ And that service takes 2 seconds to generate a response
10
+ When I set my HTTParty read_timeout option to 1
11
+ And I call HTTParty#get with '/long_running_service.html'
12
+ Then it should raise a Timeout::Error exception
13
+ And I wait for the server to recover
@@ -0,0 +1,22 @@
1
+ Feature: Supports Redirection
2
+
3
+ As a developer
4
+ I want to work with services that may redirect me
5
+ And I want it to follow a reasonable number of redirects
6
+ Because sometimes web services do that
7
+
8
+ Scenario: A service that redirects once
9
+ Given a remote service that returns 'Service Response'
10
+ And that service is accessed at the path '/landing_service.html'
11
+ And the url '/redirector.html' redirects to '/landing_service.html'
12
+ When I call HTTParty#get with '/redirector.html'
13
+ Then the return value should match 'Service Response'
14
+
15
+ # TODO: Look in to why this actually fails...
16
+ Scenario: A service that redirects to a relative URL
17
+
18
+ Scenario: A service that redirects infinitely
19
+ Given the url '/first.html' redirects to '/second.html'
20
+ And the url '/second.html' redirects to '/first.html'
21
+ When I call HTTParty#get with '/first.html'
22
+ Then it should raise an HTTParty::RedirectionTooDeep exception
@@ -0,0 +1,13 @@
1
+ Feature: Supports the timeout option
2
+ In order to handle inappropriately slow response times
3
+ As a developer
4
+ I want my request to raise an exception after my specified timeout as elapsed
5
+
6
+ Scenario: A long running response
7
+ Given a remote service that returns '<h1>Some HTML</h1>'
8
+ And that service is accessed at the path '/long_running_service.html'
9
+ And that service takes 2 seconds to generate a response
10
+ When I set my HTTParty timeout option to 1
11
+ And I call HTTParty#get with '/long_running_service.html'
12
+ Then it should raise a Timeout::Error exception
13
+ And I wait for the server to recover
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "httparty/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "httparty"
7
+ s.version = HTTParty::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["John Nunemaker", "Sandro Turriate"]
10
+ s.email = ["nunemaker@gmail.com"]
11
+ s.homepage = "http://jnunemaker.github.com/httparty"
12
+ s.summary = %q{Makes http fun! Also, makes consuming restful web services dead easy.}
13
+ s.description = %q{Makes http fun! Also, makes consuming restful web services dead easy.}
14
+
15
+ s.required_ruby_version = '>= 1.9.3'
16
+
17
+ s.add_dependency 'json', "~> 1.8"
18
+ s.add_dependency 'multi_xml', ">= 0.5.2"
19
+
20
+ s.post_install_message = "When you HTTParty, you must party hard!"
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
+ s.require_paths = ["lib"]
26
+ end
@@ -0,0 +1,600 @@
1
+ require 'pathname'
2
+ require 'net/http'
3
+ require 'net/https'
4
+ require 'uri'
5
+ require 'zlib'
6
+ require 'multi_xml'
7
+ require 'json'
8
+ require 'csv'
9
+
10
+ require 'httparty/module_inheritable_attributes'
11
+ require 'httparty/cookie_hash'
12
+ require 'httparty/net_digest_auth'
13
+ require 'httparty/version'
14
+ require 'httparty/connection_adapter'
15
+ require 'httparty/logger/logger'
16
+
17
+ # @see HTTParty::ClassMethods
18
+ module HTTParty
19
+ module AllowedFormatsDeprecation
20
+ def const_missing(const)
21
+ if const.to_s =~ /AllowedFormats$/
22
+ Kernel.warn("Deprecated: Use HTTParty::Parser::SupportedFormats")
23
+ HTTParty::Parser::SupportedFormats
24
+ else
25
+ super
26
+ end
27
+ end
28
+ end
29
+
30
+ extend AllowedFormatsDeprecation
31
+
32
+ def self.included(base)
33
+ base.extend ClassMethods
34
+ base.send :include, HTTParty::ModuleInheritableAttributes
35
+ base.send(:mattr_inheritable, :default_options)
36
+ base.send(:mattr_inheritable, :default_cookies)
37
+ base.instance_variable_set("@default_options", {})
38
+ base.instance_variable_set("@default_cookies", CookieHash.new)
39
+ end
40
+
41
+ # == Common Request Options
42
+ # Request methods (get, post, patch, put, delete, head, options) all take a common set of options. These are:
43
+ #
44
+ # [:+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.
45
+ # [:+http_proxyaddr+:] Address of proxy server to use.
46
+ # [:+http_proxyport+:] Port of proxy server to use.
47
+ # [:+http_proxyuser+:] User for proxy server authentication.
48
+ # [:+http_proxypass+:] Password for proxy server authentication.
49
+ # [:+limit+:] Maximum number of redirects to follow. Takes precedences over :+no_follow+.
50
+ # [:+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.
51
+ # [:+timeout+:] Timeout for opening connection and reading data.
52
+ # [:+local_host:] Local address to bind to before connecting.
53
+ # [:+local_port:] Local port to bind to before connecting.
54
+ #
55
+ # 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:
56
+ # * :+base_uri+: see HTTParty::ClassMethods.base_uri.
57
+ # * :+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.
58
+ # * :+debug_output+: see HTTParty::ClassMethods.debug_output.
59
+ # * :+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.
60
+ # * :+format+: see HTTParty::ClassMethods.format.
61
+ # * :+headers+: see HTTParty::ClassMethods.headers. Must be a Hash.
62
+ # * :+maintain_method_across_redirects+: see HTTParty::ClassMethods.maintain_method_across_redirects.
63
+ # * :+no_follow+: see HTTParty::ClassMethods.no_follow.
64
+ # * :+parser+: see HTTParty::ClassMethods.parser.
65
+ # * :+connection_adapter+: see HTTParty::ClassMethods.connection_adapter.
66
+ # * :+pem+: see HTTParty::ClassMethods.pem.
67
+ # * :+query_string_normalizer+: see HTTParty::ClassMethods.query_string_normalizer
68
+ # * :+ssl_ca_file+: see HTTParty::ClassMethods.ssl_ca_file.
69
+ # * :+ssl_ca_path+: see HTTParty::ClassMethods.ssl_ca_path.
70
+
71
+ module ClassMethods
72
+
73
+ extend AllowedFormatsDeprecation
74
+
75
+ # Turns on logging
76
+ #
77
+ # class Foo
78
+ # include HTTParty
79
+ # logger Logger.new('http_logger'), :info, :apache
80
+ # end
81
+ def logger(logger, level=:info, format=:apache)
82
+ default_options[:logger] = logger
83
+ default_options[:log_level] = level
84
+ default_options[:log_format] = format
85
+ end
86
+
87
+ # Allows setting http proxy information to be used
88
+ #
89
+ # class Foo
90
+ # include HTTParty
91
+ # http_proxy 'http://foo.com', 80, 'user', 'pass'
92
+ # end
93
+ def http_proxy(addr=nil, port=nil, user=nil, pass=nil)
94
+ default_options[:http_proxyaddr] = addr
95
+ default_options[:http_proxyport] = port
96
+ default_options[:http_proxyuser] = user
97
+ default_options[:http_proxypass] = pass
98
+ end
99
+
100
+ # Allows setting a base uri to be used for each request.
101
+ # Will normalize uri to include http, etc.
102
+ #
103
+ # class Foo
104
+ # include HTTParty
105
+ # base_uri 'twitter.com'
106
+ # end
107
+ def base_uri(uri=nil)
108
+ return default_options[:base_uri] unless uri
109
+ default_options[:base_uri] = HTTParty.normalize_base_uri(uri)
110
+ end
111
+
112
+ # Allows setting basic authentication username and password.
113
+ #
114
+ # class Foo
115
+ # include HTTParty
116
+ # basic_auth 'username', 'password'
117
+ # end
118
+ def basic_auth(u, p)
119
+ default_options[:basic_auth] = {:username => u, :password => p}
120
+ end
121
+
122
+ # Allows setting digest authentication username and password.
123
+ #
124
+ # class Foo
125
+ # include HTTParty
126
+ # digest_auth 'username', 'password'
127
+ # end
128
+ def digest_auth(u, p)
129
+ default_options[:digest_auth] = {:username => u, :password => p}
130
+ end
131
+
132
+ # Do not send rails style query strings.
133
+ # Specically, don't use bracket notation when sending an array
134
+ #
135
+ # For a query:
136
+ # get '/', :query => {:selected_ids => [1,2,3]}
137
+ #
138
+ # The default query string looks like this:
139
+ # /?selected_ids[]=1&selected_ids[]=2&selected_ids[]=3
140
+ #
141
+ # Call `disable_rails_query_string_format` to transform the query string
142
+ # into:
143
+ # /?selected_ids=1&selected_ids=2&selected_ids=3
144
+ #
145
+ # @example
146
+ # class Foo
147
+ # include HTTParty
148
+ # disable_rails_query_string_format
149
+ # end
150
+ def disable_rails_query_string_format
151
+ query_string_normalizer Request::NON_RAILS_QUERY_STRING_NORMALIZER
152
+ end
153
+
154
+ # Allows setting default parameters to be appended to each request.
155
+ # Great for api keys and such.
156
+ #
157
+ # class Foo
158
+ # include HTTParty
159
+ # default_params :api_key => 'secret', :another => 'foo'
160
+ # end
161
+ def default_params(h={})
162
+ raise ArgumentError, 'Default params must be a hash' unless h.is_a?(Hash)
163
+ default_options[:default_params] ||= {}
164
+ default_options[:default_params].merge!(h)
165
+ end
166
+
167
+ # Allows setting a default timeout for all HTTP calls
168
+ # Timeout is specified in seconds.
169
+ #
170
+ # class Foo
171
+ # include HTTParty
172
+ # default_timeout 10
173
+ # end
174
+ def default_timeout(t)
175
+ raise ArgumentError, 'Timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
176
+ default_options[:timeout] = t
177
+ end
178
+
179
+ # Allows setting a default open_timeout for all HTTP calls in seconds
180
+ #
181
+ # class Foo
182
+ # include HTTParty
183
+ # open_timeout 10
184
+ # end
185
+ def open_timeout(t)
186
+ raise ArgumentError, 'open_timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
187
+ default_options[:open_timeout] = t
188
+ end
189
+
190
+ # Allows setting a default read_timeout for all HTTP calls in seconds
191
+ #
192
+ # class Foo
193
+ # include HTTParty
194
+ # read_timeout 10
195
+ # end
196
+ def read_timeout(t)
197
+ raise ArgumentError, 'read_timeout must be an integer or float' unless t && (t.is_a?(Integer) || t.is_a?(Float))
198
+ default_options[:read_timeout] = t
199
+ end
200
+
201
+ # Set an output stream for debugging, defaults to $stderr.
202
+ # The output stream is passed on to Net::HTTP#set_debug_output.
203
+ #
204
+ # class Foo
205
+ # include HTTParty
206
+ # debug_output $stderr
207
+ # end
208
+ def debug_output(stream = $stderr)
209
+ default_options[:debug_output] = stream
210
+ end
211
+
212
+ # Allows setting HTTP headers to be used for each request.
213
+ #
214
+ # class Foo
215
+ # include HTTParty
216
+ # headers 'Accept' => 'text/html'
217
+ # end
218
+ def headers(h={})
219
+ raise ArgumentError, 'Headers must be a hash' unless h.is_a?(Hash)
220
+ default_options[:headers] ||= {}
221
+ default_options[:headers].merge!(h)
222
+ end
223
+
224
+ def cookies(h={})
225
+ raise ArgumentError, 'Cookies must be a hash' unless h.is_a?(Hash)
226
+ default_cookies.add_cookies(h)
227
+ end
228
+
229
+ # Proceed to the location header when an HTTP response dictates a redirect.
230
+ # Redirects are always followed by default.
231
+ #
232
+ # @example
233
+ # class Foo
234
+ # include HTTParty
235
+ # base_uri 'http://google.com'
236
+ # follow_redirects true
237
+ # end
238
+ def follow_redirects(value = true)
239
+ default_options[:follow_redirects] = value
240
+ end
241
+
242
+ # Allows setting the format with which to parse.
243
+ # Must be one of the allowed formats ie: json, xml
244
+ #
245
+ # class Foo
246
+ # include HTTParty
247
+ # format :json
248
+ # end
249
+ def format(f = nil)
250
+ if f.nil?
251
+ default_options[:format]
252
+ else
253
+ parser(Parser) if parser.nil?
254
+ default_options[:format] = f
255
+ validate_format
256
+ end
257
+ end
258
+
259
+ # Declare whether or not to follow redirects. When true, an
260
+ # {HTTParty::RedirectionTooDeep} error will raise upon encountering a
261
+ # redirect. You can then gain access to the response object via
262
+ # HTTParty::RedirectionTooDeep#response.
263
+ #
264
+ # @see HTTParty::ResponseError#response
265
+ #
266
+ # @example
267
+ # class Foo
268
+ # include HTTParty
269
+ # base_uri 'http://google.com'
270
+ # no_follow true
271
+ # end
272
+ #
273
+ # begin
274
+ # Foo.get('/')
275
+ # rescue HTTParty::RedirectionTooDeep => e
276
+ # puts e.response.body
277
+ # end
278
+ def no_follow(value = false)
279
+ default_options[:no_follow] = value
280
+ end
281
+
282
+ # Declare that you wish to maintain the chosen HTTP method across redirects.
283
+ # The default behavior is to follow redirects via the GET method.
284
+ # If you wish to maintain the original method, you can set this option to true.
285
+ #
286
+ # @example
287
+ # class Foo
288
+ # include HTTParty
289
+ # base_uri 'http://google.com'
290
+ # maintain_method_across_redirects true
291
+ # end
292
+
293
+ def maintain_method_across_redirects(value = true)
294
+ default_options[:maintain_method_across_redirects] = value
295
+ end
296
+
297
+ # Allows setting a PEM file to be used
298
+ #
299
+ # class Foo
300
+ # include HTTParty
301
+ # pem File.read('/home/user/my.pem'), "optional password"
302
+ # end
303
+ def pem(pem_contents, password=nil)
304
+ default_options[:pem] = pem_contents
305
+ default_options[:pem_password] = password
306
+ end
307
+
308
+ # Allows setting a PKCS12 file to be used
309
+ #
310
+ # class Foo
311
+ # include HTTParty
312
+ # pkcs12 File.read('/home/user/my.p12'), "password"
313
+ # end
314
+ def pkcs12(p12_contents, password)
315
+ default_options[:p12] = p12_contents
316
+ default_options[:p12_password] = password
317
+ end
318
+
319
+ # Override the way query strings are normalized.
320
+ # Helpful for overriding the default rails normalization of Array queries.
321
+ #
322
+ # For a query:
323
+ # get '/', :query => {:selected_ids => [1,2,3]}
324
+ #
325
+ # The default query string normalizer returns:
326
+ # /?selected_ids[]=1&selected_ids[]=2&selected_ids[]=3
327
+ #
328
+ # Let's change it to this:
329
+ # /?selected_ids=1&selected_ids=2&selected_ids=3
330
+ #
331
+ # Pass a Proc to the query normalizer which accepts the yielded query.
332
+ #
333
+ # @example Modifying Array query strings
334
+ # class ServiceWrapper
335
+ # include HTTParty
336
+ #
337
+ # query_string_normalizer proc { |query|
338
+ # query.map do |key, value|
339
+ # value.map {|v| "#{key}=#{v}"}
340
+ # end.join('&')
341
+ # }
342
+ # end
343
+ #
344
+ # @param [Proc] normalizer custom query string normalizer.
345
+ # @yield [Hash, String] query string
346
+ # @yieldreturn [Array] an array that will later be joined with '&'
347
+ def query_string_normalizer(normalizer)
348
+ default_options[:query_string_normalizer] = normalizer
349
+ end
350
+
351
+ # Allows setting of SSL version to use. This only works in Ruby 1.9+.
352
+ # You can get a list of valid versions from OpenSSL::SSL::SSLContext::METHODS.
353
+ #
354
+ # class Foo
355
+ # include HTTParty
356
+ # ssl_version :SSLv3
357
+ # end
358
+ def ssl_version(version)
359
+ default_options[:ssl_version] = version
360
+ end
361
+
362
+ # Allows setting of SSL ciphers to use. This only works in Ruby 1.9+.
363
+ # You can get a list of valid specific ciphers from OpenSSL::Cipher.ciphers.
364
+ # You also can specify a cipher suite here, listed here at openssl.org:
365
+ # http://www.openssl.org/docs/apps/ciphers.html#CIPHER_SUITE_NAMES
366
+ #
367
+ # class Foo
368
+ # include HTTParty
369
+ # ciphers "RC4-SHA"
370
+ # end
371
+ def ciphers(cipher_names)
372
+ default_options[:ciphers] = cipher_names
373
+ end
374
+
375
+ # Allows setting an OpenSSL certificate authority file. The file
376
+ # should contain one or more certificates in PEM format.
377
+ #
378
+ # Setting this option enables certificate verification. All
379
+ # certificates along a chain must be available in ssl_ca_file or
380
+ # ssl_ca_path for verification to succeed.
381
+ #
382
+ #
383
+ # class Foo
384
+ # include HTTParty
385
+ # ssl_ca_file '/etc/ssl/certs/ca-certificates.crt'
386
+ # end
387
+ def ssl_ca_file(path)
388
+ default_options[:ssl_ca_file] = path
389
+ end
390
+
391
+ # Allows setting an OpenSSL certificate authority path (directory).
392
+ #
393
+ # Setting this option enables certificate verification. All
394
+ # certificates along a chain must be available in ssl_ca_file or
395
+ # ssl_ca_path for verification to succeed.
396
+ #
397
+ # class Foo
398
+ # include HTTParty
399
+ # ssl_ca_path '/etc/ssl/certs/'
400
+ # end
401
+ def ssl_ca_path(path)
402
+ default_options[:ssl_ca_path] = path
403
+ end
404
+
405
+ # Allows setting a custom parser for the response.
406
+ #
407
+ # class Foo
408
+ # include HTTParty
409
+ # parser Proc.new {|data| ...}
410
+ # end
411
+ def parser(custom_parser = nil)
412
+ if custom_parser.nil?
413
+ default_options[:parser]
414
+ else
415
+ default_options[:parser] = custom_parser
416
+ validate_format
417
+ end
418
+ end
419
+
420
+ # Allows setting a custom connection_adapter for the http connections
421
+ #
422
+ # @example
423
+ # class Foo
424
+ # include HTTParty
425
+ # connection_adapter Proc.new {|uri, options| ... }
426
+ # end
427
+ #
428
+ # @example provide optional configuration for your connection_adapter
429
+ # class Foo
430
+ # include HTTParty
431
+ # connection_adapter Proc.new {|uri, options| ... }, {:foo => :bar}
432
+ # end
433
+ #
434
+ # @see HTTParty::ConnectionAdapter
435
+ def connection_adapter(custom_adapter = nil, options = nil)
436
+ if custom_adapter.nil?
437
+ default_options[:connection_adapter]
438
+ else
439
+ default_options[:connection_adapter] = custom_adapter
440
+ default_options[:connection_adapter_options] = options
441
+ end
442
+ end
443
+
444
+ # Allows making a get request to a url.
445
+ #
446
+ # class Foo
447
+ # include HTTParty
448
+ # end
449
+ #
450
+ # # Simple get with full url
451
+ # Foo.get('http://foo.com/resource.json')
452
+ #
453
+ # # Simple get with full url and query parameters
454
+ # # ie: http://foo.com/resource.json?limit=10
455
+ # Foo.get('http://foo.com/resource.json', :query => {:limit => 10})
456
+ def get(path, options={}, &block)
457
+ perform_request Net::HTTP::Get, path, options, &block
458
+ end
459
+
460
+ # Allows making a post request to a url.
461
+ #
462
+ # class Foo
463
+ # include HTTParty
464
+ # end
465
+ #
466
+ # # Simple post with full url and setting the body
467
+ # Foo.post('http://foo.com/resources', :body => {:bar => 'baz'})
468
+ #
469
+ # # Simple post with full url using :query option,
470
+ # # which gets set as form data on the request.
471
+ # Foo.post('http://foo.com/resources', :query => {:bar => 'baz'})
472
+ def post(path, options={}, &block)
473
+ perform_request Net::HTTP::Post, path, options, &block
474
+ end
475
+
476
+ # Perform a PATCH request to a path
477
+ def patch(path, options={}, &block)
478
+ perform_request Net::HTTP::Patch, path, options, &block
479
+ end
480
+
481
+ # Perform a PUT request to a path
482
+ def put(path, options={}, &block)
483
+ perform_request Net::HTTP::Put, path, options, &block
484
+ end
485
+
486
+ # Perform a DELETE request to a path
487
+ def delete(path, options={}, &block)
488
+ perform_request Net::HTTP::Delete, path, options, &block
489
+ end
490
+
491
+ # Perform a MOVE request to a path
492
+ def move(path, options={}, &block)
493
+ perform_request Net::HTTP::Move, path, options, &block
494
+ end
495
+
496
+ # Perform a COPY request to a path
497
+ def copy(path, options={}, &block)
498
+ perform_request Net::HTTP::Copy, path, options, &block
499
+ end
500
+
501
+ # Perform a HEAD request to a path
502
+ def head(path, options={}, &block)
503
+ perform_request Net::HTTP::Head, path, options, &block
504
+ end
505
+
506
+ # Perform an OPTIONS request to a path
507
+ def options(path, options={}, &block)
508
+ perform_request Net::HTTP::Options, path, options, &block
509
+ end
510
+
511
+ def default_options #:nodoc:
512
+ @default_options
513
+ end
514
+
515
+ private
516
+
517
+ def perform_request(http_method, path, options, &block) #:nodoc:
518
+ options = default_options.merge(options)
519
+ process_headers(options)
520
+ process_cookies(options)
521
+ Request.new(http_method, path, options).perform(&block)
522
+ end
523
+
524
+ def process_headers(options)
525
+ if options[:headers] && headers.any?
526
+ options[:headers] = headers.merge(options[:headers])
527
+ end
528
+ end
529
+
530
+ def process_cookies(options) #:nodoc:
531
+ return unless options[:cookies] || default_cookies.any?
532
+ options[:headers] ||= headers.dup
533
+ options[:headers]["cookie"] = cookies.merge(options.delete(:cookies) || {}).to_cookie_string
534
+ end
535
+
536
+ def validate_format
537
+ if format && parser.respond_to?(:supports_format?) && !parser.supports_format?(format)
538
+ raise UnsupportedFormat, "'#{format.inspect}' Must be one of: #{parser.supported_formats.map{|f| f.to_s}.sort.join(', ')}"
539
+ end
540
+ end
541
+ end
542
+
543
+ def self.normalize_base_uri(url) #:nodoc:
544
+ normalized_url = url.dup
545
+ use_ssl = (normalized_url =~ /^https/) || (normalized_url =~ /:443\b/)
546
+ ends_with_slash = normalized_url =~ /\/$/
547
+
548
+ normalized_url.chop! if ends_with_slash
549
+ normalized_url.gsub!(/^https?:\/\//i, '')
550
+
551
+ "http#{'s' if use_ssl}://#{normalized_url}"
552
+ end
553
+
554
+ class Basement #:nodoc:
555
+ include HTTParty
556
+ end
557
+
558
+ def self.get(*args, &block)
559
+ Basement.get(*args, &block)
560
+ end
561
+
562
+ def self.post(*args, &block)
563
+ Basement.post(*args, &block)
564
+ end
565
+
566
+ def self.patch(*args, &block)
567
+ Basement.patch(*args, &block)
568
+ end
569
+
570
+ def self.put(*args, &block)
571
+ Basement.put(*args, &block)
572
+ end
573
+
574
+ def self.delete(*args, &block)
575
+ Basement.delete(*args, &block)
576
+ end
577
+
578
+ def self.move(*args, &block)
579
+ Basement.move(*args, &block)
580
+ end
581
+
582
+ def self.copy(*args, &block)
583
+ Basement.copy(*args, &block)
584
+ end
585
+
586
+ def self.head(*args, &block)
587
+ Basement.head(*args, &block)
588
+ end
589
+
590
+ def self.options(*args, &block)
591
+ Basement.options(*args, &block)
592
+ end
593
+ end
594
+
595
+ require 'httparty/core_extensions'
596
+ require 'httparty/hash_conversions'
597
+ require 'httparty/exceptions'
598
+ require 'httparty/parser'
599
+ require 'httparty/request'
600
+ require 'httparty/response'