#Fyber Offers API Web Client
Simple web client to consume Fyber API and render result offers in a HTML page.
Based on Sinatra, uses HTTParty as HTTP client.
###Story
Following the commit history, you can see this app was developed in a test-drived way, "outside-in" approach.
FyberClient
is the "low-level" implementation of the Fyber API HTTP client with only one public method #call
, returning a raw response.
It is a default client in the OffersRepository
which takes care of validating the response and extracting offers from it into an array of offer objects (OpenStruct
is used for simplicity) which are then rendered into HTML.
Current version tries to keep balance between compactness and amount of abstractions.
If the app would be to develop further, it would make sense to extract such responsibilities as raw response validation and offers extraction from OffersRepository
and into specific classes which would be composed in OffersRepository
leaving it only to communicate with injected clients and return offers objects for HTML render.
##Online Demo Demo app is running on Heroku at https://floating-dawn-15079.herokuapp.com/
##Local demo
- Clone this repo
cd
to the app folder- make sure you have ruby 2.2.4 along with
bundler
gem installed on your system - run
bundle install
to install required gems - after gems are installed, run
FYBER_API_KEY=xxxxx bundle exec rackup config.ru
whereFYBER_API_KEY
is an api key received from Fyber
##Specs
To run specs, simply execute rake
command.