Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pyro2927/googledocsbackend
Use a Google Docs Spreadsheet in a style similar to Parse
https://github.com/pyro2927/googledocsbackend
Last synced: about 17 hours ago
JSON representation
Use a Google Docs Spreadsheet in a style similar to Parse
- Host: GitHub
- URL: https://github.com/pyro2927/googledocsbackend
- Owner: pyro2927
- License: gpl-2.0
- Created: 2014-02-13T15:51:55.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-10T08:54:50.000Z (over 9 years ago)
- Last Synced: 2024-10-21T04:09:33.546Z (30 days ago)
- Language: Objective-C
- Size: 591 KB
- Stars: 20
- Watchers: 4
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://docs.google.com/spreadsheet/ccc?key=0Atoge9gLkMCTdENkUkVENElFczlmTDl1ODZWaTJmeFE&usp=sharing). The concept originated during the development on an app for [Amp Music](http://amp-music.com/).
![Screenshot](./img/doc_and_app.png)
[![Version](http://cocoapod-badges.herokuapp.com/v/GoogleDocsBackend/badge.png)](http://cocoadocs.org/docsets/GoogleDocsBackend)
[![Platform](http://cocoapod-badges.herokuapp.com/p/GoogleDocsBackend/badge.png)](http://cocoadocs.org/docsets/GoogleDocsBackend)## 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](https://support.google.com/drive/answer/63175?hl=en) row 1.![Publish](./img/publish.png)
![Start](./img/start_publishing.png)
In order to convert these into native NSObects, you need to subclass `GDBModel`, which makes use of [Mantle](https://github.com/MantleFramework/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 .
![](./img/worksheet_json.png)
## Shortcomings
A service like [Parse](https://parse.com/) 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:
* Allow client-side creation of objects
* Support pointers/relationshipsWhat it CAN do:
* Support unlimited number of collaborators via sharing the document via Google Drive/Docs to other Google users
* Be free for unlimited API requestsRight 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](http://cocoapods.org), to install
it simply add the following line to your Podfile:pod "GoogleDocsBackend", :git => "https://github.com/pyro2927/GoogleDocsBackend.git"
## TODOs
* ~~Handle gaps in cells better~~
* ~~Parse header keys via nsregularexpressions~~
* ~~Publish to CocoaPods~~
* Clean up documentation
* Enable writing of data
* Handle BOOLs and NSDates more cleanly
* Allow accessing of non-attributed values## Author
pyro2927, [email protected]
## License
GoogleDocsBackend is available under the GPLv2 license. See the LICENSE file for more info.