class Jaspion::Miya::Android::Retrofit

Represents an Android Retrofit template (square.github.io/retrofit/)

Public Instance Methods

imports() click to toggle source
# File lib/jaspion/miya/android/retrofit.rb, line 10
        def imports
          %(
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.ResponseBody;
import com.squareup.okhttp.logging.HttpLoggingInterceptor;
import retrofit.Call;
import retrofit.Callback;
import retrofit.GsonConverterFactory;
import retrofit.Response;
import retrofit.Retrofit;
import #{name}RESTInterface;)
        end
instance_methods() click to toggle source
# File lib/jaspion/miya/android/retrofit.rb, line 27
    def instance_methods
      %(
protected void loadRetrofit() {
    if (BuildConfig.DEBUG) {
        HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
        logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
        OkHttpClient httpClient = new OkHttpClient();
        httpClient.interceptors().add(logging);
    }

    this.#{name} = new Retrofit.Builder()
        .baseUrl(#{name}RESTInterface.BASE_URL)
        .addConverterFactory(GsonConverterFactory.create())
        .client(httpClient)
        .build();

    this.#{name.uncapitalize}RESTInterface = retrofit.create(#{name}RESTInterface.class);
})
    end
instance_variables() click to toggle source
# File lib/jaspion/miya/android/retrofit.rb, line 23
def instance_variables
  "    private #{name}RESTInterface #{name.uncapitalize}RESTInterface;"
end