Class: KHL::HTTP::Game

Inherits:
Base
  • Object
show all
Defined in:
lib/khl/http/game.rb

Overview

用户动态相关接口-游戏/进程/音乐 developer.kaiheila.cn/doc/http/game

Constant Summary

Constants inherited from Base

Base::API_VERSION, Base::BASE_URL, Base::END_POINT

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#get, #initialize, #post, #post_file

Constructor Details

This class inherits a constructor from KHL::HTTP::Base

Instance Method Details

#activity(id, data_type) ⇒ KHL::HTTP::Response

添加游戏记录-开始玩

Parameters:

  • id (Integer)

    游戏 ID

  • data_type (Integer)

    请求数据类型,固定传 1(游戏)

Returns:



48
49
50
# File 'lib/khl/http/game.rb', line 48

def activity(id, data_type)
  post(id: id, data_type: data_type)
end

#create(name, options = {}) ⇒ KHL::HTTP::Response

Note:

本接口有数据插入频率限制,单日最大可创建 5 个游戏数据

添加游戏

Parameters:

  • name (String)

    名称

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

    可选参数

Options Hash (options):

  • :process_name (String)

    进程名

  • :icon (String)

    图标

Returns:



23
24
25
# File 'lib/khl/http/game.rb', line 23

def create(name, options = {})
  post(options.merge(name: name))
end

#delete(id) ⇒ KHL::HTTP::Response

删除游戏

Parameters:

  • id (Integer)

    ID

Returns:



40
41
42
# File 'lib/khl/http/game.rb', line 40

def delete(id)
  post(id: id)
end

#delete_activityKHL::HTTP::Response

删除游戏记录-结束玩

Returns:



54
55
56
# File 'lib/khl/http/game.rb', line 54

def delete_activity
  post
end

#listKHL::HTTP::Response

游戏列表

Returns:



12
13
14
# File 'lib/khl/http/game.rb', line 12

def list
  get(action: nil)
end

#update(id, options = {}) ⇒ KHL::HTTP::Response

更新游戏

Parameters:

  • id (Integer)

    ID

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

    可选参数

Options Hash (options):

  • :name (String)

    名称

  • :icon (String)

    图标

Returns:



33
34
35
# File 'lib/khl/http/game.rb', line 33

def update(id, options = {})
  post(options.merge(id: id))
end