Package threescale.v3.api

Examples of threescale.v3.api.HttpResponse


        } catch (IOException ex) {
            try {
                return new HttpResponse(connection.getResponseCode(), getBody(connection.getErrorStream()));
            } catch (IOException e) {
                throw new ServerError(e.getMessage());
            }
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
View Full Code Here


        } catch (IOException ex) {
            try {
                return new HttpResponse(connection.getResponseCode(),
                        (connection.getErrorStream() == null) ? getBody(connection.getInputStream()) : getBody(connection.getErrorStream()));
            } catch (IOException e) {
                throw new ServerError(e.getMessage());
            }
        } finally {
            if (connection != null) {
                connection.disconnect();
            }
View Full Code Here

*/
public class Example {

    public void performAuthRep() {

        ServiceApi serviceApi = new ServiceApiDriver("my_provider_key");    // Create the API object

        ParameterMap params = new ParameterMap();                           // Create top level ParameterMap
        params.add("app_id", "appid");                                      // Set the Users App Id

        ParameterMap usage = new ParameterMap();                            // Create 1st Level PM for usage
        usage.add("hits", "3");                                             // Add number of hits metric
        params.add("usage", usage);                                         // Add 1st level to top level as "usage"

        try {
            final AuthorizeResponse response = serviceApi.authrep(params)// Perform the AuthRep and get the response

            if (response.success()) {                                       // Check if the AuthRep succeeded
                // Perform your calls there
            } else {
                // Handle failure here
View Full Code Here

    DateTimeFormatter fmt;

    @Before
    public void setup() {
        htmlServer = context.mock(ServerAccessor.class);
        serviceApi = new ServiceApiDriver(provider_key).setServer(htmlServer);

        fmt = DateTimeFormat.forPattern("YYYY-MM-dd HH:mm:ss Z");
    }
View Full Code Here

        fmt = DateTimeFormat.forPattern("YYYY-MM-dd HH:mm:ss Z");
    }

    @Test
    public void test_default_host() {
        serviceApi = new ServiceApiDriver();

        assertEquals("su1.3scale.net", serviceApi.getHost());
    }
View Full Code Here

        assertEquals("su1.3scale.net", serviceApi.getHost());
    }

    @Test
    public void test_custom_host() {
        serviceApi = new ServiceApiDriver("1234abcd", "example.com");

        assertEquals("example.com", serviceApi.getHost());
    }
View Full Code Here

*/
public class Example {

    public void performAuthRep() {

        ServiceApi serviceApi = new ServiceApiDriver("my_provider_key");    // Create the API object

        ParameterMap params = new ParameterMap();                           // Create top level ParameterMap
        params.add("app_id", "appid");                                      // Set the Users App Id

        ParameterMap usage = new ParameterMap();                            // Create 1st Level PM for usage
        usage.add("hits", "3");                                             // Add number of hits metric
        params.add("usage", usage);                                         // Add 1st level to top level as "usage"

        try {
            final AuthorizeResponse response = serviceApi.authrep(params)// Perform the AuthRep and get the response

            if (response.success()) {                                       // Check if the AuthRep succeeded
                // Perform your calls there
            } else {
                // Handle failure here
View Full Code Here

TOP

Related Classes of threescale.v3.api.HttpResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.