Class: CPApiRequestPagesGet
- Inherits:
-
CPApiRequestBase
- Object
- CPApiRequestBase
- CPApiRequestPagesGet
- 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, rest_client_param: {}) ⇒ Array
リクエストを実行する.
-
#initialize(param = {}) ⇒ CPApiRequestPagesGet
constructor
コンストラクタ.
Methods inherited from CPApiRequestBase
#invalid?, #valid?, #validation_msg
Constructor Details
#initialize(param = {}) ⇒ CPApiRequestPagesGet
コンストラクタ
63 64 65 66 67 |
# File 'lib/crowi/client/apireq/api_request_pages.rb', line 63 def initialize(param = {}) super('/_api/pages.get', METHOD_GET, { page_id: param[:page_id], path: param[:path], revision_id: param[:revision_id] }) end |
Instance Method Details
#execute(entry_point, rest_client_param: {}) ⇒ Array
リクエストを実行する
74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/crowi/client/apireq/api_request_pages.rb', line 74 def execute(entry_point, rest_client_param: {}) if invalid? return validation_msg end params = { method: :get, url: entry_point, headers: { params: @param } }.merge(rest_client_param) ret = JSON.parse RestClient::Request.execute params 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 |