Skip to content

Instantly share code, notes, and snippets.

@elskwid
Created November 5, 2010 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elskwid/664833 to your computer and use it in GitHub Desktop.
Save elskwid/664833 to your computer and use it in GitHub Desktop.
Some examples of responses from posterous v2 api using ruby 1.8.7 with HTTParty
# Previously I was doing this:
def self.orig_recent_posts
response = get "/users/me/sites/primary/posts/public?page=1", AUTH
response.code == 200 ? response.parsed_response : nil
end
# Which would return this:
ruby-1.8.7-p302 > Posterous.orig_recent_posts.first["body_html"]
=> "\\u003Cp\\u003EWhat a fun night!\\u003C/p\\u003E\r\n\\u003Cp\\u003EThe \\u003Ca href=\"http://renocollective.com/\" target=\"_blank\"\\u003EReno Collective\\u003C/a\\u003E let us use some of their space, and by 7pm we were ready to roll with the famous Moustache Ride from \\u003Ca href=\"http://www.eclipsepizza.net/\" target=\"_blank\"\\u003EEclipse Pizza\\u003C/a\\u003E, and some beer and wine donated by Amendment 21.\\u003C/p\\u003E\r\n\\u003Cp\\u003EAfter a quick ceremonial speech, a couple of chairs were set up so that the barbers from \\u003Ca href=\"http://www.yelp.com/biz/old-west-barber-shop-reno\" target=\"_blank\"\\u003EOld West Barber Shop\\u003C/a\\u003E could get to work. They had clippers to get unruly facial hair down to a short length, and then they even offered full shaves to get everyone clean-shaven and fully compliant with the Movember \\u003Ca href=\"http://us.movember.com/news/view/id/1090/category/national/\" target=\"_blank\"\\u003Ecompetition rules\\u003C/a\\u003E. By the way, they did this for free and one of the barbers even shaved his goatee to join in the Mo-action. You should check them out if you're looking for a good shave, they excellent old-fashioned shaves at their shop that will leave you feeling like a true gentleman (and if you tell them that you're doing Movember, you'll get a little something special!).\\u003C/p\\u003E\r\n\\u003Cp\\u003E[[posterous-content:HwiBaGEulmnGdwnwIrCw]]\\u003C/p\\u003E\r\n\\u003Cp\\u003EWe had over 20 gentlemen who needed shaving, and we saved the best for last: \\u003Ca href=\"http://www.calvertphotography.com/\" target=\"_blank\"\\u003EDavid Calvert\\u003C/a\\u003E had a beard... and he shaved it all off! It took a lot of time, but it was well worth it. There's a video of that in the works, we'll certainly share for you to see how it's done.\\u003C/p\\u003E\r\n\\u003Cp style=\"text-align: center;\"\\u003E------\\u003C/p\\u003E\r\n\\u003Cp\\u003EAlso: The Nevada Sagebrush posted an article about Movember in Reno! See it for yourself: \\u003Ca href=\"http://nevadasagebrush.com/blog/2010/11/01/locals-sport-‘staches’-for-men’s-health/\" target=\"_blank\"\\u003Ehttp://nevadasagebrush.com/blog/2010/11/01/locals-sport-‘staches’-for-men’s-health/\\u003C/a\\u003E\\u003C/p\\u003E"
ruby-1.8.7-p302 > Posterous.orig_recent_posts.first["body_full"]
=> "\\u003Cp\\u003EWhat a fun night!\\u003C/p\\u003E\r\n\\u003Cp\\u003EThe \\u003Ca href=\"http://renocollective.com/\" target=\"_blank\"\\u003EReno Collective\\u003C/a\\u003E let us use some of their space, and by 7pm we were ready to roll with the famous Moustache Ride from \\u003Ca href=\"http://www.eclipsepizza.net/\" target=\"_blank\"\\u003EEclipse Pizza\\u003C/a\\u003E, and some beer and wine donated by Amendment 21.\\u003C/p\\u003E\r\n\\u003Cp\\u003EAfter a quick ceremonial speech, a couple of chairs were set up so that the barbers from \\u003Ca href=\"http://www.yelp.com/biz/old-west-barber-shop-reno\" target=\"_blank\"\\u003EOld West Barber Shop\\u003C/a\\u003E could get to work. They had clippers to get unruly facial hair down to a short length, and then they even offered full shaves to get everyone clean-shaven and fully compliant with the Movember \\u003Ca href=\"http://us.movember.com/news/view/id/1090/category/national/\" target=\"_blank\"\\u003Ecompetition rules\\u003C/a\\u003E. By the way, they did this for free and one of the barbers even shaved his goatee to join in the Mo-action. You should check them out if you're looking for a good shave, they excellent old-fashioned shaves at their shop that will leave you feeling like a true gentleman (and if you tell them that you're doing Movember, you'll get a little something special!).\\u003C/p\\u003E\r\n\\u003Cp\\u003E\\u003Cimg src=\"http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/DanzGgifjHyvtjcuGdBGfokbelCsIBdoxtpHzocpGslIABbIjIcwzAwsJJkD/74889_454332811742_113264911742_6132591_5513655_n.jpg.scaled500.jpg\" width=\"480\" height=\"720\"/\\u003E\n\\u003Ca href='http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/bBsjxHFGkaduFeAdxHJrqqrkvcnvIHkfszGBskziCkcwmbbFuBxElokwFdEr/73853_454332041742_113264911742_6132560_1981179_n.jpg.scaled1000.jpg'\\u003E\\u003Cimg src=\"http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/bBsjxHFGkaduFeAdxHJrqqrkvcnvIHkfszGBskziCkcwmbbFuBxElokwFdEr/73853_454332041742_113264911742_6132560_1981179_n.jpg.scaled500.jpg\" width=\"500\" height=\"333\"/\\u003E\\u003C/a\\u003E\n\\u003Ca href='http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/BaGakDDIhrqiHBpjJtbbnhulblaDDEsrFiggygCikvcrxcysgDAoGazulCBu/71771_454333691742_113264911742_6132622_4539108_n.jpg.scaled1000.jpg'\\u003E\\u003Cimg src=\"http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/BaGakDDIhrqiHBpjJtbbnhulblaDDEsrFiggygCikvcrxcysgDAoGazulCBu/71771_454333691742_113264911742_6132622_4539108_n.jpg.scaled500.jpg\" width=\"500\" height=\"333\"/\\u003E\\u003C/a\\u003E\n\\u003Cdiv\\u003E\\u003Ca href='http://blog.cityofremo.com/movember-kick-off-shave-off-recap'\\u003ESee and download the full gallery on posterous\\u003C/a\\u003E\\u003C/div\\u003E\\u003C/p\\u003E\r\n\\u003Cp\\u003EWe had over 20 gentlemen who needed shaving, and we saved the best for last: \\u003Ca href=\"http://www.calvertphotography.com/\" target=\"_blank\"\\u003EDavid Calvert\\u003C/a\\u003E had a beard... and he shaved it all off! It took a lot of time, but it was well worth it. There's a video of that in the works, we'll certainly share for you to see how it's done.\\u003C/p\\u003E\r\n\\u003Cp style=\"text-align: center;\"\\u003E------\\u003C/p\\u003E\r\n\\u003Cp\\u003EAlso: The Nevada Sagebrush posted an article about Movember in Reno! See it for yourself: \\u003Ca href=\"http://nevadasagebrush.com/blog/2010/11/01/locals-sport-‘staches’-for-men’s-health/\" target=\"_blank\"\\u003Ehttp://nevadasagebrush.com/blog/2010/11/01/locals-sport-‘staches’-for-men’s-health/\\u003C/a\\u003E\\u003C/p\\u003E"
# My fix was to do this:
def self.recent_posts
response = get "/users/me/sites/primary/posts/public?page=1", AUTH
response.code == 200 ? ::JSON.parse(response.body) : nil
end
# And now I get this:
ruby-1.8.7-p302 > Posterous.recent_posts.first["body_html"]
=> "<p>What a fun night!</p>\r\n<p>The <a href=\"http://renocollective.com/\" target=\"_blank\">Reno Collective</a> let us use some of their space, and by 7pm we were ready to roll with the famous Moustache Ride from <a href=\"http://www.eclipsepizza.net/\" target=\"_blank\">Eclipse Pizza</a>, and some beer and wine donated by Amendment 21.</p>\r\n<p>After a quick ceremonial speech, a couple of chairs were set up so that the barbers from <a href=\"http://www.yelp.com/biz/old-west-barber-shop-reno\" target=\"_blank\">Old West Barber Shop</a> could get to work. They had clippers to get unruly facial hair down to a short length, and then they even offered full shaves to get everyone clean-shaven and fully compliant with the Movember <a href=\"http://us.movember.com/news/view/id/1090/category/national/\" target=\"_blank\">competition rules</a>. By the way, they did this for free and one of the barbers even shaved his goatee to join in the Mo-action. You should check them out if you're looking for a good shave, they excellent old-fashioned shaves at their shop that will leave you feeling like a true gentleman (and if you tell them that you're doing Movember, you'll get a little something special!).</p>\r\n<p>[[posterous-content:HwiBaGEulmnGdwnwIrCw]]</p>\r\n<p>We had over 20 gentlemen who needed shaving, and we saved the best for last: <a href=\"http://www.calvertphotography.com/\" target=\"_blank\">David Calvert</a> had a beard... and he shaved it all off! It took a lot of time, but it was well worth it. There's a video of that in the works, we'll certainly share for you to see how it's done.</p>\r\n<p style=\"text-align: center;\">------</p>\r\n<p>Also: The Nevada Sagebrush posted an article about Movember in Reno! See it for yourself: <a href=\"http://nevadasagebrush.com/blog/2010/11/01/locals-sport-&amp;lsquo;staches&amp;rsquo;-for-men&amp;rsquo;s-health/\" target=\"_blank\">http://nevadasagebrush.com/blog/2010/11/01/locals-sport-&lsquo;staches&rsquo;-for-men&rsquo;s-health/</a></p>"
ruby-1.8.7-p302 > Posterous.recent_posts.first["body_full"]
=> "<p>What a fun night!</p>\r\n<p>The <a href=\"http://renocollective.com/\" target=\"_blank\">Reno Collective</a> let us use some of their space, and by 7pm we were ready to roll with the famous Moustache Ride from <a href=\"http://www.eclipsepizza.net/\" target=\"_blank\">Eclipse Pizza</a>, and some beer and wine donated by Amendment 21.</p>\r\n<p>After a quick ceremonial speech, a couple of chairs were set up so that the barbers from <a href=\"http://www.yelp.com/biz/old-west-barber-shop-reno\" target=\"_blank\">Old West Barber Shop</a> could get to work. They had clippers to get unruly facial hair down to a short length, and then they even offered full shaves to get everyone clean-shaven and fully compliant with the Movember <a href=\"http://us.movember.com/news/view/id/1090/category/national/\" target=\"_blank\">competition rules</a>. By the way, they did this for free and one of the barbers even shaved his goatee to join in the Mo-action. You should check them out if you're looking for a good shave, they excellent old-fashioned shaves at their shop that will leave you feeling like a true gentleman (and if you tell them that you're doing Movember, you'll get a little something special!).</p>\r\n<p><img src=\"http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/DanzGgifjHyvtjcuGdBGfokbelCsIBdoxtpHzocpGslIABbIjIcwzAwsJJkD/74889_454332811742_113264911742_6132591_5513655_n.jpg.scaled500.jpg\" width=\"480\" height=\"720\"/>\n<a href='http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/bBsjxHFGkaduFeAdxHJrqqrkvcnvIHkfszGBskziCkcwmbbFuBxElokwFdEr/73853_454332041742_113264911742_6132560_1981179_n.jpg.scaled1000.jpg'><img src=\"http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/bBsjxHFGkaduFeAdxHJrqqrkvcnvIHkfszGBskziCkcwmbbFuBxElokwFdEr/73853_454332041742_113264911742_6132560_1981179_n.jpg.scaled500.jpg\" width=\"500\" height=\"333\"/></a>\n<a href='http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/BaGakDDIhrqiHBpjJtbbnhulblaDDEsrFiggygCikvcrxcysgDAoGazulCBu/71771_454333691742_113264911742_6132622_4539108_n.jpg.scaled1000.jpg'><img src=\"http://posterous.com/getfile/files.posterous.com/temp-2010-11-04/BaGakDDIhrqiHBpjJtbbnhulblaDDEsrFiggygCikvcrxcysgDAoGazulCBu/71771_454333691742_113264911742_6132622_4539108_n.jpg.scaled500.jpg\" width=\"500\" height=\"333\"/></a>\n<div><a href='http://blog.cityofremo.com/movember-kick-off-shave-off-recap'>See and download the full gallery on posterous</a></div></p>\r\n<p>We had over 20 gentlemen who needed shaving, and we saved the best for last: <a href=\"http://www.calvertphotography.com/\" target=\"_blank\">David Calvert</a> had a beard... and he shaved it all off! It took a lot of time, but it was well worth it. There's a video of that in the works, we'll certainly share for you to see how it's done.</p>\r\n<p style=\"text-align: center;\">------</p>\r\n<p>Also: The Nevada Sagebrush posted an article about Movember in Reno! See it for yourself: <a href=\"http://nevadasagebrush.com/blog/2010/11/01/locals-sport-&amp;lsquo;staches&amp;rsquo;-for-men&amp;rsquo;s-health/\" target=\"_blank\">http://nevadasagebrush.com/blog/2010/11/01/locals-sport-&lsquo;staches&rsquo;-for-men&rsquo;s-health/</a></p>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment