File tree 2 files changed +16
-11
lines changed
2 files changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,6 @@ class Service extends PersistentResource
30
30
protected static $ url_resource = 'services ' ;
31
31
protected static $ json_name = 'service ' ;
32
32
33
- const UPDATE_METHOD = 'PATCH ' ;
34
-
35
33
protected $ id ;
36
34
protected $ name ;
37
35
protected $ domains ;
@@ -99,4 +97,19 @@ protected function createJson()
99
97
$ createJson = parent ::createJson ();
100
98
return $ createJson ->{self ::$ json_name };
101
99
}
100
+
101
+ /**
102
+ * Update this resource
103
+ *
104
+ * @param array $params
105
+ * @return \Guzzle\Http\Message\Response
106
+ */
107
+ public function update ($ params = array ())
108
+ {
109
+ $ json = $ this ->generateJsonPatch ($ params );
110
+
111
+ return $ this ->getClient ()
112
+ ->patch ($ this ->getUrl (), $ this ->getPatchHeaders (), $ json )
113
+ ->send ();
114
+ }
102
115
}
Original file line number Diff line number Diff line change 29
29
30
30
abstract class PersistentResource extends BaseResource
31
31
{
32
- const UPDATE_METHOD = 'PUT ' ;
33
-
34
32
/**
35
33
* Create a new resource
36
34
*
@@ -82,13 +80,7 @@ public function update($params = array())
82
80
$ this ->checkJsonError ();
83
81
84
82
// send the request
85
- return $ this ->makeUpdateRequest ($ json );
86
- }
87
-
88
- protected function makeUpdateRequest ($ json )
89
- {
90
- $ updateMethod = ('PATCH ' === static ::UPDATE_METHOD ) ? 'patch ' : 'post ' ;
91
- return $ this ->getClient ()->$ updateMethod ($ this ->getUrl (), self ::getJsonHeader (), $ json )->send ();
83
+ return $ this ->getClient ()->put ($ this ->getUrl (), self ::getJsonHeader (), $ json )->send ();
92
84
}
93
85
94
86
/**
You can’t perform that action at this time.
0 commit comments