Giter VIP home page Giter VIP logo

events's Introduction


Events API App

Create a new Events API hosted project with a backend(Ruby on Rails) and database(Postgres)

ruby version rails version postgres version

⚡️ Events: Post Endpoint

Needed Url: https://eventsapp101.herokuapp.com/

⚡️ Must needs for a Post Request

name and event_type are the required key/value pairs

Event type should be one of the following:

[submit refer click read login logout share signup subcribe]

⚡️ Optional/addiotional params for a Post Request

One can include more key/value pairs and those will be considered "additional_data" and according to the requirments of this project, if no additional data exists, the object will be empty.

⚡️ Example Post Request with 'additional data'

{"event" : {"name" : "subscribe_button", "event_type" : "subscribe", "button_type" : "primary", "button_color" : "blue"  }

return a JSON Object that looks like this:

{
    "id": 1,
    "name": "subscribe_button",
    "event_type": "subscribe",
    "additional_data": {
        "button_type" : "primary",
        "button_color" : "blue"
    }
}

That's all you need to know to start! 🎉

Testing the Post Request

curl -X POST --header 'Content-Type: application/json' --data '{"event" : {"name" : "subscribe_button", "event_type" : "subscribe","button_color" : "blue" }}' 'https://eventsapp101.herokuapp.com/'

⚡️ Ive also included a few tests.

You can run this command:

rails test test/models/event_test.rb

Testing the Todays stats (extra credit)

This endpoint takes all the events received today, groups them by event_type and returns the count for each. The response are in JSON

for example

{"todays_stats" :
    [
        {"click" : 34},
        {"view": 54}
    ]
}

This can be accessed here https://eventsapp101.herokuapp.com/todaystats

events's People

Contributors

mustafamuse avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.