The love machine is a heroku app for companies to help employees send peer to peer recognition. The love machine will be backed by a heroku postgresql database keeping mappings of username, email and recognition messages between users.
The love machine is a concept originally created by Phillip Rosedale during the early days of Linden Lab.
$ git push heroku master
$ heroku config:set LOVEMACHINE_EMAIL_PASSWORD=<PASSWORD>
$ heroku config:set LOVEMACHINE_EMAIL_USERNAME=<USERNAME>
$ heroku run bundle exec rake db:migrate
$ heroku run bin/console
k = APIkey.create()
k.key
$ heroku restart # Restart the dyno to pick up the model changes
If using gmail for SMTP you'll need to unlock the account for clients connecting from EC2
- Force SSL
- Migrate app to use Pliny
- Update app to use JSON schema
- Add delete methods
A user object contains a users name, email address.
Name | Type | Description | Example |
---|---|---|---|
string | Email address | [email protected] |
Create a new user
POST /user
Name | Type | Description | Example |
---|---|---|---|
string | Email address | [email protected] |
$ curl -n -X POST https://lovemachine-api.domain.com/user \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]"}'
HTTP/1.1 201 Created
{
"username": "jdoe",
"email": "[email protected]"
}
Get info for existing user.
GET /user/{username}
curl -n -X GET https://lovemachine-api.domain.com/user/$username
HTTP/1.1 200 OK
{
"username": "jdoe",
"email": "[email protected]"
}
List all users info
GET /users
curl -n -X GET https://lovemachine-api.domain.com/users
HTTP/1.1 200 OK
{
"username": "jdoe",
"email": "[email protected]"
},
{
"username": "james",
"email": "[email protected]"
}
Delete and existing user
DELETE /user/{username}
curl -n -X DELETE https://lovemachine-api.domain.com/user/$username
HTTP/1.1 200 OK
{
"username": "jdoe",
"email": "[email protected]"
}
Send a recognition message to a user.
Name | Type | Description | Example |
---|---|---|---|
to | string | Email address | [email protected] |
message | string | A recognition message from one person to another | Thanks for shipping the new API |
created_at | date-time | When the message was sent | "2012-01-01T12:00:00Z" |
Create a new love message
POST /love
Name | Type | Description | Example |
---|---|---|---|
to | string | Email address | [email protected] |
message | string | recognition message from one person to another | Thanks for shipping the new API |
created_at | date-time | When the message was sent | "2012-01-01T12:00:00Z" |
$ curl -n -X POST https://lovemachine-api.domain.com/love \
-H "Content-Type: application/json" \
-d '{"to": "[email protected]", "message": "Thanks for shipping the new API", "created_at": "2012-01-01T12:00:00Z"}'
HTTP/1.1 201 Created
{
"to": "[email protected]",
"message": "Thanks for shipping the new API",
"created_at": "2012-01-01T12:00:00Z"
}
List all the love sent
GET /love
curl -n -X GET https://lovemachine-api.domain.com/love
HTTP/1.1 200 OK
{
"to": "[email protected]",
"from": "[email protected]",
"created_at": "2012-01-01T12:00:00Z",
"message": "Thanks for shipping the new API"
}
dropdb lovemachine
rake create_db
rake test all
bundle exec bin/console
irb(main):001:0> APIKey.create()