1

我正在尝试将用于 actionwebservice 的肥皂中的旧 web 服务迁移到新的肥皂 gem。我找到了wash_out,对我来说它看起来很棒,但我不了解官方页面中的一些内容。 https://github.com/inossidabile/wash_out

我有一个行动网络服务的结构,例如:

class DataElement < ActionWebService::Struct
  member :data_id, :int
  member :state, :string
  member :tag, :string
end

class DatasResponse < ActionWebService::Struct
  member :datas, [DataElement]
  member :code, :int
  member :description, :string
end

然后尝试将其迁移到wash_out,这将如何保持不变?

class DataElement < WashOut::Type
  map :universe => {
    :broadcast_id => :int,
    :state => :string,
    :tag => :string,
  }
end

class BroadcastsResponse < WashOut::Type
  map :universe => {
    :broadcasts => [BroadcastElement], # can say that tis is an array?
                                       # when use map am I saying that this is an array?
    :code => :int,
    :description => :string
  }
end

我不了解这些类型的文档。如何在里面定义类型和数组?

也许我弄错了,我是红宝石和肥皂的新手。我无法将其转换为 REST,因为它用于遗留服务。

4

0 回答 0