YaaS (Hybris as a Service) SDK for Java and JVM
This project is DEPRECATED. Original YaaS project is no longer maintained.
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
- Quick start
- Client API
- Authorization procedure in YaaS
- Building the SDK
- Building and running example
- Tests
- Static Code Analysis
- Code style
- References
- License
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
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 of the microservice endpoint is presented in the scheme below.
SDK follows this procedure in each call to the endpoint of the microservice.
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.
In order to build and run sample app located in the example
directory, call the following command:
./gradlew clean build run
To run tests, call the following command:
./gradlew test
To run Static Code Analysis with CheckStyle, PMD and FindBugs, call the following command:
./gradlew check
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.
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.