ruby 2.7
postgresql
git clone https://github.com/b0nn1e/gg_test.git
cd gg_test
bundle install
cp config/database.example.yml config/database.yml
cp config/master.key.development config/master.key
bundle exec rake db:create
bundle exec rake db:migrate
Edit credentials for MailGun and SendGrid services using command EDITOR="nano" rails credentials:edit
rails s
bundle exec rspec
POST /api/campaigns
Authorization: "Bearer 8d4aa039dde3f9cf90dc68e0d32b6f90"
Content-Type: "application/json"
{
"campaign": {
"subject": "Subject",
"message": "Message",
"emails": [
"[email protected]",
"[email protected]"
]
}
}
Status: 201 Created
""
Status: 422 unprocessable_entity
{"errors":{"subject":["can't be blank"]}}
See more details spec/requests/api/create_campaings_spec.rb
GET /api/customers
Authorization: "Bearer 8d4aa039dde3f9cf90dc68e0d32b6f90"
Content-Type: "application/json"
Status: 200
[
{
"id": 3262,
"email": "[email protected]",
"campaigns_count": 2
},
{
"id": 3263,
"email": "[email protected]",
"campaigns_count": 1
},
{
"id": 3264,
"email": "[email protected]",
"campaigns_count": 1
}
]
See more details spec/requests/api/show_customers_list_spec.rb
GET /api/customers/:id
Authorization: "Bearer 8d4aa039dde3f9cf90dc68e0d32b6f90"
Content-Type: "application/json"
Status: 200
{
"id": 123,
"email": "[email protected]",
"campaigns": [
{
"id": 1225,
"subject": "subject 1",
"created_at": "2020-11-23 10:23:12 UTC"
},
{
"id": 1226,
"subject": "subject 2",
"created_at": "2020-11-24 11:55:17 UTC"
},
{
"id": 1227,
"subject": "subject 3",
"created_at": "2020-11-24 15:23:46 UTC"
}
]
}
See more details spec/requests/api/show_customer_item_spec.rb