Permalink
Browse files

Add some comments to response classes

  • Loading branch information...
1 parent 0314b49 commit 681817a2d7ce2d9c9e01736e65440e1a5b6fa36d nas committed Nov 26, 2009
@@ -1,5 +1,17 @@
module UrlShortener
+ # e.g. bitly response
+ # <bitly>
+ # <errorCode>0</errorCode>
+ # <errorMessage></errorMessage>
+ # <results>
+ # <31IqMl>
+ # <longUrl>http://cnn.com/</longUrl>
+ # </31IqMl>
+ # </results>
+ # <statusCode>OK</statusCode>
+ # </bitly>
+
class Response::Expand < UrlShortener::Response
def initialize(response)
@@ -1,4 +1,45 @@
module UrlShortener
+
+ # All elements within doc are available as instance method calls.
+ # such as; info_response_instance.htmlMetaDescription or info_response_instance.htmlTitle
+ # if you don't like using camelised method names then you can use underscores like
+ # info_response_instance.html_meta_description or info_response_instance.html_title and it should work fine
+ #
+ # e.g. xml response
+ # <bitly>
+ # <errorCode>0</errorCode>
+ # <errorMessage/>
+ # <results>
+ # <doc>
+ # <urlFetched>http://www.cnn.com/</urlFetched>
+ # <shortenedByUser>bitly</shortenedByUser>
+ # <keywords/>
+ # <hash>31IqMl</hash>
+ # <exif/>
+ # <longUrl>http://cnn.com/</longUrl>
+ # <htmlMetaDescription>
+ # CNN.com delivers the latest breaking news and information on the latest top stories, weather, business, entertainment, politics, and more. For in-depth coverage, CNN.com provides special reports, video, audio, photo galleries, and interactive guides.
+ # </htmlMetaDescription>
+ # <indexed>1253643458</indexed>
+ # <htmlTitle>
+ # CNN.com - Breaking News, U.S., World, Weather, Entertainment &amp; Video News
+ # </htmlTitle>
+ # <htmlMetaKeywords>
+ # <item>CNN</item>
+ # <item>CNN news</item>
+ # <item>CNN.com</item>
+ # <item>CNN TV</item>
+ # <item>news</item>
+ # </htmlMetaKeywords>
+ # <mirrorUrl/>
+ # <keyword/>
+ # <contentLegth>99195.0</contentLegth>
+ # <fileExtension/>
+ # </doc>
+ # </results>
+ # <statusCode>OK</statusCode>
+ # </bitly>
+
class Response::Info < UrlShortener::Response
def initialize(response)
@@ -1,4 +1,23 @@
module UrlShortener
+
+ # Provides methods to easily access data from the response returned by bitly when shortening a url.
+ # Can return multiple or single short urls
+ # e.g. bitly response
+ # <bitly>
+ # <errorCode>0</errorCode>
+ # <errorMessage/>
+ # <results>
+ # <nodeKeyVal>
+ # <userHash>15DlK</userHash>
+ # <shortKeywordUrl/>
+ # <hash>31IqMl</hash>
+ # <nodeKey>http://cnn.com</nodeKey>
+ # <shortUrl>http://bit.ly/15DlK</shortUrl>
+ # </nodeKeyVal>
+ # </results>
+ # <statusCode>OK</statusCode>
+ # </bitly>
+
class Response::Shorten < UrlShortener::Response
def initialize(response)
@@ -1,4 +1,46 @@
module UrlShortener
+
+ # Provides methods to access stats data returned by bitly for a short url
+ # Apart from the obvious methods provided below such as :
+ # * hash
+ # * referrers
+ # * user_referrers
+ # the value of any xml element can be accessed using their element names
+ # like clicks
+
+ # e.g. stats response xml
+ # <bitly>
+ # <errorCode>0</errorCode>
+ # <errorMessage/>
+ # <results>
+ # <referrers>
+ # <nodeKeyVal>
+ # <direct>818</direct>
+ # <nodeKey></nodeKey>
+ # </nodeKeyVal>
+ # <nodeKeyVal>
+ # <nodeKey>www.exalead.com</nodeKey>
+ # <nodeKeyVal>
+ # <nodeValue>1</nodeValue>
+ # <nodeKey>/</nodeKey>
+ # </nodeKeyVal>
+ # </nodeKeyVal>
+ # <nodeKeyVal>
+ # <nodeKeyVal>
+ # <nodeValue>1</nodeValue>
+ # <nodeKey></nodeKey>
+ # </nodeKeyVal>
+ # <nodeKey>www.tongs.org.uk</nodeKey>
+ # </nodeKeyVal>
+ # REST OF THE ELEMENTS SKIPPED .......
+ # </referrers>
+ # <hash>1RmnUT</hash>
+ # <clicks>2343</clicks>
+ # </results>
+ # <statusCode>OK</statusCode>
+ # </bitly>
+
+
class Response::Stats < UrlShortener::Response
def initialize(response)

0 comments on commit 681817a

Please sign in to comment.