':return: This object as a dict which can be easily serialized as json'

def to_dict(self):

    data = {}
    for unmodified in ['inputs', 'attributes', 'method']:
        if (self.__dict__[unmodified] is not None):
            data[unmodified] = self.__dict__[unmodified]
    if (self.action is not None):
        data['action'] = self.action.pattern
    if (self.hosted_at_url is not None):
        data['hosted_at_url'] = self.hosted_at_url.pattern
    return data
