Giter Club home page Giter Club logo

robozombie's Introduction

      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.

robozombie's People

Contributors

sahan avatar waffle-with-pears avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.