voto-sdk-rxjava

Uses RxJava for accessing the VOTO API

Лицензия

Лицензия

Категории

Категории

RxJava Контейнер Микросервисы Reactive libraries
Группа

Группа

com.addhen
Идентификатор

Идентификатор

voto-rxjava
Последняя версия

Последняя версия

0.3.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

voto-sdk-rxjava
Uses RxJava for accessing the VOTO API
Ссылка на сайт

Ссылка на сайт

https://github.com/eyedol/voto-java-sdk
Система контроля версий

Система контроля версий

https://github.com/eyedol/voto-java-sdk

Скачать voto-rxjava

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.addhen/voto-rxjava/ -->
<dependency>
    <groupId>com.addhen</groupId>
    <artifactId>voto-rxjava</artifactId>
    <version>0.3.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.addhen/voto-rxjava/
implementation 'com.addhen:voto-rxjava:0.3.0'
// https://jarcasting.com/artifacts/com.addhen/voto-rxjava/
implementation ("com.addhen:voto-rxjava:0.3.0")
'com.addhen:voto-rxjava:jar:0.3.0'
<dependency org="com.addhen" name="voto-rxjava" rev="0.3.0">
  <artifact name="voto-rxjava" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.addhen', module='voto-rxjava', version='0.3.0')
)
libraryDependencies += "com.addhen" % "voto-rxjava" % "0.3.0"
[com.addhen/voto-rxjava "0.3.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
voto-java-sdk » voto jar 0.3.0
com.squareup.retrofit2 : adapter-rxjava jar 2.0.0

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Build Status Stories in Ready codecov.io Android Arsenal

VOTO JAVA SDK

VOTO Java SDK is a wrapper around the VOTO API to make it very easy to use. The goal of this SDK is to ease VOTO API integration into both Android and Java applications.

It comes with three independent modules:

  • Synchronous module; Access the API synchronously
  • Asynchronous module; Access the API asynchronously
  • RxJava module; Access the API using RxJava

Note: These are not official libraries from the VOTO team.

###Setup Add gradle dependency:

Add jcenter repostory:

repositories {
    jcenter()
}

Synchronous module:

dependencies {
    compile 'com.addhen:voto-sdk-sync:0.3.0'
}

Asynchronous module:

dependencies {
    compile 'com.addhen:voto-sdk-async:0.3.0'
}

RxJava module:

dependencies {
    compile 'com.addhen:voto-sdk-rxjava:0.3.0'
}

Usage

GET Data From VOTO API

Build API Client
  • Synchronous:
SyncVotoApiClient syncVotoApilient = new SyncVotoApiClient.Builder(<api_key>)
	.withLogLevel(HttpLoggingInterceptor.Level.BODY)
	.build();
  • Asynchronous:
AsyncVotoApiClient asyncVotoClient = new AsyncVotoApiClient.Builder(<api_key>)
	.withLogLevel(HttpLoggingInterceptor.Level.BODY)
	.build();
  • RxJava:
RxJavaVotoApiClient rxVotoClient = new RxJavaVotoApiClient.Builder(<api_key>)
	.withLogLevel(HttpLoggingInterceptor.Level.BODY)
	.build();
Execute API Request
  • Synchronous:
SyncVotoApiClient syncVotoApiClient = new SyncVotoApiClient.Builder("api_key")
	.withLogLevel(HttpLoggingInterceptor.Level.BODY)
	.build();
	
ListSubscribersResponse listSubscribersResponse = null;
try {
    listSubscribersResponse = syncVotoApiClient.listSubscribers(10);
} catch (IOException e) {
    e.printStackTrace();
}

System.out.println(listSubscribersResponse);
  • Asynchronous:
AsyncVotoApiClient asyncVotoApiClient = new AsyncVotoApiClient.Builder("api_key")
	.withLogLevel(HttpLoggingInterceptor.Level.BODY)
	.build();
	
asyncVotoApiClient.listSubscribers(10, new Callback<ListSubscribersResponse>() {
	@Override
    public void onResponse(Call<ListSubscribersResponse> call, Response<ListSubscribersResponse> response) {
    ListSubscribersResponse listSubscribersResponse = response.body();
    	System.out.println(listSubscribersResponse);
    }

    @Override
    public void onFailure(Call<ListSubscribersResponse> call, Throwable t) {
    	t.printStackTrace();
    }
});
  • RxJava:
RxJavaVotoApiClient rxJavaVotoApiClient = new RxJavaVotoApiClient.Builder("api_key")
	.withLogLevel(HttpLoggingInterceptor.Level.BODY)
	.build();
	
rxJavaVotoApiClient.listSubscribers(10).subscribe(new Action1<ListSubscribersResponse>() {
	@Override
	public void call(ListSubscribersResponse listSubscribersResponse) {
    	System.out.println(listSubscribersResponse);
  	}
});

Run sample

Make sure you've your VOTO API key set in the local.properties file located in the root directory of the project. The property name should be votoApiKey. If you don't set this, a dummy API key will be used.

After setting the voto api key, issue ./gradlew run. This should run the sample app and output the results in the console.

License

Copyright 2016 Henry Addo Open Source Project

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.

Версии библиотеки

Версия
0.3.0
0.2.0
0.1.0