Latest 0.1.0
Homepage https://github.com/naoty/NTYAirData
License MIT
Platforms ios 6.0, osx 10.8, requires ARC
Dependencies GCDWebServer, ActiveSupportInflector
Frameworks CoreData
Authors

Version
Platform

Installation

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

pod "NTYAirData"

Usage

NTYAirDataServer *server = [[NTYAirDataServer alloc] initWithManagedObjectContext:context];
[server addResource:[NTYResourceDescription resourceForEntityName:@"User" resourceKey:@"name"]];
[server addResource:[NTYResourceDescription resourceForEntityName:@"Article" resourceKey:@"uid"]];
[server start];

By default, a HTTP server runs in your application at 80 port on devices or 8080 port on simulators. You can change the port by startWithPort:.

NTYResourceDescription describes a resource served by the server. resourceKey is used to identify a resource because objects managed by Core Data have no primary key.

RESTful API

The server has RESTful APIs for data managed by Core Data. If your application have User entity, the server will have below APIs.

GET    /users.json               - get the collection of user objects
GET    /users/:resource_key.json - get an user object identified by :resource_key
POST   /users.json               - create a new user object

The server will response data in the format of JSON like below.

$ curl http://192.168.1.10/users.json
[
  {
    "age": 18,
    "name": "Alice"
  },
  {
    "age": 19,
    "name": "Bob"
  },
  {
    "age": 20,
    "name": "Charlie"
  }
]
$ curl http://192.168.1.10/users/Alice.json
{
  "age": 18,
  "name": "Alice"
}

Latest podspec

{
    "name": "NTYAirData",
    "version": "0.1.0",
    "summary": "A RESTful API server for Core Data",
    "description": "                            This is a RESTful API server which is embedded in yourn                            application and responses data from Core Data.n                            This server helps to manage data in development.n",
    "homepage": "https://github.com/naoty/NTYAirData",
    "license": "MIT",
    "authors": {
        "Naoto Kaneko": "[email protected]"
    },
    "source": {
        "git": "https://github.com/naoty/NTYAirData.git",
        "tag": "0.1.0"
    },
    "social_media_url": "https://twitter.com/naoty_k",
    "source_files": "Classes",
    "platforms": {
        "ios": "6.0",
        "osx": "10.8"
    },
    "frameworks": "CoreData",
    "requires_arc": true,
    "dependencies": {
        "GCDWebServer": [
            "~> 2.4.0"
        ],
        "ActiveSupportInflector": [
            "~> 0.0.1"
        ]
    }
}

Pin It on Pinterest

Share This