Class: CPApiRequestPagesUpdate
- Inherits:
-
CPApiRequestBase
- Object
- CPApiRequestBase
- CPApiRequestPagesUpdate
- Defined in:
- lib/crowi/client/apireq/api_request_pages.rb
Overview
ページ更新リクエスト用クラス
Constant Summary
Constants inherited from CPApiRequestBase
CPApiRequestBase::METHOD_GET, CPApiRequestBase::METHOD_POST
Instance Attribute Summary
Attributes inherited from CPApiRequestBase
Instance Method Summary collapse
-
#execute(entry_point) ⇒ CrowiPage
リクエストを実行する.
-
#initialize(param = {}) ⇒ CPApiRequestPagesUpdate
constructor
コンストラクタ.
Methods inherited from CPApiRequestBase
#invalid?, #valid?, #validation_msg
Constructor Details
#initialize(param = {}) ⇒ CPApiRequestPagesUpdate
コンストラクタ
143 144 145 146 147 |
# File 'lib/crowi/client/apireq/api_request_pages.rb', line 143 def initialize(param = {}) super('/_api/pages.update', METHOD_POST, { body: param[:body], page_id: param[:page_id], revision_id: param[:revision_id], grant: param[:grant] }) end |
Instance Method Details
#execute(entry_point) ⇒ CrowiPage
リクエストを実行する
153 154 155 156 157 158 159 160 161 162 163 164 |
# File 'lib/crowi/client/apireq/api_request_pages.rb', line 153 def execute(entry_point) if invalid? return validation_msg end ret = JSON.parse RestClient.post entry_point, @param.to_json, { content_type: :json, accept: :json } if (ret['ok'] == false) return CPInvalidRequest.new "API return false with msg: #{ret['msg']}" end return CPApiReturn.new(ok: ret['ok'], data: CrowiPage.new(ret['page'])) end |