yoyle439587298 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +14 -0
  5. data/Guardfile +16 -0
  6. data/History +303 -0
  7. data/LICENSE +21 -0
  8. data/MIT-LICENSE +20 -0
  9. data/README.md +80 -0
  10. data/Rakefile +12 -0
  11. data/bin/httparty +117 -0
  12. data/cucumber.yml +1 -0
  13. data/examples/aaws.rb +32 -0
  14. data/examples/basic.rb +32 -0
  15. data/examples/crack.rb +19 -0
  16. data/examples/custom_parsers.rb +67 -0
  17. data/examples/delicious.rb +37 -0
  18. data/examples/google.rb +16 -0
  19. data/examples/headers_and_user_agents.rb +6 -0
  20. data/examples/nokogiri_html_parser.rb +22 -0
  21. data/examples/rubyurl.rb +14 -0
  22. data/examples/tripit_sign_in.rb +33 -0
  23. data/examples/twitter.rb +31 -0
  24. data/examples/whoismyrep.rb +10 -0
  25. data/features/basic_authentication.feature +20 -0
  26. data/features/command_line.feature +7 -0
  27. data/features/deals_with_http_error_codes.feature +26 -0
  28. data/features/digest_authentication.feature +20 -0
  29. data/features/handles_compressed_responses.feature +27 -0
  30. data/features/handles_multiple_formats.feature +57 -0
  31. data/features/steps/env.rb +22 -0
  32. data/features/steps/httparty_response_steps.rb +52 -0
  33. data/features/steps/httparty_steps.rb +35 -0
  34. data/features/steps/mongrel_helper.rb +94 -0
  35. data/features/steps/remote_service_steps.rb +74 -0
  36. data/features/supports_redirection.feature +22 -0
  37. data/features/supports_timeout_option.feature +13 -0
  38. data/httparty.gemspec +26 -0
  39. data/lib/httparty.rb +578 -0
  40. data/lib/httparty/connection_adapter.rb +176 -0
  41. data/lib/httparty/cookie_hash.rb +22 -0
  42. data/lib/httparty/core_extensions.rb +32 -0
  43. data/lib/httparty/exceptions.rb +29 -0
  44. data/lib/httparty/hash_conversions.rb +51 -0
  45. data/lib/httparty/logger/apache_logger.rb +22 -0
  46. data/lib/httparty/logger/curl_logger.rb +48 -0
  47. data/lib/httparty/logger/logger.rb +18 -0
  48. data/lib/httparty/module_inheritable_attributes.rb +56 -0
  49. data/lib/httparty/net_digest_auth.rb +84 -0
  50. data/lib/httparty/parser.rb +141 -0
  51. data/lib/httparty/request.rb +330 -0
  52. data/lib/httparty/response.rb +72 -0
  53. data/lib/httparty/response/headers.rb +31 -0
  54. data/lib/httparty/version.rb +3 -0
  55. data/script/release +42 -0
  56. data/spec/fixtures/delicious.xml +23 -0
  57. data/spec/fixtures/empty.xml +0 -0
  58. data/spec/fixtures/google.html +3 -0
  59. data/spec/fixtures/ssl/generate.sh +29 -0
  60. data/spec/fixtures/ssl/generated/1fe462c2.0 +16 -0
  61. data/spec/fixtures/ssl/generated/bogushost.crt +13 -0
  62. data/spec/fixtures/ssl/generated/ca.crt +16 -0
  63. data/spec/fixtures/ssl/generated/ca.key +15 -0
  64. data/spec/fixtures/ssl/generated/selfsigned.crt +14 -0
  65. data/spec/fixtures/ssl/generated/server.crt +13 -0
  66. data/spec/fixtures/ssl/generated/server.key +15 -0
  67. data/spec/fixtures/ssl/openssl-exts.cnf +9 -0
  68. data/spec/fixtures/twitter.csv +2 -0
  69. data/spec/fixtures/twitter.json +1 -0
  70. data/spec/fixtures/twitter.xml +403 -0
  71. data/spec/fixtures/undefined_method_add_node_for_nil.xml +2 -0
  72. data/spec/httparty/connection_adapter_spec.rb +298 -0
  73. data/spec/httparty/cookie_hash_spec.rb +83 -0
  74. data/spec/httparty/exception_spec.rb +23 -0
  75. data/spec/httparty/logger/apache_logger_spec.rb +26 -0
  76. data/spec/httparty/logger/curl_logger_spec.rb +18 -0
  77. data/spec/httparty/logger/logger_spec.rb +22 -0
  78. data/spec/httparty/net_digest_auth_spec.rb +152 -0
  79. data/spec/httparty/parser_spec.rb +165 -0
  80. data/spec/httparty/request_spec.rb +631 -0
  81. data/spec/httparty/response_spec.rb +221 -0
  82. data/spec/httparty/ssl_spec.rb +74 -0
  83. data/spec/httparty_spec.rb +764 -0
  84. data/spec/spec.opts +2 -0
  85. data/spec/spec_helper.rb +37 -0
  86. data/spec/support/ssl_test_helper.rb +47 -0
  87. data/spec/support/ssl_test_server.rb +80 -0
  88. data/spec/support/stub_response.rb +43 -0
  89. data/website/css/common.css +47 -0
  90. data/website/index.html +73 -0
  91. metadata +208 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b5578b7d6635fad92dc55ada06610119788fe8a7
