Sha256: c7900e921ddc9385adf053d00405bfb9f815cae30b7018401a33609e709a3f69
Contents?: true
Size: 908 Bytes
Versions: 5
Compression:
Stored size: 908 Bytes
Contents
require 'httparty' class MissingTranslationApi include HTTParty attr_accessor :api_token #base_uri 'http://api-missing-translation.localhost.test:3000' base_uri 'https://api-missing-translation.9troisquarts.com' def initialize(api_token) @api_token = api_token @options = { headers: { token: @api_token, 'Content-Type': "application/json" } } end def upload(language, group, keys, content_type = "yaml") self.class.post("/translations/import", @options.merge({ body: { content_type: content_type, group: group, language: language, keys: keys }.to_json })) end def download(content_type = "yaml") response = self.class.get('/translations/export', @options.merge({ body: { content_type: content_type }.to_json })) response.parsed_response["data"] || [] end end
Version data entries
5 entries across 5 versions & 1 rubygems