class Locca::Onesky
Public Class Methods
new(project_id, public_key, secret_key)
click to toggle source
# File lib/locca/sync/onesky.rb, line 31 def initialize(project_id, public_key, secret_key) @project_id = project_id @public_key = public_key @secret_key = secret_key end
Public Instance Methods
fetch_response(http_verb, path, params)
click to toggle source
# File lib/locca/sync/onesky.rb, line 50 def fetch_response(http_verb, path, params) options = {:content_type => "application/json; charset=UTF-8", :accept => "application/json"} params = authorization_params.merge(params) path = "https://platform.api.onesky.io/1/projects/#{@project_id}/#{path}" response = case http_verb when :get RestClient.get(path, {:params => params}.merge(options)) when :post RestClient.post(path, params.merge(options)) else raise "bad http verb" end return response end
fetch_translations(lang, file_name)
click to toggle source
# File lib/locca/sync/onesky.rb, line 41 def fetch_translations(lang, file_name) return fetch_response(:get, "translations", {'locale' => lang, 'source_file_name' => file_name}) end
upload_file(file_path, file_format, prune_missing_strings = false)
click to toggle source
# File lib/locca/sync/onesky.rb, line 37 def upload_file(file_path, file_format, prune_missing_strings = false) fetch_response(:post, "files", {'file' => File.new(file_path), 'file_format' => file_format, 'is_keeping_all_strings' => !prune_missing_strings}) end