Class: CPApiRequestPagesSeen

Inherits:
CPApiRequestBase show all
Defined in:
lib/crowi/client/apireq/api_request_pages.rb

Overview

Note:

詳細不明

ページ閲覧済マークを付与リクエスト用クラス

Constant Summary

Constants inherited from CPApiRequestBase

CPApiRequestBase::METHOD_GET, CPApiRequestBase::METHOD_POST

Instance Attribute Summary

Attributes inherited from CPApiRequestBase

#entry_point, #method, #param

Instance Method Summary collapse

Methods inherited from CPApiRequestBase

#invalid?, #valid?, #validation_msg

Constructor Details

#initialize(param = {}) ⇒ CPApiRequestPagesSeen

コンストラクタ

Parameters:

  • param (Hash) (defaults to: {})

    APIリクエストのパラメータ



187
188
189
# File 'lib/crowi/client/apireq/api_request_pages.rb', line 187

def initialize(param = {})
  super('/_api/pages.seen', METHOD_POST, { page_id: param[:page_id] })
end

Instance Method Details

#execute(entry_point) ⇒ CrowiPage

リクエストを実行する

Parameters:

Returns:

  • (CrowiPage)

    リクエスト実行結果



195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/crowi/client/apireq/api_request_pages.rb', line 195

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['seenUser']))
end