<s> from . import BaseResource , Plan <EOL> class Addon ( BaseResource ) : <EOL> """<STR_LIT>""" <EOL> _strs = [ '<STR_LIT:id>' , '<STR_LIT>' , '<STR_LIT:name>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> _pks = [ '<STR_LIT:id>' ] <EOL> _map = { '<STR_LIT>' : Plan } <EOL> _dates = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> def __repr__ ( self ) : <EOL> return "<STR_LIT>" . format ( self . plan . name ) <EOL> def delete ( self ) : <EOL> """<STR_LIT>""" <EOL> r = self . _h . _http_resource ( <EOL> method = '<STR_LIT>' , <EOL> resource = ( '<STR_LIT>' , self . app . id , '<STR_LIT>' , self . id ) <EOL> ) <EOL> r . raise_for_status ( ) <EOL> return r . ok <EOL> def upgrade ( self , plan_id_or_name ) : <EOL> """<STR_LIT>""" <EOL> payload = { '<STR_LIT>' : plan_id_or_name } <EOL> r = self . _h . _http_resource ( <EOL> method = '<STR_LIT>' , <EOL> resource = ( '<STR_LIT>' , self . app . id , '<STR_LIT>' , self . id ) , <EOL> data = self . _h . _resource_serialize ( payload ) <EOL> ) <EOL> r . raise_for_status ( ) <EOL> item = self . _h . _resource_deserialize ( r . content . decode ( "<STR_LIT:utf-8>" ) ) <EOL> return Addon . new_from_dict ( item , h = self . _h , app = self . app ) </s>
