This project is the Back-end and should be work together with sample_tracking.
Is a Rails application to management Contacts and Data Tracking captured from another app (sample_tracking).
It should list all created Contacts and Data Tracking received by REST API. This API allows receiving, via POST, both the Contacts and Data Tracking from other sites that using the libTracking.js.
- The Ruby language - version 2.7.0
- The Rails gem - version 6.0
- RSpec - version 4.0.0.beta4
- Capybara - version 3.30.0
- Rubocop - version 0.79.0
- PostgreSQL - version 10
- Docker - version 19.03.5-ce
- Docker Compose - version 1.25.1
Clone the project:
git clone [email protected]:marcelotoledo5000/ContactList.git
cd ContactList
script/setup # => development bootstrap, preparing containers
script/server # => starts server
script/console # => starts console
script/test # => running tests
If you prefer, you'll need to update config/database.yml
:
# host: db # when using docker
host: localhost # when using localhost
System dependencies:
- Install and configure the database: Postgresql-10
And then:
gem install bundler # => install the last Bundler version
bundle install # => install the project's gems
rails db:setup db:migrate # => prepare the database
rails s # => starts server
rails c # => starts console
bundle exec rspec # => to running tests
To see the application in action, starts the rails server to able http://localhost:3000/
- Do not need to use authentication yet.
INDEX
GET: http://DOMAIN/contacts
"http://localhost:3000/contacts"
Response:
200 Ok
SHOW
GET: http://DOMAIN/contacts/:id
"http://localhost:3000/contacts/1"
Response:
200 Ok
CREATE
POST: http://DOMAIN/contacts
"http://localhost:3000/contacts"
Param: Body, JSON(application/json)
{
"email": "[email protected]",
"name": "Vladimir Harkonnen",
"guid": "5834417a-e646-49b8-b1d6-92d8812291c9"
}
Response:
201 Created
UPDATE
PUT: http://DOMAIN/contacts
"http://localhost:3000/contacts"
Param: Body, JSON(application/json)
{
"email": "[email protected]",
"name": "Vladimir Harkonnen",
"guid": "5834417a-e646-49b8-b1d6-92d8812291c9"
}
Response:
204 No Content
INDEX
GET: http://DOMAIN/tracks
"http://localhost:3000/tracks"
Response:
200 Ok
SHOW
GET: http://DOMAIN/tracks/:id
"http://localhost:3000/tracks/1"
Response:
200 Ok
CREATE
POST: http://DOMAIN/tracks
"http://localhost:3000/tracks"
Param: Body, JSON(application/json)
{
"guid": "5834417a-e646-49b8-b1d6-92d8812291c9",
"visited_page": "http://localhost:4567/home",
"visited_datetime": "2019-05-14 04:22:10 UTC",
}
Response:
201 Created