Module: PolyLingo::Resources::Translate

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

Class Method Summary collapse

Class Method Details

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



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

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

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