Class: CPApiRequestAttachmentsList
- Inherits:
-
CPApiRequestBase
- Object
- CPApiRequestBase
- CPApiRequestAttachmentsList
- Defined in:
- lib/crowi/client/apireq/api_request_attachments.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 = {}) ⇒ CPApiRequestAttachmentsList
constructor
コンストラクタ.
Methods inherited from CPApiRequestBase
#invalid?, #valid?, #validation_msg
Constructor Details
#initialize(param = {}) ⇒ CPApiRequestAttachmentsList
コンストラクタ
10 11 12 |
# File 'lib/crowi/client/apireq/api_request_attachments.rb', line 10 def initialize(param = {}) super('/_api/attachments.list', METHOD_GET, { page_id: param[:page_id] }) end |
Instance Method Details
#execute(entry_point, rest_client_param: {}) ⇒ Array
リクエストを実行する
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/crowi/client/apireq/api_request_attachments.rb', line 19 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 = [] ret['attachments'].each do || .push(CrowiAttachment.new()) end return CPApiReturn.new(ok: ret['ok'], data: ) end |