Class: CPApiRequestPagesCreate
- Inherits:
-
CPApiRequestBase
- Object
- CPApiRequestBase
- CPApiRequestPagesCreate
- 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 = {}) ⇒ CPApiRequestPagesCreate
constructor
コンストラクタ.
Methods inherited from CPApiRequestBase
#invalid?, #valid?, #validation_msg
Constructor Details
#initialize(param = {}) ⇒ CPApiRequestPagesCreate
コンストラクタ
101 102 103 104 |
# File 'lib/crowi/client/apireq/api_request_pages.rb', line 101 def initialize(param = {}) super('/_api/pages.create', METHOD_POST, { body: param[:body], path: param[:path], grant: param[:grant] }) end |
Instance Method Details
#execute(entry_point) ⇒ CrowiPage
リクエストを実行する
110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/crowi/client/apireq/api_request_pages.rb', line 110 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 |