Skip to content

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.

Notifications You must be signed in to change notification settings

techmonad/campaign-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages