Class AerisRequest

  • Direct Known Subclasses:
    AerisBatchRequest, AerisPermissionsRequest

    public class AerisRequest
    extends UrlBuilder
    Builds request for various endpoints, actions, and parameters.
     Some code examples:
     
     Construct a request for the observation for zip code 55403
     
     AerisRequest request = new AerisRequest(TestConstants.CLIENT_ID,
     				TestConstants.CLIENT_SECRET, new Endpoint(
     				EndpointType.OBSERVATIONS), "55403"):
     
     
     Construct a request for 5 observations within 50 miles of zip code 55403 (Minneapolis). Results will be sorted by distance (ascending) from zip code 55403 
     
     AerisRequest request = new AerisRequest(TestConstants.CLIENT_ID,
     				TestConstants.CLIENT_SECRET, new Endpoint(
     						EndpointType.OBSERVATIONS), Action.CLOSEST,
     				new PlaceParameter("55403"), new LimitParameter(5), new RadiusParameter(50,
     						RadiusUnitParameter.MILES) ;
     
     
    • Field Detail

      • action

        protected Action action
      • parameters

        protected Parameter[] parameters
      • longitude

        protected Double longitude
      • debug

        protected boolean debug
      • secureAccess

        protected boolean secureAccess
    • Constructor Detail

      • AerisRequest

        protected AerisRequest()
      • AerisRequest

        public AerisRequest​(Endpoint endpoint,
                            Action action,
                            Parameter... params)
        Builds the request with a specified endpoint, action, params. Grabs the secret id and client id from the AerisEngine.
        Parameters:
        endpoint - Endpoint we are requesting data from
        action - Action to take on the endpoint
        params - Optional parameters
      • AerisRequest

        public AerisRequest​(Endpoint endpoint,
                            String id,
                            Parameter... params)
        Builds the request with a specified endpoint, action, params. Grabs the secret id and client id from the AerisEngine.
        Parameters:
        endpoint - Endpoint we are requesting data from
        id - String
        params - optional
      • AerisRequest

        public AerisRequest​(String clientId,
                            String clientSecret,
                            String packageName,
                            Endpoint endpoint,
                            String id,
                            Parameter... params)
        Builds the request with a specified endpoint, action, params.
        Parameters:
        clientId - Aeris account id
        clientSecret - Aeris account secret
        packageName - The package name of the service requesting data
        endpoint - Endpoint was are requesting
        id - String
        params - optional
      • AerisRequest

        public AerisRequest​(String clientId,
                            String clientSecret,
                            String packageName,
                            Endpoint endpoint,
                            Action action,
                            Parameter... params)
        Builds the request with a specified endpoint, action, params.
        Parameters:
        clientId - Aeris account id
        clientSecret - Aeris account secret
        packageName - The package name of the service requesting data
        endpoint - Endpoint was are requesting
        action - Action to take on the endpoint
        params - optional
    • Method Detail

      • withDebugOutput

        public AerisRequest withDebugOutput​(boolean debug)
        Constructs the request with the debug set to a value. Default value is false
        Parameters:
        debug - debug boolean to set as. True will log the request and response from Aeris.
        Returns:
        The AerisRequest
      • isDebug

        public boolean isDebug()
        Returns if debug has been enabled which allows for the request and response to be logged in logcat
        Returns:
        true if debug is enabled, false otherwise
      • isSecureAccess

        public boolean isSecureAccess()
        Returns whether secure access has been enabled. Secure access points the API to use HTTPS versus HTTP.
        Returns:
        true if secure access is enabled.
      • withSecureAccess

        public AerisRequest withSecureAccess​(boolean secureAccess)
        Sets the secure access. Secure access points the API to use HTTPS versus HTTP. Default is false.
        Parameters:
        secureAccess - What to set the secure access to.
        Returns:
        AerisRequest obj
      • build

        public String build()
        Builds the request for from the given parameters
        Specified by:
        build in class UrlBuilder
        Returns:
        the String url for the request.
      • getParameters

        protected String getParameters()
        Gets the parameters in the correct format.
        Returns:
        Parameters in a Url friendly format. 04april2016sshie - removed the appID (AMP update)