pyro2927 / GoogleDocsBackend

Use a Google Docs Spreadsheet in a style similar to Parse
GNU General Public License v2.0
20 stars 5 forks source link

GoogleDocsBackend

Use a Google Docs Spreadsheet in a style similar to Parse. You can setup a spreadsheet with all of the data you want, and pull that into your mobile application. An example spreadsheet can be seen here. The concept originated during the development on an app for Amp Music.

Screenshot

Version Platform

Setup

To allow a Google Spreadsheet to be accessed via this library (and API calls), you must Publish it. Note: Publishing and simply setting as public are two seperate things. See screenshots below The first row of cells acts as the keys for the objects fetched from the server, and each row after that is one object. Values for objects are paired with the keys in row 1. As such it is highly recommended that you name and protect row 1.

Publish

Start

In order to convert these into native NSObects, you need to subclass GDBModel, which makes use of Mantle. The important part is to implement + (NSDictionary *)JSONKeyPathsByPropertyKey in order to map the column headers to native attributes. See GDBExampleShowModel for a demonstration on how to do this.

Once you have that done, you can call [GoogleDocsServiceLayer objectsForWorksheetKey: sheetId: modelClass: callback:] in order to fetch the information from that spreadsheet and convert them into local native objects. See GDBExampleViewController's viewDidLoad for an example.

To find the correct sheetId, you can view view the worksheet info at https://spreadsheets.google.com/feeds/worksheets/0Atoge9gLkMCTdENkUkVENElFczlmTDl1ODZWaTJmeFE/public/basic?alt=json.

Shortcomings

A service like Parse is far more powerful, this is purely an attempt to have a cheap and free alternative. Several things Parse can do that this can't at this time:

What it CAN do:

Right now this only works as a read-only, non-relational backend. If that works for you, hurray!

Usage

To run the example project; clone the repo, and run pod install from the Example directory first.

Installation

GoogleDocsBackend is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "GoogleDocsBackend", :git => "https://github.com/pyro2927/GoogleDocsBackend.git"

TODOs

Author

pyro2927, joseph@pintozzi.com

License

GoogleDocsBackend is available under the GPLv2 license. See the LICENSE file for more info.