Skip to content
This repository has been archived by the owner on Dec 18, 2018. It is now read-only.

decorators-squad/versioneye-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

versioneye-api

Build Status Coverage Status PDD status

DevOps By Rultor.com We recommend IntelliJ IDEA

Elegant OOP wrapper over the VersionEye API

RIP VersionEye:

Apparently VersionEye will shut down by the end of 2017: https://blog.versioneye.com/2017/10/19/versioneye-sunset-process/ There is no point in continuing development here. This repository remains, however, as guidance/documentation for future Java REST clients.

Design

This library is 100% object oriented, based on interfaces and final classes. It has one single entry point, RtVersionEye, which is the only public class. Everything is encapsulated, wrapped in intuitive interfaces. The main goal is to offer a well organized, user-friendly library that's easy to use.

Behind the scenes the jcabi-http client is used, mainly for the convenient and fluent API that it offers. Json is manipulated using javax.json API with the Glassfish implementation.

For unit-testing, a mock version is offered, which holds a JsonBuilder behind, instead of making real HTTP requests.

Usage

There is one single entry point and the usage is fluent. Everyone should be able to start using this library in a matter of minutes:

  1. Pinging:
    VersionEye api = new RtVersionEye();
    JsonObject json = api.services().ping();
    MatcherAssert.assertThat(
        json.getBoolean("success"), Matchers.is(true)
    );
    MatcherAssert.assertThat(
        json.getString("message"), Matchers.is("pong")
    );
  1. Getting information about me (the authenticated used):
    Authenticated user = new RtVersionEye("...token...").me().about();
    MatcherAssert.assertThat(
        user.fullName(), Matchers.is("Mihai Emil Andronache")
    );
    MatcherAssert.assertThat(
        user.username(), Matchers.is("amihaiemil")
    );
  1. Getting a user's comments (same for Favorites):
    VersionEye versionEye = new RtVersionEye("...token...");
    Comments comments = versionEye.users().user("amihaiemil").comments();
    List<Comment> firstPage = comments.fetch(1);//first page of comments
    for(Page<Comment> page : comments.paginated()) {
        //iterate over all the comments pages (including the first one)
        List<Comment> onPage = page.fetch();
    }

@todo #9:15min/DEV Add more examples of usage here

Contribute

Contributors are welcome

  1. Open an issue regarding an improvement you thought of, or a bug you noticed, or ask to be assigned to an existing one.
  2. If the issue is confirmed, fork the repository, do the changes on a separate branch and make a Pull Request.
  3. After review and acceptance, the PR is merged and closed.
  4. You are automatically listed as a contributor on the repo and the project's site (to follow)

Make sure the maven build

$ mvn clean install -Pcheckstyle

passes before making a PR.

Releases

No releases published

Packages

No packages published

Languages