Module: LocoRb::Api::Import

Included in:
Client
Defined in:
lib/loco-rb/api/import.rb

Constant Summary collapse

PATH =
'import'

Instance Method Summary collapse

Instance Method Details

#import_locale(options = {ext: 'json'}) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/loco-rb/api/import.rb', line 6

def import_locale(options={ext: 'json'})
  opts = {}
  opts[:params] = { locale: options[:locale] } if options.dig( :locale)
  opts[:params] = opts[:params].merge({ "tag-updated": options[:tag_updated] }) if options.dig( :tag_updated)
  opts[:body] = IO.read(options[:path])
  response = post("#{PATH}/#{options[:ext] || 'json'}", opts)
  LocoRb::Resource::Import.new(response.data, response.headers, 'import')
end