Skip to content

joshuatobin/lovemachine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lovemachine

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.

Deploy

$ 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

TODO:

  • Force SSL
  • Migrate app to use Pliny
  • Update app to use JSON schema
  • Add delete methods

User

A user object contains a users name, email address.

Atributes

Name Type Description Example
email string Email address [email protected]

User Create

Create a new user

POST /user

Required Parameters

Name Type Description Example
email string Email address [email protected]

Curl Example

$ curl -n -X POST https://lovemachine-api.domain.com/user \
-H "Content-Type: application/json" \
-d '{"email": "[email protected]"}'

Response Example

HTTP/1.1 201 Created
{
  "username": "jdoe",
  "email": "[email protected]"
}

User Info

Get info for existing user.

GET /user/{username}

Curl Example

curl -n -X GET https://lovemachine-api.domain.com/user/$username

Response Example

HTTP/1.1 200 OK
{
  "username": "jdoe",
  "email": "[email protected]"
}

Users List

List all users info

GET /users

Curl Example

curl -n -X GET https://lovemachine-api.domain.com/users

Response Example

HTTP/1.1 200 OK
{
  "username": "jdoe",
  "email": "[email protected]"
},
{
  "username": "james",
  "email": "[email protected]"
}

User Delete

Delete and existing user

DELETE /user/{username}

Curl Example

curl -n -X DELETE https://lovemachine-api.domain.com/user/$username

Response Example

HTTP/1.1 200 OK
{
  "username": "jdoe",
  "email": "[email protected]"
}

Love

Send a recognition message to a user.

Attributes

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"

Love Create

Create a new love message

POST /love

Required Parameters

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 Example

$ 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"}'

Response Example

HTTP/1.1 201 Created
{
  "to": "[email protected]",
  "message": "Thanks for shipping the new API",
  "created_at": "2012-01-01T12:00:00Z"
}

Love List

List all the love sent

GET /love

Curl Example

curl -n -X GET https://lovemachine-api.domain.com/love

Response Example

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"
}

Dev setup

dropdb lovemachine
rake create_db
rake test all

bundle exec bin/console
irb(main):001:0> APIKey.create()

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages