Giter Club home page Giter Club logo

yaas-java-sdk's Introduction

YaaS Java SDK Build Status

YaaS (Hybris as a Service) SDK for Java and JVM

This project is DEPRECATED. Original YaaS project is no longer maintained.

YaaS, SAP Hybris

Overview

This SDK allows to perform authorized requests to the microservices hidden behind YaaS proxy. Please note, this SDK is not an official SAP Hybris project and it does not cover all the features of YaaS. If you would like to learn more about YaaS, read an article on my blog about basic usage of YaaS as a proxy for the microservice. Moreover, you can read an article about Introducing YaaS Java SDK.

Tech stack of the SDK: Java 8, Gradle, OkHttp3, RxJava2 with Reactive Streams, Gson

Unit tests are written with: JUnit, Truth & Mockito

Contents

Quick start

Exemplary usage of this SDK is as follows:

YaaSProject project = new YaaSProject.Builder()
    .withClientId("YOUR_CLIENT_ID")
    .withClientSecret("YOUR_CLIENT_SECRET")
    .withOrganization("YOUR_ORGANIZATION")
    .withService("YOUR_SERVICE")
    .withVersion("v1")
    .withZone(Zone.EU)
    .build();

Client client = new YaaS(project);

client.get("path/to/your/endpoint")
    .subscribe(response -> System.out.println(response.body().string()));

Client API

Client interface supports basic HTTP methods like: GET, POST, PUT & DELETE.

Single<Response> get(final String path);
Single<Response> post(final String path, final RequestBody body);
Single<Response> put(final String path, final RequestBody body);
Single<Response> delete(final String path, final RequestBody body);
Single<Response> delete(final String path);

Authorization procedure in YaaS

Authorization procedure of the microservice endpoint is presented in the scheme below.

SDK follows this procedure in each call to the endpoint of the microservice.

calling YaaS microservice

Building the SDK

In order to build *.jar file with SDK, call the following command:

./gradlew jar

SDK compiled into *.jar file will be available in sdk/build/libs/ directory.

Building and running example

In order to build and run sample app located in the example directory, call the following command:

./gradlew clean build run 

Tests

To run tests, call the following command:

./gradlew test

Static Code Analysis

To run Static Code Analysis with CheckStyle, PMD and FindBugs, call the following command:

./gradlew check

Code style

Code style used in the project is called Square from Java Code Styles repository by Square available at: https://github.com/square/java-code-styles.

References

License

Copyright 2017 Piotr Wittchen

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

yaas-java-sdk's People

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

yaas-java-sdk's Issues

Update Zone enum

Zone enum API may look misleading for external components. Add getUrl() method and update toString() method.

Save bearer/access token for the future requests

Save bearer/access token for the future requests to avoid getting it in every request. Provide an interface for that to allow to save it wherever the user wants (memory/file/cache system/database/etc.). Consider invalidation of the bearer/access token.

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.