Code Monkey home page Code Monkey logo

campaign-api's Introduction

campaign-api Scala CI

It is sbt sample project for building restful marketing campaigns(specially for Online Travel Agency) with maintaining code quality and writing unit + integration test. It is build top of Akka HTTP.

Run unit test:

$ sbt test

Run integration test:

   $sbt it:test

Run the app:

   $ sbt run

##Endpoint details:

  1. Get welcome message
   $ curl localhost:9000
   response => Welcome to Campaign api!!
  1. Disable a campaign(here campaign is HotelDealCampaign)
   $ curl localhost:9000/v1/HotelDealCampaign/flip?enabled=false
   response => HotelDealCampaign has been disabled successfully!
  1. Enable a campaign(here campaign is HotelDealCampaign)
   $ curl localhost:9000/v1/HotelDealCampaign/flip?enabled=true
   response => HotelDealCampaign has been enabled successfully!
  1. Refresh campaign detail(this will read all hotel & country list from a given file)
   $ curl localhost:9000/v1/HotelDealCampaign/refresh
   response => Campaign detail has been updated successfully
  1. Get score when countryId exists in list
   curl -XPOST localhost:9000/v1/HotelDealCampaign/score -d '[{"hotelId":1232 ,"countryId":10}]'
   response => [{"countryId":10,"score":3}]
  1. Get score when hotelId exists in list
   curl -XPOST localhost:9000/v1/HotelDealCampaign/score -d '[{"hotelId":12 ,"countryId":101010}]'
   response => [{"hotelId":12,"score":5}]
  1. Get score when both exists in list
   curl -XPOST localhost:9000/v1/HotelDealCampaign/score -d '[{"hotelId":12 ,"countryId":10}]'
   response => [{"hotelId":12,"score":5}]
  1. Get Scores of list
   curl -XPOST localhost:9000/v1/HotelDealCampaign/score -d '[{"hotelId":1232 ,"countryId":10},{"hotelId":12 ,"countryId":101010}, {"hotelId":12 ,"countryId":10},{"hotelId":12211 ,"countryId":101010}]'
   response => [{"countryId":10,"score":3},{"hotelId":12,"score":5},{"hotelId":12,"score":5}]

campaign-api's People

Contributors

anand-singh avatar renovate-bot avatar satendrakumar avatar scala-steward avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

scala-steward

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.