From b1fd5968e994054a461a8021f890c81553ed620d Mon Sep 17 00:00:00 2001 From: Sujin/Sushi Date: Thu, 29 Aug 2013 13:30:46 -0400 Subject: [PATCH] added ruby library docs --- docs/libraries/ruby.markdown | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 docs/libraries/ruby.markdown diff --git a/docs/libraries/ruby.markdown b/docs/libraries/ruby.markdown new file mode 100644 index 0000000..ffb5a25 --- /dev/null +++ b/docs/libraries/ruby.markdown @@ -0,0 +1,36 @@ +Open Photo API / Ruby Library +======================= +#### OpenPhoto, a photo service for the masses + +---------------------------------------- + + +### Installation +gem install openphoto-ruby + + +### How to use the library + +To use the library you need to first require 'openphoto-ruby', retrieve your OAuth credentials, then instantiate an instance of the client and start making calls. + + require 'rubygems' + require 'openphoto-ruby' + + @client = Openphoto::Client.new(@site, @consumer_key, @consumer_secret, @access_token, @access_token_secret) + photo = @client.connect(:post, "/photo/upload.json", {"photo"=>"/tmp/photo.png", "permission"=>"1", "title"=>"test upload"}) + puts "#{photo.message} #{@site}/photo/#{photo.result["id"]}/view" + +---------------------------------------- + + +#### Getting your credentials + +You can get your credentials by clicking on the arrow next to your email address once you're logged into your site and then clicking on settings. +If you don't have any credentials then you can create one for yourself by going to `/v1/oauth/flow`. +Once completed go back to the settings page and you should see the credential you just created + +---------------------------------------- + +#### OpenPhoto installation and API documentation + +You can find more information at the main OpenPhoto documentation page.