Box.net data access through attachements.me ruby gem - ruby-on-rails-3

Can anyone please have some tutorial or link for accessing Box.net API through attachements.me ruby gem?
I want to access box data though attachements.me ruby gem from Ruby on Rails application but I don't understand where to start.
I created a new rail app and want to add attachements.me ruby gem. I updated the gem file and installed bundle.
I will have to authenticate users but cant understand where to start.
Thanks

You should start by reading through their great documentation here: https://github.com/attachmentsme/ruby-box
A great place to begin is authenticating a user. You need to redirect them to the authorize_url after they click a button or link in one of your views to connect their Box account.
Box will send a code with the redirect URI that you need to capture to create this instance variable: #token = session.get_access_token('code-returned-to-redirect_url')
Once you do this, use the #token instance variable to create a session = RubyBox::Session.new
To understand what is going on behind the scenes, I'd also recommend reading through the Box documentation here: http://developers.box.com/oauth/

Related

Twitter gem will only send from production server

I am using twitter gem 4.8.1 http://rdoc.info/gems/twitter
It will not send stuff locally for some reason (all credentials the same and set up) saying "unable to verify your credentials" ... when the code is pushed to Heroku though it tweets with no problem.
Any reason for this? Would be nice to test out stuff locally with the gem.
Thanks!
Usually sites like Twitter or Facebook require that you register the domain you will use when publishing. If you registered www.mydomain.com with Twitter, that is the only domain it will accept connections from.
So you will need your Tweets to come from the website you entered here:
https://dev.twitter.com/apps/new

PHPBB Authentication + Rails

I have a phpbb forum and i am developing a rails application that will be used for a mobile friendly app. I need a way to perform SSO between phpbb and rails.
I found a ruby gem called phpbb-auth on github but it hasn't been updated in over 3 years.
My initial thoughts were to mimic phpass (which i believe is what the latest phpbb uses) in rails and then just have rails reference the phpbb_users table when authenticating with Devise/Warden.
However, that task became daunting and would become just another lib to manage.
My next thought was to write a plugin for Warden to check for a phpbb_session and if its there, then continue. Otherwise redirect them to the phpbb login page.
Has anyone come across doing this before, and if so what was the method you used.
I doing same thing right now (already succeed actually).
So, you basically have several options depending on your setup/deployment. Consider following:
Will you deploy your rails app and phpbb on same domain or different domains?
Have both sites access to each other db.
Which authentication system you whish to use? So, you'd like rails (i.e. devise, authlogic or whatever) authenticate and handle users or phpbb db auth (i.e. storing logins and password in phpbb users table).
So far, I've implement auth through phpbb db auth + single domain with my app (phpbb: forum.example.com, my rails app is on: example.com for cookie sharing). In this case you can use code from gem you have mentioned (phpbb-auth). It's not very hard. Code is still working fine (with some adjustments probably).
BUT
I do not like it this way :) I consider my site as a main app and do not want forum to handle my users...
So, as I understand starting from phpbb 3 you can write plugin (API docs) for external auth for phpbb.
There are several examples in Python and Django in the net. Looks like this one for same domain + db access. And looks like this one for doing things remotely with JavaScript. Those are in Python, but there's not too much Python inside, only some examples :), so you can easily adopt them for rails, I think.
This question discuss same stuff, but in more generic way.

fileupload and backbone.js + Rails

I managed to create a small app that uses backbone.js for CRUD process.
Now i am trying to include file upload as well in "Create". i m using "paperclip" to upload image. As i am learning about backbone.js please tell me some approach to making it?
You cannot do this with backbone models. You will have to create a form (including the file field) on the client side and post form to the server.
You can use something like that on the client:
http://www.williambharding.com/blog/rails/rails-ajax-image-uploading-made-simple-with-jquery/
You may want to check out the jquery.iframe.transport plugin. Since you're using rails 3, you can use remotipart instead (it bundles the iframe.transport plugin), which hooks into rails's ujs driver to automatically add support for file upload in ajax requests.

Share login status between WordPress blog and RoR app?

I'm using devise for authentication in my Rails application. I have a WordPress installation for the blog portion of the project (because I need several WP plugins).
Is it possible to integrate the user authentication from the RoR application into the blog, so that when someone logs into the app, then goes to the blog, their signed it status remains and shows up.
If that's possible, it should also be possible for them to log in while viewing the blog and then go straight to their page when they go to the app, right?
You have to store session information about WP and Rails session in one storage and check WP auth cookies on Rails application.

authlogic connect tutorial

I am trying to add the facebook connect to an existing site in rails 3 that uses authlogic.
so that existing users can sign in via their facebook account (I'll find existing account via email id in facebook ) and new users can sign up using facebook too.
I am trying to use authlogic connect
( I found other alternative like omniauth , facebooker2 etc , omniauth plays well with devise but I dont want to move to devise & it seems only authlogic connect plays well with authlogic and rails3 )
But I am unable to find some proper tutorial where I could understand how to use it.
I looked at their project site :
https://github.com/viatropos/authlogic-connect
I used the little help on their site and tried to do a little.
Now when the facebook login button is clicked it goes to facebook page asks for all the permission and then it comes back to a url with code as a paramater. what do I do with the code param ?
Can someone suggest me a proper tutorial (not example) for using the authlogic connect
Thank you
I really gave up on authlogic connect.
Though it seems its the best solution, It integrates so much iwht the authlogic that I am unable to customize it.
I finally got omniauth working with authlogic , though a lot of things were manually done
railcasts simple omniauth authentication helped a lot,