Module: PolyLingo::Resources::Batch

Defined in:
lib/polylingo/resources/batch.rb

Class Method Summary collapse

Class Method Details

.call(http, items:, targets:, source: nil, model: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/polylingo/resources/batch.rb', line 8

def call(http, items:, targets:, source: nil, model: nil)
  body = {
    "items" => items,
    "targets" => targets
  }
  body["source"] = source unless source.nil?
  body["model"] = model unless model.nil?

  http.request("/translate/batch", method: :post, body: body, expect_status: 200)
end