We believe that strong relationships are the foundation of a happy and fulfilling life. That's why we've created a tool that empowers you to build and maintain meaningful connections with the people you care about most. Try Love Fern today and see how it can transform your relationships!
π Fernando (Our Backend Service)
Love Fern is an application that allows the user to cultivate their relationships with others in their lives, by taking care of a fern. This is the backend service of the application.
This is a Ruby on Rails application which establishes API endpoints to be called in the love_fern_fe
repository. To run the application locally, both frontend and backend repositories will need to be cloned and set up fully with required gems and environment variables.
To install gems, run:
bundle install
Then to establish a database, run:
rails db:create
Because this is the back end repository, database migration is also necessary, run:
rails db:migrate
Inspect the /db/schema.rb
and compare to the 'Schema' section below to ensure this migration has been done successfully.
Once love_fern_be
is correctly installed, run tests locally to ensure the repository works as intended.
To test the entire spec suite, run:
bundle exec rspec spec/
All tests should be passing if installation is successful.
- APIs can be called locally using a program like Postman.
Note: Necessary parameters marked with {}
Note: pass name
, google_id
, & email
in request body
POST '/api/v1/users'
Response:
{
"data":
{
"id":"USER_ID",
"type":"user",
"attributes":
{
"name":"USER_NAME",
"email":"USER_EMAIL",
"google_id":"USER_GOOGLE_ID"
}
}
}
GET '/api/v1/users/{google_id}/ferns'
Response:
{
"data":
[{
"id":"FERN_ID",
"type":"fern",
"attributes":
{
"name":"FERN_NAME",
"health":FERN_HEALTH,
"preferred_contact_method":"FERN_CONTACT_METHOD"
},
"relationships":
{
"shelf":
{
"data":
{
"id":"SHELF_ID",
"type":"shelf"
}
},
"user":
{
"data":
{
"id":"USER_ID",
"type":"user"
}
},
"interactions":
{
"data":
[...]
}
}
},
...
]
}
Note: pass name
, shelf
, & preferred_contact_method
in request body
POST '/api/v1/users/{google_id}/ferns'
Response:
{
"data":
{
"id":"FERN_ID",
"type":"fern",
"attributes":
{
"name":"FERN_NAME",
"health":7, **DEFAULT IS 7**
"preferred_contact_method":"FERN_CONTACT_METHOD"
},
"relationships":
{
"shelf":
{
"data":
{
"id":"SHELF_ID",
"type":"shelf"
}
},
"user":
{
"data":
{
"id":"USER_ID",
"type":"user"
}
},
"interactions":{
"data":
[]
}
}
}
}
GET '/api/v1/users/{google_id}/ferns/{fern_id}'
Response:
{
"data":
{
"id":"9",
"type":"fern",
"attributes":
{
"name":"FERN_NAME",
"health":FERN_HEALTH,
"preferred_contact_method":"FERN_CONTACT_METHOD"
},
"relationships":
{
"shelf":
{
"data":
{
"id":"SHELF_ID",
"type":"shelf"
}
},
"user":
{
"data":
{
"id":"USER_ID",
"type":"user"
}
},
"interactions":
{
"data":
[{
"id":"INTERACTION_ID",
"type":"interaction"
}]
}
}
},
"included":
[{
"id":"INTERACTION_ID",
"type":"interaction",
"attributes":
{
"evaluation":"Positive",
"description":"message",
"created_at":"DATETIME"
},
"relationships":
{
"fern":
{
"data":
{
"id":"FERN_ID",
"type":"fern"
}
}
}
},
{
"id":"USER_ID",
"type":"user",
"attributes":
{
"name":"USER_NAME",
"email":"USER_EMAIL",
"google_id":"USER_GOOGLE_ID"
}
}]
}
Note: pass interaction
as the message to be analyzed in response body
PATCH '/api/v1/users/{google_id}/ferns/{fern_id}'
Response:
{
"data":
{
"id":"FERN_ID",
"type":"fern",
"attributes":
{
"name":"FERN_NAME",
"health":FERN_HEALTH,
"preferred_contact_method":"FERN_CONTACT_METHOD"
},
"relationships":
{
"shelf":
{
"data":
{
"id":"SHELF_ID",
"type":"shelf"
}
},
"user":
{
"data":
{
"id":"USER_ID",
"type":"user"
}
},
"interactions":
{
"data":
[{
"id":"INTERACTION_ID",
"type":"interaction"
},
...
]
}
}
}
}
Note: pass name
, shelf
, or preferred_contact_method
in request body
PATCH '/api/v1/users/{google_id}/ferns/{fern_id}'
DELETE '/api/v1/users/{google_id}/ferns/{fern_id}'
Response:
{
"data":
{
"id":"FERN_ID",
"type":"fern",
"attributes":
{
"name":"FERN_NAME",
"health":FERN_HEALTH,
"preferred_contact_method":"FERN_CONTACT_METHOD"
},
"relationships":
{
"shelf":
{
"data":
{
"id":"SHELF_ID",
"type":"shelf"
}
},
"user":
{
"data":
{
"id":"USER_ID",
"type":"user"
}
},
"interactions":
{
"data":[]
}
}
}
}
GET '/api/v1/users/{google_id}/shelves'
Response:
{
"data":
[{
"id":"SHELF_ID",
"type":"shelf",
"attributes":
{
"name":"SHELF_NAME"
},
"relationships":
{
"user":
{
"data":
{
"id":"USER_ID",
"type":"user"
}
},
"ferns":
{
"data":
[{
"id":"FERN_ID",
"type":"fern"
},
...
]}
}
},
...]
}
GET '/api/v1/activities'
Response:
{
"activity":"RANDOM_ACTIVITY"
}
Love Fern was germinated to satisfy the requirements (and beyond) for a Turing Backend Mod 3 group project, Consultancy. See official project requirements.
- Design easily consumable API end-points to create accessible, robust backend service.
- Implement a secure connection between front and backend services deployed to Heroku.
- Interact with two unique external APIs with efficient data processing and caching.
- Implement "Soil Moisture" which indicates how often a user wishes to interact with their fern before the soil is completely dry. Dry soil will reduce the plant health until it is watered again.
- Add the ability to search for a fern by name and order ferns by health.
- Suggest multiple activities and gestures corresponding to varying levels of care needed for the fern.
- Implement a homegrown sentiment analysis feature to pair with Google's services, eventually reducing dependence on external services.
- In current state, sentiment analysis has linear affect on fern status.
- No automated system for generating secret keys to authenticate new FE services.
π€ Samuel Cox
π€ Drew Layton
π€ Anthony Ongaro
π€ Brady Rohrig
π€ J Seymour
π€ Anthony Blackwell Tallent