PathSegment Class Reference

Inheritance diagram for PathSegment:

Inheritance graph
[legend]
Collaboration diagram for PathSegment:

Collaboration graph
[legend]

Public Member Functions

def __init__
def children
def get_child
def num_children

Data Fields

 full_name
 is_wildcard
 name
 operations

Detailed Description

Tree representation of a Swagger API declaration.

Definition at line 67 of file asterisk_processor.py.


Member Function Documentation

def __init__ (   self,
  name,
  parent 
)

Ctor.

@param name: Name of this path segment. May have {pathVar} markers.
@param parent: Parent PathSegment.

Definition at line 70 of file asterisk_processor.py.

00070                                     :
00071         """Ctor.
00072 
00073         @param name: Name of this path segment. May have {pathVar} markers.
00074         @param parent: Parent PathSegment.
00075         """
00076         #: Segment name, with {pathVar} markers removed
00077         self.name = simple_name(name)
00078         #: True if segment is a {pathVar}, else None.
00079         self.is_wildcard = None
00080         #: Underscore seperated name all ancestor segments
00081         self.full_name = None
00082         #: Dictionary of child PathSegements
00083         self.__children = OrderedDict()
00084         #: List of operations on this segement
00085         self.operations = []
00086 
00087         if self.name != name:
00088             self.is_wildcard = True
00089 
00090         if not self.name:
00091             assert(not parent)
00092             self.full_name = ''
00093         if not parent or not parent.name:
00094             self.full_name = name
00095         else:
00096             self.full_name = "%s_%s" % (parent.full_name, self.name)
00097 
    def get_child(self, path):

def children (   self  ) 

Gets list of children.

Definition at line 113 of file asterisk_processor.py.

00113                       :
00114         """Gets list of children.
00115         """
00116         return self.__children.values()
00117 
    def num_children(self):

def get_child (   self,
  path 
)

Walks decendents to get path, creating it if necessary.

@param path: List of path names.
@return: PageSegment corresponding to path.

Definition at line 98 of file asterisk_processor.py.

00098                              :
00099         """Walks decendents to get path, creating it if necessary.
00100 
00101         @param path: List of path names.
00102         @return: PageSegment corresponding to path.
00103         """
00104         assert simple_name(path[0]) == self.name
00105         if (len(path) == 1):
00106             return self
00107         child = self.__children.get(path[1])
00108         if not child:
00109             child = PathSegment(path[1], self)
00110             self.__children[path[1]] = child
00111         return child.get_child(path[1:])
00112 
    def children(self):

def num_children (   self  ) 

Gets count of children.

Definition at line 118 of file asterisk_processor.py.

00118                           :
00119         """Gets count of children.
00120         """
00121         return len(self.__children)
00122 
00123 
class AsteriskProcessor(SwaggerPostProcessor):


Field Documentation

Definition at line 81 of file asterisk_processor.py.

Definition at line 79 of file asterisk_processor.py.

Definition at line 77 of file asterisk_processor.py.

Definition at line 85 of file asterisk_processor.py.


The documentation for this class was generated from the following file:

Generated on Thu Apr 16 06:41:38 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6