Skip to content

kubbing/BI-iOS-Table-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BI-iOS-Table-Server

Backend for the second homework.

Prerequisities

Note: Tested on both OS X and Linux (Wheezy 64b).

XCode (on Linux, you need curl, build-essentials, …)

rvm - the ruby version manager (in ~/.rvm folder, does not break anything within system)

Install rvm (as user in ~/.rvm)

$ \curl -L https://get.rvm.io | bash -s stable

Load rvm in a shell (you can add this line into .bashrc)

$ [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Install lastest ruby (takes a while…)

$ rvm install 1.9.3 && rvm use 1.9.3 && rvm --default use 1.9.3

Intall rails (takes a while...)

$ gem install rails

verify

$ rails new test.rails

$ cd test.rails

Uncomment this line # gem 'therubyracer', :platforms => :ruby in the Gemfile file.

$ bundle install

$ rails server

Nagivate in browser to: http://localhost:3000 and you should see welcome aboard page.

Installation

Steps

  1. clone to you computer
  • cd into folder
  • type rake db:create
  • type rake db:migrate
  • type $ rails server
  • verify at http://localhost:3000/items
  • profit!

Usage

GET /items.json

Array of items.

response:

[
	{
  		"id":1,
  		"created_at":"2012-10-24T14:03:27Z",
  		"title":"First Entry",
  		"subtitle":"\u2026totally awesome",
  		"price":"9.99",
  		"available":"2012-10-30"
	},
	{
  		"id":3,
  		"created_at":"2012-10-24T14:13:30Z",
  		"title":"yahooo",
  		"subtitle":"dobry den",
  		"price":"6.5",
  		"available":null
	}
]

GET /items/<id>.json

Detailed info of an item.

response:

{
   "available":"2012-10-30",
   "created_at":"2012-10-24T14:03:27Z",
   "description":"Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
   "id":1,
   "imageurl":"http://illy.kubbing.com/t-ar/1.gif",
   "price":"9.99",
   "subtitle":"\u2026totally awesome",
   "title":"First Entry",
   "updated_at":"2012-10-24T14:03:43Z"
}

POST /items.json

Creates new item at the server.

arguments:

{
   "item[available]":"2012-10-30",
   "item[description]":"Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
   "item[imageurl]":"http://illy.kubbing.com/t-ar/1.gif",
   "item[price]":"9.99",
   "item[subtitle]":"\u2026totally awesome",
   "item[title]":"First Entry",
}

response (not related to the request arguments above):

{
    available = "<null>";
    "created_at" = "2012-10-24T22:55:19Z";
    description = "<null>";
    id = 33;
    imageurl = "<null>";
    price = "3.1415";
    subtitle = "<null>";
    title = "2012-10-24 22:55:16 +0000";
    "updated_at" = "2012-10-24T22:55:19Z";
}

PUT /items/<id>.json

Updates an item at the server.

arguments:

{
   "item[available]":"2012-10-30",
   "item[description]":"Lorem Ipsum is simply dummy text of the printing and typesetting industry.",
   "item[imageurl]":"http://illy.kubbing.com/t-ar/1.gif",
   "item[price]":"9.99",
   "item[subtitle]":"\u2026totally awesome",
   "item[title]":"First Entry"
}

DELETE /items/<id>.json

Deletes an item at the server.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors