ruby on rails app and google app scripts - ruby

I have a app which runs on ruby on rails and mysql database. I need to generate couple of reports. Presently I am generating csv file but my Idea is to integrate with the google docs, as soon as a user opens a particular doc automatically it has to sync with the my rails app and fetch the data from the database and display in the google docs.
I need little heads up.I have gone through the docs, but couldn't figure out the way of doing it.
Thanks

Check out the to_google_spreadsheets gem. It is well documented and seems to have all the functionality you are looking for.
Cheers,
Sean

You will need to write an onOpen in your gdoc. From there call urlfetch to your app.

Related

Ruby and databases

I am new in programming in Ruby, not to mention databases, so i would like a few pointers to my question. I have a few websites, where i gather information from users by a form, which they fill out (my websites are in Wordpress). The form is made in Contact Form 7 (https://wordpress.org/plugins/contact-form-7/) and the info is stored in the database with this plugin (https://wordpress.org/plugins/contact-form-7-to-database-extension/).
My question is: Is it possible to make a ruby program, that would fetch info from my sites (databases) and show me the information? Is there a better way of doing this (Ruby on rails perhaps)?
It is possible to access your wp data from a ruby app. You will need to familiarise yourself with the wordpress api. This gem might also help. You can build a small sinatra based app to keep it simple or use rails.

Can a Dashboard widget use SQLite data?

I made an iOS app that has my favorite quotes in it by category. I wanted to turn this into a dashboard widget that notifies me of a quote of the day. I've never made a dashboard widget and only read the hello world example on apple site.
Can anyone suggest a good tutorial or help me understand the following:
What is the best way to take my SQLite database of quotes and make it available through a dashboard widget?
Thank you.
Dashboard is, like, really old... it has the look of a technology that's barely clinging to life support.
But if you want to fool around with it anyway, the way to access SQLite from a widget would be to implement a native widget plug-in that uses the SQLite library, exposing methods that your widget JavaScript code can call to fetch the info you need.
Or, as you seem to have done, repackage the data in a different form that you can access more conveniently from widget JavaScript.
I ended up using NerdTools and implemented an awk script to pull a random quote from a text file on my computer. So this was solved a different way.

Is it possible to incorporate QuickBooks PHP DevKit into CodeIgniter

Specifically speaking, is it possible to use Consolibyte's Quickbooks PHP DevKit into an app using the CodeIgniter framework? If so, where would I place it in my directory structure, and how would I access it? I'm just doing some preliminary research into whether or not this could be used to integrate my app with Quickbooks Online.
Thanks for any input!
is it possible to use Consolibyte's Quickbooks PHP DevKit into an app using the CodeIgniter framework?
Yes, of course!
If so, where would I place it in my directory structure, and how would I access it?
Entirely up to you. Usually people put it in a library/quickbooks/ directory or something. Then, just use require_once 'path/to/library/quickbooks/QuickBooks.php'; like you would with any other PHP script.
I'm just doing some preliminary research into whether or not this could be used to integrate my app with Quickbooks Online.
It can be used for that.
You'll need a controller that kicks off the OAuth process. So basically you'll use the code from here:
https://github.com/consolibyte/quickbooks-php/blob/master/docs/partner_platform/example_app_ipp_v3/index.php#L134
To show the connect button, and then put this code into a controller to kick off OAuth:
https://github.com/consolibyte/quickbooks-php/blob/master/docs/partner_platform/example_app_ipp_v3/oauth.php
From there, you can use the other example code snippets to exchange data with QuickBooks.
If you have trouble, post your code so we can see what you're doing (feel free to use our support forums if you need more detailed help/discussion: http://www.consolibyte.com/forum/)

having chrome extensions pulling data from ruby db

I would like to build a chrome extension (CE) that pulls data from a ruby db for a specific user. So, in a basic example, if an user submits their favorite color as 'red' and sport as 'tennis' into the db from the core website, when they click the CE, 'red' and 'tennis' will show up no matter where they are on the internet.
Any guidance on how to build something like this? Seems quite simple but am not sure how the CE files fit in with the ruby folder framework.
Also, is it possible to write to a ruby database from a popped out CE? i.e. - submitting 'red' and 'tennis' from the CE to the ruby database to go along with the previous example. Any guidance?
Cheers
This is a very general question so it sounds like you will need to learn a lot. Which can be a good thing :)
Here are the general steps you need:
Look into building an API for your ruby application. This will allow you to get data from your database. For example, you can
make an app where you go to http://yoursite.com/api/favorites and that will return a list of all favorites as JSON. Then in your Chrome Extension you can parse the JSON and display the results to the user. You will probably want to do this using an ajax call (see jquery.ajax for an easy way to use ajax).
Assuming you want user accounts, your user will need to be logged in. Then you can use your user's cookies to verify that they are logged in and show them custom info. i.e. going to http://yoursite.com/api/favorites will just show the favorites for that user, not for everyone.
Finally, submitting things to the database...you can have another route where users can send stuff. For example, if you go to http://yoursite.com/api/favorites/add?color=red then it will add the color red to that user's favorites. You will need to write all the logic for adding stuff to the database...again, it might help you to go through a rails tutorial and then look at building an API.
Related to #3, look into RESTful APIs. A good convention is that if you issue a GET request, you're asking for data, but if you issue a POST request, you are adding data (in your case, creating a new favorite).
Finally, for terminology: it's not a "ruby" database, it's just a database. You can access a database using almost any language, and it sounds like you are accessing it using ruby right now :)
If you only need to store data for one machine browsing anywhere online, chrome has a storage api that would work great.
If you do need a ruby server, I would recommend looking at sinatra.

How can I update my business' Facebook page via my Ruby on Rails app?

I'm creating a new rails app for my business, and I just finished a new feature where I can put an announcement on the website (for specials, sales, etc.). I want this announcement to automatically be set to my business' Facebook page. How can I easily do this? Is the only way to create a Facebook application, and then if so, can a Facebook application have permissions to edit a business' page (I know apps can edit user profiles, but I don't know about business pages)?
Thanks for any help!
you can always create a rss and use for example rss grafiti http://apps.facebook.com/rssgraffiti on facebook.
i think this is the simplest solution, instead of creating application.
This might not be what you want, but it'd be trivial to use something like Watir to navigate to the webpage itself and post your status; however, I'm not sure Facebook provides something in their API for direct update.
I found a service called "Twitterfeed" that posts updates from an RSS feed to twitter and Facebook (among other services). This is a perfect solution for what I needed!
There is a gem called 'facebooker', that might help you.
http://apps.facebook.com/facebooker_tutorial/
cheers,
sameera

Resources