1

我正在寻找一种对现有屏幕板/时间表进行“部分”更新的方法。通过“部分”,我的意思是在现有的屏幕板/时间板中添加一些小部件,而不清除已经存在的现有小部件。

考虑以下示例:

创建屏幕板:

require 'dogapi'

api_key = "..."
application_key = "..."

board = {
    "width" => 1024,
    "height" => 768,
    "board_title" => "bjusufbe dogapi test",
    "widgets" => [
        {
          "type" => "image",
          "height" => 20,
          "width" => 32,
          "y" => 7,
          "x" => 32,
          "url" => "https://path/to/create_image.jpg"
        }
    ]
}

dog = Dogapi::Client.new(api_key, application_key)
result = dog.create_screenboard(board)

更新屏幕板:

require 'dogapi'

api_key = "..."
application_key = "..."

board_id = "..."

board = {
    "width" => 1024,
    "height" => 768,
    "board_title" => "bjusufbe dogapi test",
    "widgets" => [
        {
          "type" => "image",
          "height" => 20,
          "width" => 32,
          "y" => 7,
          "x" => 32,
          "url" => "https://path/to/update_image.jpg"
        }
    ]
}

dog = Dogapi::Client.new(api_key, application_key)
result = dog.update_screenboard(board_id,  board)

当我运行创建然后更新示例时,update_image小部件将覆盖create_image小部件,这就是我试图避免的问题。

4

0 回答 0