https://github.com/lindseyb/moon-api
RESTful API for the Moon
https://github.com/lindseyb/moon-api
api api-rest moon ruby sinatra
Last synced: 7 months ago
JSON representation
RESTful API for the Moon
- Host: GitHub
- URL: https://github.com/lindseyb/moon-api
- Owner: LindseyB
- License: mit
- Created: 2023-07-09T01:18:10.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-10T22:33:19.000Z (7 months ago)
- Last Synced: 2025-03-10T23:28:57.280Z (7 months ago)
- Topics: api, api-rest, moon, ruby, sinatra
- Language: Ruby
- Homepage: https://moon-api.co
- Size: 72.3 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Moon API
## Requests
`GET /` [[run]](https://moon-api.co)
Returns the current moonphase
`GET /phases/[phase]` [[run]](https://moon-api.co/phases/new)
Possible phases: `new`, `waxing_crescent`, `first_quarter`, `waxing_gibbous`, `full`, `waning_gibbous`, `last_quarter`, `waning_crescent`
Returns the information for the specified phase
`GET /date/[unix timestamp]` [[run]](https://moon-api.co/date/1689859150)
Returns the phase for the given date
## Phase data shape
| field | type | description |
|----------------------|------------------|---------------------------------------------------------------------------------------------|
| phase | string | one of `new`, `waxing_crescent`, `first_quarter`, `waxing_gibbous`, `full`, `waning_gibbous`, `last_quarter`, `waning_crescent` |
| days | integer | number of days in this moon phase - always 0 for date and phase endpoints |
| emoji | emoji | one of 🌑 🌒 🌓 🌔 🌕 🌖 🌗 🌘 |
| association | string | magical association for this phase |`GET /phases` [[run]](https://moon-api.co/phases)
Returns an array of all the possible phases of the moon and associated data.
### Example payload
```json
{
"phase": "waxing_crescent",
"days": 2,
"emoji": "🌒",
"association": "setting intentions"
}
```## Testing
```bash
bundle exec rake test
```## Getting Started
```bash
bundle install
bundle exec rackup
```## Deploying
```bash
gcloud config set project moon-api-392403 # set the correct project
gcloud app deploy # deploy the app
gcloud app logs tail -s default # tail the logs to make sure things are gucci
```