com.minlessika.membership.integration.RestUserFeatures Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of membership-integration Show documentation
Show all versions of membership-integration Show documentation
It's a library to help developers to integration membership services to another project.
package com.minlessika.membership.integration;
import com.google.common.collect.ImmutableMap;
import com.minlessika.http.client.RestClient;
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
public final class RestUserFeatures implements Features {
private final User user;
private final RestClient client;
public RestUserFeatures(final User user, final RestClient client) {
this.user = user;
this.client = client;
}
@Override
public void add(Feature item) {
}
@Override
public void remove(Feature item) {
}
@Override
public void removeAll() throws IOException {
}
@Override
public Iterable iterate() {
final List items = new LinkedList<>();
this.client.get(
"/api/user/module/features",
ImmutableMap.of("user", this.user.uid())
).asJsonArray()
.forEach(
json -> items.add(
new RestUserFeature(
json.asJsonObject(),
this.user,
this.client
)
)
);
return items;
}
}