Skip to content

This gem makes it easy to get a Rails 3.1 or Rails 4.0 app up and running with the VersaCommerce API.

License

Notifications You must be signed in to change notification settings

versacommerce/versacommerce_app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VersaCommerce App Generator

VersaCommerce application generator for Rails 5.1+

Description

This gem makes it easy to get a Rails 5.1+ app up and running with the VersaCommerce API.

The generator creates a basic SessionsController for authenticating with your shop and a HomeController which displays basic information about your products, orders and the shop itself.

Note: It's recommended to use this on a new Rails project, so that the generator won't overwrite/delete some of your files.

Register your app first

To use the VersaCommerce API you will need an application registration for your store.

  1. SignUp as a partner: https://app.versacommerce.de/partner/signup
  2. Login to your partner account: https://app.versacommerce.de/partner
  3. Register your app.

Installation

# Create a new rails app
$ rails new my_versacommerce_app
$ cd my_versacommerce_app

# Add the gem versacommerce_app to your Gemfile
$ gem 'versacommerce_app'
$ bundle install

Usage

$ rails generate versacommerce_app your_app_api_key your_app_secret

Example

$ rails generate versacommerce_app aabbcc1122334455667788 gghhhiijjkk998877665544

This will create a SessionsController and HomeController with their own views.

Configuring VersaCommerce App

It's possible to set your API key and secret key from different sources:

  • Configuration in a Rails <environment>.rb config file
config.versacommerce.api_key = 'your api key'
config.versacommerce.secret = 'your secret'
  • Configuration loaded from <environment> key in versacommerce_app.yml
development:
  api_key: your api key
  secret: your secret
  • Configuration loaded from .env file into ENV (additional gems like 'dotenv' might be needed)

Next...

Start your application:

$ rails server

Now visit http://localhost:3000 and register (install) your application with a VersaCommerce store. Even if Rails tells you to visit your app at http://0.0.0.0:3000, go to http://localhost:3000.

After your application has been given whatever API permissions, you're ready to start experimenting with the VersaCommerce API. Have Fun :)

About

This gem makes it easy to get a Rails 3.1 or Rails 4.0 app up and running with the VersaCommerce API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published