mirror of
				https://github.com/jnunemaker/httparty
				synced 2023-03-27 23:23:07 -04:00 
			
		
		
		
	Added website files
This commit is contained in:
		
							parent
							
								
									06c0463102
								
							
						
					
					
						commit
						b70ce56092
					
				
					 2 changed files with 124 additions and 0 deletions
				
			
		
							
								
								
									
										47
									
								
								website/css/common.css
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								website/css/common.css
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,47 @@
 | 
				
			||||||
 | 
					@media screen, projection {
 | 
				
			||||||
 | 
						/*
 | 
				
			||||||
 | 
						Copyright (c) 2007, Yahoo! Inc. All rights reserved.
 | 
				
			||||||
 | 
						Code licensed under the BSD License:
 | 
				
			||||||
 | 
						http://developer.yahoo.net/yui/license.txt
 | 
				
			||||||
 | 
						version: 2.2.0
 | 
				
			||||||
 | 
						*/
 | 
				
			||||||
 | 
						body {font:13px arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}table {font-size:inherit;font:100%;}select, input, textarea {font:99% arial,helvetica,clean,sans-serif;}pre, code {font:115% monospace;*font-size:100%;}body * {line-height:1.22em;}
 | 
				
			||||||
 | 
						body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}/*ol,ul {list-style:none;}*/caption,th {text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym {border:0;}
 | 
				
			||||||
 | 
						/* end of yahoo reset and fonts */
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						body 										{color:#333; background:#4b1a1a; line-height:1.3;}
 | 
				
			||||||
 | 
						p												{margin:0 0 20px;}
 | 
				
			||||||
 | 
						a												{color:#4b1a1a;}
 | 
				
			||||||
 | 
						a:hover									{text-decoration:none;}
 | 
				
			||||||
 | 
						strong									{font-weight:bold;}
 | 
				
			||||||
 | 
						em											{font-style:italics;}
 | 
				
			||||||
 | 
						h1,h2,h3,h4,h5,h6				{font-weight:bold;}
 | 
				
			||||||
 | 
						h1											{font-size:197%; margin:30px 0; color:#4b1a1a;}
 | 
				
			||||||
 | 
						h2											{font-size:174%; margin:20px 0; color:#b8111a;}
 | 
				
			||||||
 | 
						h3											{font-size:152%; margin:10px 0;}
 | 
				
			||||||
 | 
						h4											{font-size:129%; margin:10px 0;}
 | 
				
			||||||
 | 
						pre 										{background:#eee; margin:0 0 20px; padding:20px; border:1px solid #ccc; font-size:100%; overflow:auto;}
 | 
				
			||||||
 | 
						code										{font-size:100%; margin:0; padding:0;}
 | 
				
			||||||
 | 
						ul, ol									{margin:10px 0 10px 25px;}
 | 
				
			||||||
 | 
						ol li										{margin:0 0 10px;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						div#wrapper 							{background:#fff; width:560px; margin:0 auto; padding:20px; border:10px solid #bc8c46; border-width:0 10px;}
 | 
				
			||||||
 | 
						div#header								{position:relative; border-bottom:1px dotted; margin:0 0 10px; padding:0 0 10px;}
 | 
				
			||||||
 | 
						div#header p							{margin:0; padding:0;}
 | 
				
			||||||
 | 
						div#header h1							{margin:0; padding:0;}
 | 
				
			||||||
 | 
						ul#nav										{position:absolute; top:0; right:0; list-style:none; margin:0; padding:0;}
 | 
				
			||||||
 | 
						ul#nav li									{display:inline; padding:0 0 0 5px;}
 | 
				
			||||||
 | 
						ul#nav li a								{}
 | 
				
			||||||
 | 
						div#content								{}
 | 
				
			||||||
 | 
						div#footer								{margin:40px 0 0; border-top:1px dotted; padding:10px 0 0;}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										77
									
								
								website/index.html
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										77
									
								
								website/index.html
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,77 @@
 | 
				
			||||||
 | 
					<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
 | 
				
			||||||
 | 
					<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
 | 
				
			||||||
 | 
					<head> 
 | 
				
			||||||
 | 
						<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> 
 | 
				
			||||||
 | 
						<title>HTTParty by John Nunemaker</title> 
 | 
				
			||||||
 | 
						<link rel="stylesheet" href="css/common.css" type="text/css" /> 
 | 
				
			||||||
 | 
					</head> 
 | 
				
			||||||
 | 
					<body> 
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					<div id="wrapper"> 
 | 
				
			||||||
 | 
						<div id="header"> 
 | 
				
			||||||
 | 
							<h1>HTTParty</h1> 
 | 
				
			||||||
 | 
							<p>Tonight we're gonna HTTParty like it's 1999!</p> 
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							<ul id="nav">
 | 
				
			||||||
 | 
								<li><a href="rdoc/">Docs</a></li> 
 | 
				
			||||||
 | 
								<li><a href="http://github.com/jnunemaker/httparty">Github</a></li>
 | 
				
			||||||
 | 
								<li><a href="http://rubyforge.org/projects/httparty/">Rubyforge</a></li> 
 | 
				
			||||||
 | 
							</ul> 
 | 
				
			||||||
 | 
						</div> 
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						<div id="content"> 
 | 
				
			||||||
 | 
							<h2>Install</h2> 
 | 
				
			||||||
 | 
							<pre><code>$ sudo gem install httparty</code></pre> 
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							<h2>Some Quick Examples</h2>
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							<p>The following is a simple example of wrapping Twitter's API for posting updates.</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<pre><code>class Twitter
 | 
				
			||||||
 | 
					  include HTTParty
 | 
				
			||||||
 | 
					  base_uri 'twitter.com'
 | 
				
			||||||
 | 
					  basic_auth 'username', 'password'
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Twitter.post('/statuses/update.json', :query => {:status => "It's an HTTParty and everyone is invited!"})</code></pre>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<p>That is really it! The object returned is a ruby hash that is decoded from Twitter's json response. JSON parsing is used because of the .json extension in the path of the request. You can also explicitly set a format (see the examples). </p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							<p>That works and all but what if you don't want to embed your username and password in the class? Below is an example to fix that:</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					<pre><code>class Twitter
 | 
				
			||||||
 | 
					  include HTTParty
 | 
				
			||||||
 | 
					  base_uri 'twitter.com'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def initialize(user, pass)
 | 
				
			||||||
 | 
					    self.class.basic_auth user, pass
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def post(text)
 | 
				
			||||||
 | 
					    self.class.post('/statuses/update.json', :query => {:status => text})
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Twitter.new('username', 'password').post("It's an HTTParty and everyone is invited!")</code></pre>
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							<p><strong>More Examples:</strong> There are <a href="http://github.com/jnunemaker/httparty/tree/master/examples/">several examples in the gem itself</a>.</p>
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							<h2>Support</h2> 
 | 
				
			||||||
 | 
							<p>Conversations welcome in the <a href="http://groups.google.com/group/httparty-gem">google group</a> and bugs/features over at <a href="http://jnunemaker.lighthouseapp.com/projects/14842-httparty/overview">Lightouse</a>.</p> 
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
						</div> 
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
						<div id="footer"> 
 | 
				
			||||||
 | 
							<p>Created by <a href="http://addictedtonew.com/about/">John Nunemaker</a></p> 
 | 
				
			||||||
 | 
						</div> 
 | 
				
			||||||
 | 
					</div> 
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script> 
 | 
				
			||||||
 | 
					<script type="text/javascript">_uacct = "UA-85301-9"; urchinTracker();</script> 
 | 
				
			||||||
 | 
					 
 | 
				
			||||||
 | 
					<!-- 103bees.com 'bee' code v1.11 - please do not make any changes! --> 
 | 
				
			||||||
 | 
					<script type="text/javascript" src="http://103bees.com/bees/?bee=3672&fid=5643"></script> 
 | 
				
			||||||
 | 
					<!-- 103bees.com 'bee' code --> 
 | 
				
			||||||
 | 
					</body> 
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue