Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create gh-pages branch via GitHub

  • Loading branch information...
commit 490b9a8cd0c0aaefa0161f00d68f22bef5b95b78 1 parent 7f9700c
@jnunemaker authored
Showing with 14 additions and 10 deletions.
  1. +13 −9 index.html
  2. +1 −1  params.json
View
22 index.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<title>HTTParty by jnunemaker</title>
-
+
<link rel="stylesheet" href="stylesheets/styles.css">
<link rel="stylesheet" href="stylesheets/pygment_trac.css">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
@@ -17,15 +17,22 @@
<header>
<h1>HTTParty</h1>
<p>Makes http fun again!</p>
+
<p class="view"><a href="https://github.com/jnunemaker/httparty">View the Project on GitHub <small>jnunemaker/httparty</small></a></p>
+
+
<ul>
<li><a href="https://github.com/jnunemaker/httparty/zipball/master">Download <strong>ZIP File</strong></a></li>
<li><a href="https://github.com/jnunemaker/httparty/tarball/master">Download <strong>TAR Ball</strong></a></li>
- <li><a href="https://github.com/jnunemaker/httparty">Fork On <strong>GitHub</strong></a></li>
+ <li><a href="https://github.com/jnunemaker/httparty">View On <strong>GitHub</strong></a></li>
</ul>
</header>
<section>
- <h2>Install</h2>
+ <h1>httparty</h1>
+
+<p>Makes http fun again!</p>
+
+<h2>Install</h2>
<pre><code>gem install httparty
</code></pre>
@@ -37,8 +44,7 @@
<li>You like to party!</li>
</ul><h2>Examples</h2>
-<div class="highlight">
-<pre><span class="c1"># Use the class methods to get down to business quickly</span>
+<div class="highlight"><pre><span class="c1"># Use the class methods to get down to business quickly</span>
<span class="n">response</span> <span class="o">=</span> <span class="no">HTTParty</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">'http://twitter.com/statuses/public_timeline.json'</span><span class="p">)</span>
<span class="nb">puts</span> <span class="n">response</span><span class="o">.</span><span class="n">body</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">code</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">message</span><span class="p">,</span> <span class="n">response</span><span class="o">.</span><span class="n">headers</span><span class="o">.</span><span class="n">inspect</span>
@@ -63,16 +69,14 @@
<span class="k">end</span>
<span class="k">def</span> <span class="nf">post</span><span class="p">(</span><span class="n">text</span><span class="p">)</span>
- <span class="n">options</span> <span class="o">=</span> <span class="p">{</span> <span class="ss">:query</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:status</span> <span class="o">=&gt;</span> <span class="n">text</span><span class="p">},</span> <span class="ss">:basic_auth</span> <span class="o">=&gt;</span> <span class="vi">@auth</span> <span class="p">}</span>
+ <span class="n">options</span> <span class="o">=</span> <span class="p">{</span> <span class="ss">:body</span> <span class="o">=&gt;</span> <span class="p">{</span><span class="ss">:status</span> <span class="o">=&gt;</span> <span class="n">text</span><span class="p">},</span> <span class="ss">:basic_auth</span> <span class="o">=&gt;</span> <span class="vi">@auth</span> <span class="p">}</span>
<span class="nb">self</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">post</span><span class="p">(</span><span class="s1">'/statuses/update.json'</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span>
<span class="k">end</span>
<span class="k">end</span>
<span class="n">twitter</span> <span class="o">=</span> <span class="no">Twitter</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">config</span><span class="o">[</span><span class="s1">'email'</span><span class="o">]</span><span class="p">,</span> <span class="n">config</span><span class="o">[</span><span class="s1">'password'</span><span class="o">]</span><span class="p">)</span>
<span class="n">pp</span> <span class="n">twitter</span><span class="o">.</span><span class="n">timeline</span>
-</pre>
-</div>
-
+</pre></div>
<p>See the <a href="http://github.com/jnunemaker/httparty/tree/master/examples">examples directory</a> for even more goodies.</p>
View
2  params.json
@@ -1 +1 @@
-{"note":"Don't delete this file! It's used internally to help with page regeneration.","tagline":"Makes http fun again!","google":"","body":"## Install\r\n\r\n```\r\ngem install httparty\r\n```\r\n\r\n## Requirements\r\n\r\n* multi_json and multi_xml\r\n* You like to party!\r\n\r\n## Examples\r\n\r\n```ruby\r\n# Use the class methods to get down to business quickly\r\nresponse = HTTParty.get('http://twitter.com/statuses/public_timeline.json')\r\nputs response.body, response.code, response.message, response.headers.inspect\r\n\r\nresponse.each do |item|\r\n puts item['user']['screen_name']\r\nend\r\n\r\n# Or wrap things up in your own class\r\nclass Twitter\r\n include HTTParty\r\n base_uri 'twitter.com'\r\n\r\n def initialize(u, p)\r\n @auth = {:username => u, :password => p}\r\n end\r\n\r\n # which can be :friends, :user or :public\r\n # options[:query] can be things like since, since_id, count, etc.\r\n def timeline(which=:friends, options={})\r\n options.merge!({:basic_auth => @auth})\r\n self.class.get(\"/statuses/#{which}_timeline.json\", options)\r\n end\r\n\r\n def post(text)\r\n options = { :query => {:status => text}, :basic_auth => @auth }\r\n self.class.post('/statuses/update.json', options)\r\n end\r\nend\r\n\r\ntwitter = Twitter.new(config['email'], config['password'])\r\npp twitter.timeline\r\n```\r\n\r\nSee the [examples directory](http://github.com/jnunemaker/httparty/tree/master/examples) for even more goodies.\r\n\r\n## Command Line Interface\r\n\r\nhttparty also includes the executable `httparty` which can be\r\nused to query web services and examine the resulting output. By default\r\nit will output the response as a pretty-printed Ruby object (useful for\r\ngrokking the structure of output). This can also be overridden to output\r\nformatted XML or JSON. Execute `httparty --help` for all the\r\noptions. Below is an example of how easy it is.\r\n\r\n```\r\nhttparty \"http://twitter.com/statuses/public_timeline.json\"\r\n```\r\n\r\n## Help and Docs\r\n\r\n* https://groups.google.com/forum/#!forum/httparty-gem\r\n* http://rdoc.info/projects/jnunemaker/httparty\r\n\r\n## Contributing\r\n\r\n* Fork the project.\r\n* Make your feature addition or bug fix.\r\n* Add tests for it. This is important so I don't break it in a future version unintentionally.\r\n* 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)\r\n* Send me a pull request. Bonus points for topic branches.\r\n","name":"HTTParty"}
+{"name":"HTTParty","tagline":"Makes http fun again!","body":"# httparty\r\n\r\nMakes http fun again!\r\n\r\n## Install\r\n\r\n```\r\ngem install httparty\r\n```\r\n\r\n## Requirements\r\n\r\n* multi_json and multi_xml\r\n* You like to party!\r\n\r\n## Examples\r\n\r\n```ruby\r\n# Use the class methods to get down to business quickly\r\nresponse = HTTParty.get('http://twitter.com/statuses/public_timeline.json')\r\nputs response.body, response.code, response.message, response.headers.inspect\r\n\r\nresponse.each do |item|\r\n puts item['user']['screen_name']\r\nend\r\n\r\n# Or wrap things up in your own class\r\nclass Twitter\r\n include HTTParty\r\n base_uri 'twitter.com'\r\n\r\n def initialize(u, p)\r\n @auth = {:username => u, :password => p}\r\n end\r\n\r\n # which can be :friends, :user or :public\r\n # options[:query] can be things like since, since_id, count, etc.\r\n def timeline(which=:friends, options={})\r\n options.merge!({:basic_auth => @auth})\r\n self.class.get(\"/statuses/#{which}_timeline.json\", options)\r\n end\r\n\r\n def post(text)\r\n options = { :body => {:status => text}, :basic_auth => @auth }\r\n self.class.post('/statuses/update.json', options)\r\n end\r\nend\r\n\r\ntwitter = Twitter.new(config['email'], config['password'])\r\npp twitter.timeline\r\n```\r\n\r\nSee the [examples directory](http://github.com/jnunemaker/httparty/tree/master/examples) for even more goodies.\r\n\r\n## Command Line Interface\r\n\r\nhttparty also includes the executable `httparty` which can be\r\nused to query web services and examine the resulting output. By default\r\nit will output the response as a pretty-printed Ruby object (useful for\r\ngrokking the structure of output). This can also be overridden to output\r\nformatted XML or JSON. Execute `httparty --help` for all the\r\noptions. Below is an example of how easy it is.\r\n\r\n```\r\nhttparty \"http://twitter.com/statuses/public_timeline.json\"\r\n```\r\n\r\n## Help and Docs\r\n\r\n* https://groups.google.com/forum/#!forum/httparty-gem\r\n* http://rdoc.info/projects/jnunemaker/httparty\r\n\r\n## Contributing\r\n\r\n* Fork the project.\r\n* Make your feature addition or bug fix.\r\n* Add tests for it. This is important so I don't break it in a future version unintentionally.\r\n* 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)\r\n* Send me a pull request. Bonus points for topic branches.\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
Please sign in to comment.
Something went wrong with that request. Please try again.