All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.minlessika.membership.integration.RestUserFeatures Maven / Gradle / Ivy

Go to download

It's a library to help developers to integration membership services to another project.

There is a newer version: 0.3.1
Show newest version
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;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy