Sunday, 18 August 2013

Using my Rails app API for iPhone App

Using my Rails app API for iPhone App

I'm learning iOS Development with the Treehouse Library. Building an app
that gets information from a json API.
In the Treehouse API page all the posts are under a parent called "Posts"
(http://blog.teamtreehouse.com/api/get_recent_summary/)
posts: [
{
id: 22198,
url:
"http://blog.teamtreehouse.com/using-github-pages-to-host-your-website",
title: "Using GitHub Pages To Host Your Website",
date: "2013-08-16 09:30:20",
author: "Matt West",
thumbnail:
"http://blog.teamtreehouse.com/wp-content/uploads/2013/08/github-pages-feature-150x150.jpg"
},
{
id: 22196,
url:
"http://blog.teamtreehouse.com/running-tests-in-ruby-on-rails-treehouse-quick-tip",
title: "Running Tests in Ruby on Rails – Treehouse Quick Tip",
date: "2013-08-15 14:30:48",
author: "Jason Seifer",
thumbnail: null
},
The API from my Rails app doesnt have a Parent
(http://www.soleresource.com/releases.json)
[
{
shoe_name: "Air Jordan 4 "Green Glow"",
release_date: "2013-08-17T00:00:00.000Z",
shoe_colorway: "Dark-Grey/Green-Glow",
shoe_price: "160",
url: "http://www.soleresource.com/releases/8.json"
},
{
shoe_name: "Nike Barkley Posite",
release_date: "2013-08-17T00:00:00.000Z",
shoe_colorway: "Gamma-Green/Black",
shoe_price: "235",
url: "http://www.soleresource.com/releases/17.json"
},
In order to get the app to work I have to call the Parent (posts), like this:
self.upcomingReleases = [dataDictionary objectForKey:@"posts"];
How can I "wrap" my API under a Parent? (My model is called "Releases")

No comments:

Post a Comment