Skip to content

yogonza524/kim

Repository files navigation

Maven Artifact Test all Test all Coverage Code size

Kim

Finder of next bus arrivals for Argentine citizens

Add to your project

To add as dependency using Maven, you should have at pom.xml:

<dependency>
  <groupId>io.github.yogonza524</groupId>
  <artifactId>kim</artifactId>
  <version>0.0.4</version>
</dependency>

To add as dependency using Gradle, you should have at build.gradle:

repositories {
    mavenCentral()
    maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}

dependencies {
    implementation "io.github.yogonza524:kim:0.0.4"
}

Pre requirements

  • Valid credentials

Requirements

  • Java 11+
  • Gradle 6+

Do it yourself

  • Instance the service first
Kim kim = new Kim(Credentials.builder()
        .username(System.getenv("KIM_USERNAME"))
        .password(System.getenv("KIM_PASSWORD"))
    .build());
  • List all places
Place
    .all()
    .forEach(System.out::println);
  • Get a valid place
Place.P_CABA_BUENOS_AIRES()
  • Instance a custom place
Place.builder()
        .country("COUNTRY")
        .province("PROVINCE")
        .state("STATE")
    .build();
  • List all bus lines for a given place
kim.linesBy(Place.P_CABA_BUENOS_AIRES())
    .getLines()
    .forEach(System.out::println);
  • List a route (list of GPS points) for a given line
kim.routes(line)
    .getPoints()
    .stream()
    .forEach(System.out::println);
  • List streets for a given line
kim.streetsByLine(line)
    .getStreets()
    .forEach(System.out::println);
  • List streets intersection for a given line and street
kim.intersectionPerLineAndStreet(line, street)
    .getStreets()
    .forEach(System.out::println);
  • List stop bus for a given line and streets intersections
kim.stopByLineAndStreetAndIntersection(line, street, intersection)
    .getStopList()
    .forEach(System.out::println);
  • List next arrivals for a given stop, line and place
ArrivalResponse nextArrivals = kim
    .nextArrivals(stop, line, Place.P_CABA_BUENOS_AIRES());
    
    if (nextArrivals.getCode() == 0) {
      nextArrivals
          .getArrivals()
          .forEach(System.out::println); 
    }

Sube (Recharge point)

SUBE System

  • List all recharge points in Argentina
new SubeService()
    .list()
    .getFeatures()
    .forEach(System.out::println);
  • List the 10 charging points closest to a geographical position
new SubeService()
    .nearbyPoint(
        GPS.builder()
            .latitude("-27.5456")
            .longitude("-56.54654")
        .build())
    .stream()
    .limit(10)
    .forEach(System.out::println);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages