[asterisk-commits] dlee: branch dlee/stasis-http r384107 - in /team/dlee/stasis-http: cog/ res/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 27 13:30:14 CDT 2013


Author: dlee
Date: Wed Mar 27 13:30:11 2013
New Revision: 384107

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=384107
Log:
Apparently, swagger prefers int to number.

Modified:
    team/dlee/stasis-http/cog/stasis_cog.py
    team/dlee/stasis-http/res/res_stasis_http.make
    team/dlee/stasis-http/rest-api/bridges.json
    team/dlee/stasis-http/rest-api/channels.json

Modified: team/dlee/stasis-http/cog/stasis_cog.py
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/cog/stasis_cog.py?view=diff&rev=384107&r1=384106&r2=384107
==============================================================================
--- team/dlee/stasis-http/cog/stasis_cog.py (original)
+++ team/dlee/stasis-http/cog/stasis_cog.py Wed Mar 27 13:30:11 2013
@@ -502,6 +502,14 @@
             self.c_type = 'int'
         elif dataType == 'number':
             self.c_type = 'int'
+        elif dataType == 'int':
+            self.c_type = 'int'
+        elif dataType == 'long':
+            self.c_type = 'long'
+        elif dataType == 'double':
+            self.c_type = 'double'
+        elif dataType == 'float':
+            self.c_type = 'float'
         else:
             raise ValueError("Invalid dataType: %s" % dataType)
 
@@ -511,12 +519,18 @@
     def decoder(self, char_pointer):
         """Returns the C code for decoding this param from a string.
         """
+        is_int = self.dataType == 'number' or self.dataType == 'int' or \
+            self.dataType == 'long'
+        is_double = self.dataType == 'double' or self.dataType == 'float'
+        
         if self.dataType == 'string':
             return char_pointer
         elif self.dataType == 'boolean':
             return 'ast_true(%s)' % char_pointer
-        elif self.dataType == 'number':
+        elif is_int:
             return 'strtol(%s, NULL, 0)' % char_pointer
+        elif is_double:
+            return 'atof(%s)' % char_pointer
         else:
             assert False, "Someone forgot to update the decoder"
             return char_pointer

Modified: team/dlee/stasis-http/res/res_stasis_http.make
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http.make?view=diff&rev=384107&r1=384106&r2=384107
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http.make (original)
+++ team/dlee/stasis-http/res/res_stasis_http.make Wed Mar 27 13:30:11 2013
@@ -5,7 +5,7 @@
 #
 # Generated Makefile for res_stasis_http dependencies.
 #
-# 
+#
 # Copyright (C) 2012 - 2013, Digium, Inc.
 #
 # This program is free software, distributed under the terms of

Modified: team/dlee/stasis-http/rest-api/bridges.json
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/rest-api/bridges.json?view=diff&rev=384107&r1=384106&r2=384107
==============================================================================
--- team/dlee/stasis-http/rest-api/bridges.json (original)
+++ team/dlee/stasis-http/rest-api/bridges.json Wed Mar 27 13:30:11 2013
@@ -155,7 +155,7 @@
                             "paramType": "query",
                             "required": false,
                             "allowMultiple": false,
-                            "dataType": "number",
+                            "dataType": "int",
                             "defaultValue": 0
                         },
                         {
@@ -164,7 +164,7 @@
                             "paramType": "query",
                             "required": false,
                             "allowMultiple": false,
-                            "dataType": "number",
+                            "dataType": "int",
                             "defaultValue": 0
                         },
                         {

Modified: team/dlee/stasis-http/rest-api/channels.json
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/rest-api/channels.json?view=diff&rev=384107&r1=384106&r2=384107
==============================================================================
--- team/dlee/stasis-http/rest-api/channels.json (original)
+++ team/dlee/stasis-http/rest-api/channels.json Wed Mar 27 13:30:11 2013
@@ -313,7 +313,7 @@
                             "paramType": "query",
                             "required": false,
                             "allowMultiple": false,
-                            "dataType": "number",
+                            "dataType": "int",
                             "defaultValue": 0
                         },
                         {
@@ -322,7 +322,7 @@
                             "paramType": "query",
                             "required": false,
                             "allowMultiple": false,
-                            "dataType": "number",
+                            "dataType": "int",
                             "defaultValue": 0
                         },
                         {




More information about the asterisk-commits mailing list