public void HttpPostWhenMethodIsAdd()
 {
     var expected = RequestType.Post;
     var request = new ProwlRequest("add", EmptyDictionary());
     var actual = request.RequestType;
     Assert.AreEqual(expected, actual);
 }
 public void WithPopulatedDictionary()
 {
     var pattern = "https://api.prowlapp.com/publicapi/add?(?:.+=.+&*)+";
     var request = new ProwlRequest("add", PopulatedDictionary());
     var actual = request.Url.ToString();
     Assert.That(actual, Is.StringMatching(pattern));
 }
 public void WithAnEmptyDictionaryItDoesNotAttachParameters()
 {
     var expected = "https://api.prowlapp.com/publicapi/add";
     var request = new ProwlRequest("add", EmptyDictionary());
     var actual = request.Url.ToString();
     Assert.AreEqual(expected, actual);
 }
 private int ProwlDispatch(ProwlRequest request)
 {
     try
     {
          HttpsClientResponse response = Dispatch(request);
          return response.Code;
     }
     catch (HttpsException)
     {
         return 0;
     }
 }
Example #5
0
 private int ProwlDispatch(ProwlRequest request)
 {
     try
     {
         HttpsClientResponse response = Dispatch(request);
         return(response.Code);
     }
     catch (HttpsException)
     {
         return(0);
     }
 }
Example #6
0
 private int ProwlDispatch(ProwlRequest request)
 {
     try
     {
         HttpsClientResponse response = Dispatch(request);
         return(response.Code);
     }
     catch (HttpsException e)
     {
         ErrorLog.Exception("Got exception dispatching Prowl request", e);
         return(0);
     }
 }
Example #7
0
        public int Send(string app, short priority, string url, string subject, string message)
        {
            if (string.IsNullOrEmpty(app))
            {
                app = string.Empty;
            }

            if (string.IsNullOrEmpty(url))
            {
                url = string.Empty;
            }

            if (string.IsNullOrEmpty(subject))
            {
                subject = string.Empty;
            }

            if (string.IsNullOrEmpty(message))
            {
                message = string.Empty;
            }

            string keys = this.ApiKeys;

            if (String.IsNullOrEmpty(keys))
            {
                return(-1);
            }

            var parameters = new Dictionary <string, string>()
            {
                { "apikey", keys },
                { "application", app },
                { "priority", priority.ToString() },
                { "url", url },
                { "event", subject },
                { "description", message }
            };


            var request = new ProwlRequest("add", parameters);

            return(ProwlDispatch(request));
        }
        public int Send(string app, short priority, string url, string subject, string message)
        {
            string keys = this.ApiKeys;
            
            if (String.IsNullOrEmpty(keys))
            {
                return -1;
            }

            var parameters = new Dictionary<string, string>()
               {{ "apikey", keys },
                { "application", app },
                { "priority", priority.ToString() },
                { "url", url },
                { "event", subject },
                { "description", message }};


            var request = new ProwlRequest("add", parameters);
            return ProwlDispatch(request);
        }
 public void RequestsAreHttpsOnly()
 {
     var request = new ProwlRequest("random", EmptyDictionary());
     var protocol = request.Url.Protocol;
     Assert.AreEqual("https", protocol);
 }