Giter VIP home page Giter VIP logo

omega_pricing's Introduction

PriceTracker

code for price tracking based on api

Api

There are two main parts to the system

  1. Transactor stores and logs the transformations to the database
  2. Strategy, wraps your custom modules to interact with the transactor

lib/strategies/omega_pricing.ex impliments the contract of strategy for the omega api. You could extend your own by writing your own modueles and using Strategy

Strategies expose a make_request() function that will call the api and merge the changes into the database. By deriving from Strategy, The Transactor code can be resued verbatim.

You can call make_request at periodic intervals to gather data for the database. a library such as quantum-elixir would be perfect for this and could be mounted in a supervision tree.

I did make a few assumptions

  1. http with get responses. I did add a case statement where a post handler could be added
  2. The exposed method takes no option. This is to make it easier to mount it in a cron function.
  3. we want to support multiple companies so I added a company code to the product model
Libraries used

I wasn't sure if phoenix was allowed so I built the test harness with support for ecto and mocking http requests for httpoison myself.

  • ecto
  • exvcr to mock http requests for testing
  • timex for time handling

Running tests

to run the tests, simply run

mix deps.get
mix test

omega_pricing's People

Contributors

cultofmetatron avatar

Watchers

 avatar James Cloos 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.