Skip to content
Scala OpenRTB tools used at @Powerspace
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
akka-http-marshallers - Merge example modules Mar 14, 2019
bidswitch-json/src Add scala fmt Mar 14, 2019
bidswitch-model Add scala fmt Mar 14, 2019
examples Merge branch 'feat-example-module' into develop Mar 14, 2019
openrtb-json Add scala fmt Mar 14, 2019
openrtb-model Remove monix dependency Mar 14, 2019
project
.gitignore Added Powerspace DSP functionalities and models Jul 11, 2018
.scalafmt.conf Add scala fmt Mar 14, 2019
.travis.yml added a basic .travis.yml file Jun 20, 2018
README.md Add medium publication to readme Mar 16, 2019
build.sbt v1.2.0 Mar 14, 2019
publish.sbt Add scala fmt Mar 14, 2019

README.md

Scala OpenRTB is a full Scala library that provides protobuf bindings as well as JSON serialization for OpenRTB-based entities in a functional fashion. This library also provides SerDes for Powerspace and BidSwitch bidding models, and aims to support other DSPs in the near future.

Artifacts

Scala openrtb artifacts are available on Sonatype.

Building

Build it like any other SBT project. Go to the root folder and run:

sbt compile

Usage

If you want to use the core of ScalaOpenRTB, you only need to add libraryDependencies += "com.powerspace.openrtb" % "openrtb-model_2.12" % "version" to your build.sbt

We also provide json encoders through libraryDependencies += "com.powerspace.openrtb" % "openrtb-json_2.12" % "version"

To leverage ScalaOpenRTB we have to define our bid request/response extensions and their decoders:

object CustomSerdeModule extends SerdeModule {

  // Define encoder for custom extension
  implicit val directEncoder: Encoder[CustomExtension] = openRtbEncoder[CustomExtension]
 
  // Register extension for specific proto-kind object
  override def extensionRegistry: ExtensionRegistry = ExtensionRegistry()
    .registerExtension(CustomProto.bidRequest)
  
  override def nativeRegistry: ExtensionRegistry = ExtensionRegistry()

Then in the bidder client we import defined module and use it for bid requests/response encoding/decoding:

import CustomSerdeModule._
import io.circe.syntax._
import io.circe.parser.decode

implicit val bidRequestEncoder: Encoder[BidRequest] = PowerspaceSerdeModule.bidRequestEncoder
implicit val bidResponseDecoder: Decoder[BidRequest] = PowerspaceSerdeModule.bidResponseDecoder

val bidRequest = BidRequest(...).asJson
val bidRequest = decode[BidResponse](bidRequest)

Work in Progress

  • Macro replacement will be included into ScalaOpenRTB

Links

  • OpenRTB specifications:

  • Powerspace: Powerspace is the 1st native advertising platform for e-mail. Powerspace allows brands to broadcast their content at scale across hundreds of media newsletters leveraging cutting-edge technology solutions.

  • BidSwitch: BidSwitch provides immediate and seamless real-time access for Supply and Demand Partners across all media types (display, mobile, video, native, TV, DOOH, VR, etc.).

  • Medium: Open-sourcing the first OpenRTB Scala framework

Contributions

Feel free to:

  • add support for other DSPs
  • raise an issue
  • submit your pull request
You can’t perform that action at this time.