Package com.tumblr.jumblr

Examples of com.tumblr.jumblr.JumblrClient


        // Parse the credentials
        JsonParser parser = new JsonParser();
        JsonObject obj = (JsonObject) parser.parse(json.toString());

        // Create a client
        JumblrClient client = new JumblrClient(
            obj.getAsJsonPrimitive("consumer_key").getAsString(),
            obj.getAsJsonPrimitive("consumer_secret").getAsString()
        );

        // Give it a token
        client.setToken(
            obj.getAsJsonPrimitive("oauth_token").getAsString(),
            obj.getAsJsonPrimitive("oauth_token_secret").getAsString()
        );

        // Usage
        List<Post> posts = client.blogPosts("seejohnrun");
        for (Post post : posts) {
            System.out.println(post.getShortUrl());
        }

    }
View Full Code Here


        ResponseWrapper got = rb.clear(r);
    }

    @Test
    public void testGetParams() {
        JumblrClient client = new JumblrClient("abc", "def");
        client.getRequestBuilder().setHostname("test.com");
        Map<String, String> map = new HashMap<String, String>();
        map.put("limit", "1");
        OAuthRequest request = client.getRequestBuilder().constructGet("/path", map);

        assertEquals(request.getUrl(), "https://test.com/v2/path");
        assertEquals(request.getQueryStringParams().asFormUrlEncodedString(), "limit=1");
    }
View Full Code Here

TOP

Related Classes of com.tumblr.jumblr.JumblrClient

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.