Download and install the ruby SDK and intro to its structure.
Live demo
Here you can find live demo of the Camera store sample application. This is the application we are going to build here.
Prerequisites
To follow along with this tutorial, you have to have:
- Active account in Tradenity
- Create the sample “Camera store”, and load the sample data (This option is available on the create store page).
- Have a working ruby development environment (Ruby > 1.9.3, 2.2.x installation, your IDE of choice)
- Basic familiarity with the Rails framework.
Setup your credentials
First of all, you have to get API keys for your store, you can find it in your store Edit
page.
To get there navigate to the stores list page, click on the Edit
button next to your store name, scroll down till you find the API Keys
section.
Initialize the library
With the API key in hand, you can initialize the Tradenity client.
Make sure to replace the api keys with the ones for your store, otherwise you will get authentication error
Introducing CameraStore sample application
CameraStore application is a typical e-store web application, a web store for a camera shop.
The application code is divided into these Controllers:
ShopController
: navigating the and browsing the store, the corresponding templates are in thecamerastore/views/shop
directory.CartController
: Shopping cart manipulation code. the corresponding templatecamerastore/views/shop/cart.erb
.AccountController
: login management and registering new customers. the corresponding templates are in thecamerastore/views/account
directory.OrdersController
: placing new order, viewing list and details of customer’s past orders. the corresponding templates are in thecamerastore/views/orders
directory.