4
+ data.tar.gz: f95bdbf437396f56aed2eaa7bc4f16cd560c814c
5
+ SHA512:
6
+ metadata.gz: 298247a0f3118a6a25e0241745a65f19bb293730f2bf312550681e1fe81b0e1907d337d9e5595706d354b1ddaa126f9b7e428efa65e352601ca578080179881f
7
+ data.tar.gz: a0131ba4a93fc94554abfdd7013cca3ffd6ff6d85654c03cdf71871d116b867c1f60f46bbfc644bdddc9338a92df7ff686a4987e00d857d957605987c42fe75e
@@ -0,0 +1,10 @@
1
+ Gemfile.lock
2
+ .DS_Store
3
+ .yardoc/
4
+ doc/
5
+ tmp/
6
+ log/
7
+ pkg/
8
+ *.swp
9
+ /.bundle
10
+ .rvmrc
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ notifications:
6
+ email: false
7
+ bundler_args: --without development
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ gem 'rake'
5
+ gem 'cucumber', '~> 0.7'
6
+ gem 'fakeweb', '~> 1.2'
7
+ gem 'rspec', '~> 1.3'
8
+ gem 'mongrel', '1.2.0.pre2'
9
+
10
+ group :development do
11
+ gem 'guard'
12
+ gem 'guard-rspec'
13
+ gem 'guard-bundler'
14
+ end
@@ -0,0 +1,16 @@
1
+ rspec_options = {
2
+ :version => 1,
3
+ :all_after_pass => false,
4
+ :all_on_start => false,
5
+ }
6
+
7
+ guard 'rspec', rspec_options do
8
+ watch(%r{^spec/.+_spec\.rb$})
9
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
10
+ watch('spec/spec_helper.rb') { "spec" }
11
+ end
12
+
13
+ guard 'bundler' do
14
+ watch('Gemfile')
15
+ watch(/^.+\.gemspec/)
16
+ end
data/History ADDED
@@ -0,0 +1,303 @@
1
+ == 0.10.1 2013-01-26
2
+
3
+ * new
4
+ * [added support for MOVE requests](https://github.com/jnunemaker/httparty/pull/183)
5
+ * [bump multi xml version](https://github.com/jnunemaker/httparty/pull/181)
6
+
7
+ == 0.10.0 2013-01-10
8
+ * changes
9
+ * removed yaml support because of security risk (see rails yaml issues)
10
+
11
+ == 0.9.0 2012-09-07
12
+ * new
13
+ * [support for connection adapters](https://github.com/jnunemaker/httparty/pull/157)
14
+ * [allow ssl_version on ruby 1.9](https://github.com/jnunemaker/httparty/pull/159)
15
+
16
+ * bug fixes
17
+ * [don't treat port 4430 as ssl](https://github.com/jnunemaker/httparty/commit/a296b1c97f83d7dcc6ef85720a43664c265685ac)
18
+ * [deep clone default options](https://github.com/jnunemaker/httparty/commit/f74227d30f9389b4b23a888c9af49fb9b8248e1f)
19
+ * a few net digest auth fixes
20
+
21
+ == 0.8.3 2012-04-21
22
+ * new
23
+ * [lazy parsing of responses](https://github.com/jnunemaker/httparty/commit/9fd5259c8dab00e426082b66af44ede2c9068f45)
24
+ * [add support for PATCH requests](https://github.com/jnunemaker/httparty/commit/7ab6641e37a9e31517e46f6124f38c615395d38a)
25
+ * bug fixes
26
+ * [subclasses no longer override superclass options](https://github.com/jnunemaker/httparty/commit/682af8fbf672e7b3009e650da776c85cdfe78d39)
27
+
28
+ == 0.8.2 2012-04-12
29
+ * new
30
+ * add -r to make CLI return failure code if status >= 400
31
+ * allow blank username from CLI
32
+ * bug fixes
33
+ * return nil for null body
34
+ * automatically deflate responses with a Content-Encoding: x-gzip header
35
+ * Do not HEAD on POST request with digest authentication
36
+ * add support for proxy authentication
37
+ * fix posting data with CLI
38
+ * require rexml/document if xml format from CLI
39
+ * support for fragmented responses
40
+
41
+ == 0.8.1 2011-10-05
42
+ * bug fixes
43
+ * content-encoding header should be removed when automatically inflating the body
44
+
45
+ == 0.8.0 2011-09-13
46
+ * new
47
+ * switch to multi json/xml for parsing by default
48
+ * bug fixes
49
+ * fix redirects to relative uri's
50
+
51
+ == 0.7.8 2011-06-06
52
+ * bug fix
53
+ * Make response honor respond to
54
+ * net http timeout can also be a float
55
+
56
+ == 0.7.7 2011-04-16
57
+ * bug fix
58
+ * Fix NoMethodError when using the NON_RAILS_QUERY_STRING_NORMALIZER with a hash whose key is a symbol and value is nil
59
+
60
+ == 0.7.5 2011-04-16
61
+ * bug fix
62
+ * caused issue with latest rubygems
63
+
64
+ == 0.7.4 2011-02-13
65
+ * bug fixes
66
+ * Set VERIFY_NONE when using https. Ruby 1.9.2 no longer sets this for us. gh-67
67
+
68
+ == 0.7.3 2011-01-20
69
+ * bug fixes
70
+ * Fix digest auth for unspecified quality of protection (bjoernalbers, mtrudel, dwo)
71
+
72
+ == 0.7.2 2011-01-20
73
+ * bug fixes
74
+ * Fix gem dependencies
75
+
76
+ == 0.7.1 2011-01-19
77
+ * bug fixes
78
+ * Fix uninitialized constant HTTParty::Response::Net in 1.9.2 (cap10morgan)
79
+ * Other fixes for 1.9.2, full suite still fails (cap10morgan)
80
+
81
+ == 0.7.0 2011-01-18
82
+ * minor enhancements
83
+ * Added query methods for HTTP status codes, i.e. response.success?
84
+ response.created? (thanks citizenparker)
85
+ * Added support for ssl_ca_file and ssl_ca_path (dlitz)
86
+ * Allow custom query string normalization. gh-8
87
+ * Unlock private keys with password (freerange)
88
+ * Added high level request documentation (phildarnowsky)
89
+ * Added basic post example (pbuckley)
90
+ * Response object has access to its corresponding request object
91
+ * Added example of siginin into tripit.com
92
+ * Added option to follow redirects (rkj). gh-56
93
+ * bug fixes
94
+ * Fixed superclass mismatch exception while running tests
95
+ (thanks dlitz http://github.com/dlitz/httparty/commit/48224f0615b32133afcff4718ad426df7a4b401b)
96
+
97
+ == 0.6.1 2010-07-07
98
+ * minor enhancements
99
+ * updated to crack 0.1.8
100
+ * bug fixes
101
+ * subclasses always merge into the parent's default_options and
102
+ default_cookies (l4rk).
103
+ * subclasses play nicely with grand parents. gh-49
104
+
105
+ == 0.6.0 2010-06-13
106
+ * major enhancements
107
+ * Digest Auth (bartiaco, sbecker, gilles, and aaronrussell)
108
+ * Maintain HTTP method across redirects (bartiaco and sbecker)
109
+ * HTTParty::Response#response returns the Net::HTTPResponse object
110
+ * HTTParty::Response#headers returns a HTTParty::Response::Headers object
111
+ which quacks like a Hash + Net::HTTPHeader. The #headers method continues
112
+ to be backwards-compatible with the old Hash return value but may become
113
+ deprecated in the future.
114
+
115
+ * minor enhancements
116
+ * Update crack requirement to version 0.1.7
117
+ You may still get a warning because Crack's version constant is out of date
118
+ * Timeout option can be set for all requests using HTTParty.default_timeout (taazza)
119
+ * Closed #38 "headers hash should downcase keys so canonical header name can be used"
120
+ * Closed #40 "Gzip response" wherein gziped and deflated responses are
121
+ automatically inflated. (carsonmcdonald)
122
+
123
+ == 0.5.2 2010-01-31
124
+ * minor enhancements
125
+ * Update crack requirement to version 0.1.6
126
+
127
+ == 0.5.1 2010-01-30
128
+ * bug fixes
129
+ * Handle 304 response correctly by returning the HTTParty::Response object instead of redirecting (seth and hellvinz)
130
+ * Only redirect 300 responses if the header contains a Location
131
+ * Don't append empty query strings to the uri. Closes #31
132
+ * When no_follow is enabled, only raise the RedirectionTooDeep exception when a response tries redirecting. Closes #28
133
+
134
+ * major enhancements
135
+ * Removed rubygems dependency. I suggest adding rubygems to RUBYOPT if this causes problems for you.
136
+ $ export RUBYOPT='rubygems'
137
+ * HTTParty#debug_output prints debugging information for the current request (iwarshak)
138
+ * HTTParty#no_follow now available as a class-level option. Sets whether or not to follow redirects.
139
+
140
+ * minor enhancements
141
+ * HTTParty::VERSION now available
142
+ * Update crack requirement to version 0.1.5
143
+
144
+ == 0.5.0 2009-12-07
145
+ * bug fixes
146
+ * inheritable attributes no longer mutable by subclasses (yyyc514)
147
+ * namespace BasicObject within HTTParty to avoid class name collisions (eric)
148
+
149
+ * major enhancements
150
+ * Custom Parsers via class or proc
151
+ * Deprecation warning on HTTParty::AllowedFormats
152
+ moved to HTTParty::Parser::SupportedFormats
153
+
154
+ * minor enhancements
155
+ * Curl inspired output when using the binary in verbose mode (alexvollmer)
156
+ * raise UnsupportedURIScheme when scheme is not HTTP or HTTPS (djspinmonkey)
157
+ * Allow SSL for ports other than 443 when scheme is HTTPS (stefankroes)
158
+ * Accept PEM certificates via HTTParty#pem (chrislo)
159
+ * Support HEAD and OPTION verbs (grempe)
160
+ * Verify SSL certificates when providing a PEM file (collectiveidea/danielmorrison)
161
+
162
+ == 0.4.5 2009-09-12
163
+ * bug fixes
164
+ * Fixed class-level headers overwritten by cookie management code. Closes #19
165
+ * Fixed "superclass mismatch for class BlankSlate" error. Closes #20
166
+ * Fixed reading files as post data from the command line (vesan)
167
+
168
+ * minor enhancements
169
+ * Timeout option added; will raise a Timeout::Error after the timeout has elapsed (attack). Closes #17
170
+ HTTParty.get "http://github.com", :timeout => 1
171
+ * Building gem with Jeweler
172
+
173
+ == 0.4.4 2009-07-19
174
+ * 2 minor update
175
+ * :query no longer sets form data. Use body and set content type to application/x-www-form-urlencoded if you need it. :query was wrong for that.
176
+ * Fixed a bug in the cookies class method that caused cookies to be forgotten after the first request.
177
+ * Also, some general cleanup of tests and such.
178
+
179
+ == 0.4.3 2009-04-23
180
+ * 1 minor update
181
+ * added message to the response object
182
+
183
+ == 0.4.2 2009-03-30
184
+ * 2 minor changes
185
+ * response code now returns an integer instead of a string (jqr)
186
+ * rubyforge project setup for crack so i'm now depending on that instead of jnunemaker-crack
187
+
188
+ == 0.4.1 2009-03-29
189
+ * 1 minor fix
190
+ * gem 'jnunemaker-crack' instead of gem 'crack'
191
+
192
+ == 0.4.0 2009-03-29
193
+ * 1 minor change
194
+ * Switched xml and json parsing to crack (same code as before just moved to gem for easier reuse in other projects)
195
+
196
+ == 0.3.1 2009-02-10
197
+ * 1 minor fix, 1 minor enhancement
198
+ * Fixed unescaping umlauts (siebertm)
199
+ * Added yaml response parsing (Miha Filej)
200
+
201
+ == 0.3.0 2009-01-31
202
+ * 1 major enhancement, 1 bug fix
203
+ * JSON gem no longer a requirement. It was conflicting with rails json stuff so I just stole ActiveSupport's json decoding and bundled it with HTTParty.
204
+ * Fixed bug where query strings were being duplicated on redirects
205
+ * Added a bunch of specs and moved some code around.
206
+
207
+ == 0.2.10 2009-01-29
208
+ * 1 minor enhancement
209
+ * Made encoding on query parameters treat everything except URI::PATTERN::UNRESERVED as UNSAFE to force encoding of '+' character (Julian Russell)
210
+
211
+ == 0.2.9 2009-01-29
212
+ * 3 minor enhancements
213
+ * Added a 'headers' accessor to the response with a hash of any HTTP headers. (Don Peterson)
214
+ * Add support for a ":cookies" option to be used at the class level, or as an option on any individual call. It should be passed a hash, which will be converted to the proper format and added to the request headers when the call is made. (Don Peterson)
215
+ * Refactored several specs and added a full suite of cucumber features (Don Peterson)
216
+
217
+ == 0.2.8 2009-01-28
218
+ * 1 major fix
219
+ * fixed major bug with response where it wouldn't iterate or really work at all with parsed responses
220
+
221
+ == 0.2.7 2009-01-28
222
+ * 2 minor fixes, 2 minor enhancements, 2 major enhancements
223
+ * fixed undefined method add_node for nil class error that occasionally happened (juliocesar)
224
+ * Handle nil or unexpected values better when typecasting. (Brian Landau)
225
+ * More robust handling of mime types (Alex Vollmer)
226
+ * Fixed support for specifying headers and added support for basic auth to CLI. (Alex Vollmer)
227
+ * Added first class response object that includes original body and status code (Alex Vollmer)
228
+ * Now parsing all response types as some non-200 responses provide important information, this means no more exception raising (Alex Vollmer)
229
+
230
+ == 0.2.6 2009-01-05
231
+ * 1 minor bug fix
232
+ * added explicit require of time as Time#parse failed outside of rails (willcodeforfoo)
233
+
234
+ == 0.2.5 2009-01-05
235
+ * 1 major enhancement
236
+ * Add command line interface to HTTParty (Alex Vollmer)
237
+
238
+ == 0.2.4 2008-12-23
239
+ * 1 bug fix
240
+ * Fixed that mimetype detection was failing if no mimetype was returned from service (skippy)
241
+ == 0.2.3 2008-12-23
242
+ * 1 bug fix
243
+ * Fixed typecasting class variable naming issue
244
+
245
+ == 0.2.2 2008-12-08
246
+ * 1 bug fix
247
+ * Added the missing core extension hash method to_xml_attributes
248
+
249
+ == 0.2.1 2008-12-08
250
+ * 1 bug fix
251
+ * Fixed that HTTParty was borking ActiveSupport and as such Rails (thanks to Rob Sanheim)
252
+
253
+ == 0.2.0 2008-12-07
254
+ * 1 major enhancement
255
+ * Removed ActiveSupport as a dependency. Now requires json gem for json deserialization and uses an included class to do the xml parsing.
256
+
257
+ == 0.1.8 2008-11-30
258
+ * 3 major enhancements
259
+ * Moved base_uri normalization into request class and out of httparty module, fixing
260
+ the problem where base_uri was not always being normalized.
261
+ * Stupid simple support for HTTParty.get/post/put/delete. (jqr)
262
+ * Switched gem management to Echoe from newgem.
263
+
264
+ == 0.1.7 2008-11-30
265
+ * 1 major enhancement
266
+ * fixed multiple class definitions overriding each others options
267
+
268
+ == 0.1.6 2008-11-26
269
+ * 1 major enhancement
270
+ * now passing :query to set_form_data if post request to avoid content length errors
271
+
272
+ == 0.1.5 2008-11-14
273
+ * 2 major enhancements
274
+ * Refactored send request method out into its own object.
275
+ * Added :html format if you just want to do that.
276
+
277
+ == 0.1.4 2008-11-08
278
+ * 3 major enhancements:
279
+ * Removed some cruft
280
+ * Added ability to follow redirects automatically and turn that off (Alex Vollmer)
281
+
282
+ == 0.1.3 2008-08-22
283
+
284
+ * 3 major enhancements:
285
+ * Added http_proxy key for setting proxy server and port (francxk@gmail.com)
286
+ * Now raises exception when http error occurs (francxk@gmail.com)
287
+ * Changed auto format detection from file extension to response content type (Jay Pignata)
288
+
289
+ == 0.1.2 2008-08-09
290
+
291
+ * 1 major enhancement:
292
+ * default_params were not being appended to query string if option[:query] was blank
293
+
294
+ == 0.1.1 2008-07-30
295
+
296
+ * 2 major enhancement:
297
+ * Added :basic_auth key for options when making a request
298
+ * :query and :body both now work with query string or hash
299
+
300
+ == 0.1.0 2008-07-27
301
+
302
+ * 1 major enhancement:
303
+ * Initial release
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 asirnayeef23
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 John Nunemaker
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,80 @@
1
+ # httparty
2
+
3
+ Makes http fun again!
4
+
5
+ ## Install
6
+
7
+ ```
8
+ gem install httparty
9
+ ```
10
+
11
+ ## Requirements
12
+
13
+ * Ruby 1.9.3 or higher
14
+ * multi_xml
15
+ * You like to party!
16
+
17
+ ## Examples
18
+
19
+ ```ruby
20
+ # Use the class methods to get down to business quickly
21
+ response = HTTParty.get('http://twitter.com/statuses/public_timeline.json')
22
+ puts response.body, response.code, response.message, response.headers.inspect
23
+
24
+ response.each do |item|
25
+ puts item['user']['screen_name']
26
+ end
27
+
28
+ # Or wrap things up in your own class
29
+ class Twitter
30
+ include HTTParty
31
+ base_uri 'twitter.com'
32
+
33
+ def initialize(u, p)
34
+ @auth = {:username => u, :password => p}
35
+ end
36
+
37
+ # which can be :friends, :user or :public
38
+ # options[:query] can be things like since, since_id, count, etc.
39
+ def timeline(which=:friends, options={})
40
+ options.merge!({:basic_auth => @auth})
41
+ self.class.get("/statuses/#{which}_timeline.json", options)
42
+ end
43
+
44
+ def post(text)
45
+ options = { :body => {:status => text}, :basic_auth => @auth }
46
+ self.class.post('/statuses/update.json', options)
47
+ end
48
+ end
49
+
50
+ twitter = Twitter.new(config['email'], config['password'])
51
+ pp twitter.timeline
52
+ ```
53
+
54
+ See the [examples directory](http://github.com/jnunemaker/httparty/tree/master/examples) for even more goodies.
55
+
56
+ ## Command Line Interface
57
+
58
+ httparty also includes the executable `httparty` which can be
59
+ used to query web services and examine the resulting output. By default
60
+ it will output the response as a pretty-printed Ruby object (useful for
61
+ grokking the structure of output). This can also be overridden to output
62
+ formatted XML or JSON. Execute `httparty --help` for all the
63
+ options. Below is an example of how easy it is.
64
+
65
+ ```
66
+ httparty "http://twitter.com/statuses/public_timeline.json"
67
+ ```
68
+
69
+ ## Help and Docs
70
+
71
+ * https://groups.google.com/forum/#!forum/httparty-gem
72
+ * http://rdoc.info/projects/jnunemaker/httparty
73
+
74
+ ## Contributing
75
+
76
+ * Fork the project.
77
+ * Make your feature addition or bug fix.
78
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
79
+ * Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself in another branch so I can ignore when I pull)
80
+ * Send me a pull request. Bonus points for topic branches.