Skip to content

Marketing Opt-Ins - simple REST API using Grape and ActiveRecord.

Notifications You must be signed in to change notification settings

shhavel/promo_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

.PROMO Inc. Marketing Opt-Ins API

Marketing Opt-Ins - simple REST API using Grape and ActiveRecord.

Create database

Database configuration in config/dtabase.yml Create database using rake

$ rake db:creata
$ rake db:migrate

Create test database

$ DATABASE_ENV=test rake db:creata
$ DATABASE_ENV=test rake db:migrate

Run app

rackup

Create an opt-in

$ curl -X POST -H "Content-Type: application/json" -d '{"email":"[email protected]","permission_type":"permanent","channel":"email","company_name":"xyz"}' https://localhost:9292/opt_ins

{"opt_in":{"channel":"email","company_name":"xyz","email":"[email protected]","first_name":null,"id":1,"last_name":null,"mobile":null,"permission_type":"permanent"}}

List opt-ins

$ curl https://localhost:9292/opt_ins

[{"email":"[email protected]","mobile":null,"first_name":null,"last_name":null,"permission_type":"permanent","channel":"email","company_name":"xyz","links":[{"rel":"self","href":"/optins/1"}]}]

Update an opt-in

$ curl -X PUT -H "Content-Type: application/json" -d '{"permission_type":"one-time"}' https://localhost:9292/opt_ins/1

true

Delete an opt-in

$ curl -X DELETE -H "Content-Type: application/json" https://localhost:9292/opt_ins/1

{"opt_in":{"channel":"email","company_name":"xyz","email":"[email protected]","first_name":null,"id":1,"last_name":null,"mobile":null,"permission_type":"one-time"}}

About

Marketing Opt-Ins - simple REST API using Grape and ActiveRecord.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages