Skip to content

Instantly share code, notes, and snippets.

@timusus
Created August 10, 2016 06:13
Show Gist options
  • Save timusus/fdbaeda69c1439ad481c96936db78e42 to your computer and use it in GitHub Desktop.
Save timusus/fdbaeda69c1439ad481c96936db78e42 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/ruby
## Created by Tim Malseed 16/07/2016
## This script depends on `onesky-ruby`
## Run gem install onesky-ruby
require 'onesky'
API_PUBLIC_KEY = 'your_public_key'
API_SECRET_KEY = 'your_secret_key'
PATH_TO_FILE = 'some/path/to/your/strings/file.ext'
# Create client
client = Onesky::Client.new(API_PUBLIC_KEY, API_SECRET_KEY)
# Get project info
project_groups = JSON.parse(client.list_project_group)
project_group_id = project_groups['data'][0]['id']
projects = JSON.parse(client.list_project project_group_id)
project_id = projects['data'][0]['id']
project = client.project(project_id)
# Upload
print 'Uploading...'
resp = project.upload_file(file: PATH_TO_FILE, file_format: 'ANDROID_XML', locale: 'en', is_keeping_all_strings: false)
resp.code # => 201
print "\nUpload complete. Response: #{resp.code}\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment