Coder Social home page Coder Social logo

googledocsbackend's Introduction

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:

  • Allow client-side creation of objects
  • Support pointers/relationships

What 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 requests

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

  • 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.

googledocsbackend's People

Contributors

pyro2927 avatar eladb avatar

Stargazers

Lye Guang Xing avatar John D. Pope avatar Henry S avatar  avatar Iggy avatar PeterV avatar Steven Zhang avatar Ameesh Kapoor avatar  avatar  avatar Genady Okrain avatar Mehmet Taskiner avatar Walker Wilkins avatar  avatar Yasuhiro Inami avatar Steven Schobert avatar Jayson Lane avatar Hector Zarate avatar Zach Williams avatar  avatar

Watchers

 avatar James Cloos avatar Danny avatar  avatar

googledocsbackend's Issues

Offline caching behaviour

Hi @pyro2927,

Wow — my application has a lot of static data that I want to manage from something like Google Sheets so thanks for putting this together. I realised this solution was better than Parse because Local Data Store has some major performance issues on older devices when fetching thousands of rows.

I want the spreadsheet data to be accessible even when the device is offline. Is there an easy way to achieve this through Mantle's caching capabilities, or is it better to handle this manually?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.