@@ -31,13 +31,13 @@ def build(cls, id=None, attributes=None, relationships=None):
3131
3232 def create (self ):
3333 api_response = self ._options .api .endpoint (self .endpoint_path ()).post (
34- object = self .__raw_object_for_create ()
34+ object = self .raw_object_for_create ()
3535 )
3636 if api_response .status_code == 201 :
3737 self .raw_object = api_response .content .data
3838
3939 def update (self ):
40- api_response = self .endpoint .patch (object = self .__raw_object_for_update ())
40+ api_response = self .endpoint .patch (object = self .raw_object_for_update ())
4141 if api_response .status_code == 200 and api_response .content .data :
4242 self .raw_object = api_response .content .data
4343
@@ -47,13 +47,13 @@ def creatable_fields(self):
4747 def updatable_fields (self ):
4848 return self .__class__ ._options .fields .keys ()
4949
50- def __raw_object_for_update (self ):
50+ def raw_object_for_update (self ):
5151 updatable_fields = self .updatable_fields ()
5252 attributes = {
5353 k : v for k , v in self .raw_object .attributes .items () if k in updatable_fields
5454 }
5555 relationships = {
56- k : v
56+ k : v . as_data ()
5757 for k , v in self .raw_object .relationships .items ()
5858 if k in updatable_fields
5959 }
@@ -64,13 +64,13 @@ def __raw_object_for_update(self):
6464 relationships = relationships ,
6565 )
6666
67- def __raw_object_for_create (self ):
67+ def raw_object_for_create (self ):
6868 creatable_fields = self .creatable_fields ()
6969 attributes = {
7070 k : v for k , v in self .raw_object .attributes .items () if k in creatable_fields
7171 }
7272 relationships = {
73- k : v
73+ k : v . as_data ()
7474 for k , v in self .raw_object .relationships .items ()
7575 if k in creatable_fields
7676 }
0 commit comments