Skip to content
Lahiru Sahan Jayasinghe edited this page Jan 13, 2014 · 13 revisions
      RoboZombie   /rō-bō'zŏm'bē/   noun.

1. Makes Android networking a breeze.   2. Accepts an interface which describes the remote service and gives you an implementation of it.

Build Status   Coverage Status
robozombie-1.3.3.jar

##Overview

Here's your model.

public class Repo {

    private String id;
    private String name;
    private boolean fork;
    private int stargazers_count;
    
    ...
}

Define the endpoint.
@Deserialize(JSON)
@Endpoint("https://api.github.com")
public interface GitHubEndpoint {

    @GET("/users/{user}/repos")
    List<Repo> getRepos(@PathParam("user") String user);
}

Looks for Gson on your build path.


Inject and invoke.
@Bite
private GitHubEndpoint endpoint;   

{
    Zombie.infect(this);
}

...

List<Repo> repos = endpoint.getRepos("sahan");

Create as many endpoints as you want...
@Endpoint("http://example.com")
public interface ExampleEndpoint {

    @Serialize(XML)	
    @PUT("/content")
    void putContent(@Entity Content content);
}

Looks for Simple-XML on your build path.


...and inject 'em all.
@Bite
private GitHubEndpoint gitHubEndpoint;

@Bite
private ExampleEndpoint exampleEndpoint;

{
    Zombie.infect(this);
}

RoboZombie requires the **INTERNET** manifest permission for network communication.
<uses-permission android:name="android.permission.INTERNET" />

...and be sure to invoke all synchronous requests from a worker thread.


##Setup > If you opt to use the out-of-the-box JSON (de)serializer add the [Gson](http://code.google.com/p/google-gson) dependency; like wise add the [Simple-XML](http://simple.sourceforge.net) dependency for the XML (de)serializer.
### 1. For Maven based projects.

Add the following dependency to project's pom.xml file.

<dependency>
   <groupId>com.lonepulse</groupId>
   <artifactId>robozombie</artifactId>
   <version>1.3.3</version>
</dependency>

### 2. For Gradle based projects.

Add the following repository and dependency to your project's build.gradle file.

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.lonepulse:robozombie:1.3.3'
}

### 3. Add the JAR to your build path manually.

Download the RoboZombie-1.3.3.jar and add it to your libs folder.

Note that Gson is required for JSON (de)serialization and Simple-XML is required for XML (de)serialization.


##Wiki

Coding with RoboZombie is a breeze. It follows a simple annotation based coding style and adheres to a minimal intrusion policy. Kickoff with the quickstart and follow the rest of the wiki pages.

  1. Quickstart

  2. Defining, Injecting and Invoking

  3. Identifying HTTP Methods

  4. Sending Query and Form Parameters

  5. Sending a Request Body

  6. Serializing Request Content

  7. Receiving a Response Body

  8. Deserializing Response Content

  9. Sending and Receiving Headers

  10. Executing Requests Asynchronously

  11. Creating Stateful Endpoints

  12. Intercepting Requests

  13. Overriding, Detaching and Skipping Components

  14. Wiring and Injecting Endpoints

  15. Configuring RoboZombie

##License This library is licensed under Apache License, Version 2.0.