Giter Site home page Giter Site logo

tech-test's Introduction

Tebex Tech Test

Submission

Please download/clone this repository and submit your final code by emailing a .zip or by sharing a link to your own repository on GitHub/GitLab. Please avoid forking this repository through GitHub.

Task

Part 1

Refactor the LookupController in this codebase. In particular, consider how Composition, Inheritance and Contracts can refactor this code in a clean, maintainable way. Ensure that the final code follows PSR-12 standards (hint, some of it currently doesn't), and structure the code in a way that shows your knowledge of:

  • SOLID principles
  • OOP
  • Contracts (Interfaces)
  • Dependency Injection (In Laravel this also includes use of the Service Container)

Part 2

Write some unit or feature tests for the code you've written. You do not need to have complete test coverage we just want to see that you have some experience in writing automated tests!

Bonus Points

  • Due to rate limits enforced by the underlying services, consider how data can be cached or persisted so that we're not having to call the underlying service every time
  • Implement some 'defensive programming' (consider how and why the application might fail and implement appropriate precautions)
  • Consider how error/fail states should be communicated back to the user

Example Requests and expected Results:

(Note: This assumes the code is running on http://localhost:8000) - e.g. having been started using the built-in php server:

php -S localhost:8000 -t public

http://localhost:8000/lookup?type=xbl&username=tebex

{"username":"Tebex","id":"2533274844413377","avatar":"https:\/\/avatar-ssl.xboxlive.com\/avatar\/2533274844413377\/avatarpic-l.png"}

http://localhost:8000/lookup?type=xbl&id=2533274884045330

{"username":"d34dmanwalkin","id":"2533274884045330","avatar":"https:\/\/avatar-ssl.xboxlive.com\/avatar\/2533274884045330\/avatarpic-l.png"}

http://localhost:8000/lookup?type=steam&username=test Should return an error "Steam only supports IDs"

http://localhost:8000/lookup?type=steam&id=76561198806141009

{"username":"Tebex","id":"76561198806141009","avatar":"https:\/\/steamcdn-a.akamaihd.net\/steamcommunity\/public\/images\/avatars\/c8\/c86f94b0515600e8f6ff869d13394e05cfa0cd6a.jpg"}

http://localhost:8000/lookup?type=minecraft&id=d8d5a9237b2043d8883b1150148d6955

{"username":"Test","id":"d8d5a9237b2043d8883b1150148d6955","avatar":"https:\/\/crafatar.com\/avatarsd8d5a9237b2043d8883b1150148d6955"}

http://localhost:8000/lookup?type=minecraft&username=Notch

{"username":"Notch","id":"069a79f444e94726a5befca90e38aaf5","avatar":"https:\/\/crafatar.com\/avatars069a79f444e94726a5befca90e38aaf5"}

tech-test's People

Contributors

byteplus avatar

Watchers

 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.