<s> from libsaas import http , parsers <EOL> from libsaas . services import base <EOL> def serialize_param ( val ) : <EOL> if isinstance ( val , bool ) : <EOL> return '<STR_LIT:true>' if val else '<STR_LIT:false>' <EOL> elif isinstance ( val , list ) : <EOL> return '<STR_LIT:U+002C>' . join ( val ) <EOL> return val <EOL> class TrelloFieldMixin ( object ) : <EOL> @ base . apimethod <EOL> def field ( self , field ) : <EOL> """<STR_LIT>""" <EOL> url = '<STR_LIT>' . format ( self . get_url ( ) , field ) <EOL> request = http . Request ( '<STR_LIT:GET>' , url ) <EOL> return request , parsers . parse_json <EOL> class TrelloFilterMixin ( object ) : <EOL> @ base . apimethod <EOL> def filter ( self , filter_id ) : <EOL> """<STR_LIT>""" <EOL> self . require_collection ( ) <EOL> url = '<STR_LIT>' . format ( self . get_url ( ) , filter_id ) <EOL> request = http . Request ( '<STR_LIT:GET>' , url ) <EOL> return request , parsers . parse_json <EOL> class TrelloResource ( base . RESTResource ) : <EOL> def create ( self , * args , ** kwargs ) : <EOL> raise base . MethodNotSupported ( ) <EOL> @ base . apimethod <EOL> def get ( self , fields = None ) : <EOL> """<STR_LIT>""" <EOL> params = base . get_params ( <EOL> None , locals ( ) , serialize_param = serialize_param ) <EOL> request = http . Request ( '<STR_LIT:GET>' , self . get_url ( ) , params ) <EOL> return request , parsers . parse_json <EOL> class TrelloReadonlyResource ( TrelloResource ) : <EOL> def update ( self , * args , ** kwargs ) : <EOL> raise base . MethodNotSupported ( ) <EOL> def delete ( self , * args , ** kwargs ) : <EOL> raise base . MethodNotSupported ( ) <EOL> class TrelloCollection ( base . RESTResource ) : <EOL> def update ( self , * args , ** kwargs ) : <EOL> raise base . MethodNotSupported ( ) <EOL> def delete ( self , * args , ** kwargs ) : <EOL> raise base . MethodNotSupported ( ) <EOL> @ base . apimethod <EOL> def get ( self , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> params = base . get_params ( None , kwargs , serialize_param = serialize_param ) <EOL> request = http . Request ( '<STR_LIT:GET>' , self . get_url ( ) , params ) <EOL> return request , parsers . parse_json <EOL> class TrelloReadonlyCollection ( TrelloCollection ) : <EOL> def create ( self , * args , ** kwargs ) : <EOL> raise base . MethodNotSupported ( ) </s>
