class SmartlingApi::Project
Access to Smartling Project
API
Attributes
project_id[R]
smartling[R]
token[R]
Public Class Methods
new(smartling: smartling_client, token: access_token, project_id: current_project_id)
click to toggle source
# File lib/smartling_api/project.rb, line 7 def initialize(smartling: smartling_client, token: access_token, project_id: current_project_id) @token = token @project_id = project_id @smartling = smartling end
Public Instance Methods
list_locales()
click to toggle source
Access to Smartling project api to retrieve list of locales available
@see docs.smartling.com/pages/API/v2/Projects/List-Projects/
@example List Files
SmartlingApi::Project.new.list_locales #=> [{ "localeId" => "de-DE", "description" => "German (Germany)" }, ...]
@return [Array] Details of the locales available
# File lib/smartling_api/project.rb, line 21 def list_locales smartling.get(url: "/projects-api/v2/projects/#{project_id}", token: token).fetch("targetLocales", []) end
Private Instance Methods
access_token()
click to toggle source
# File lib/smartling_api/project.rb, line 37 def access_token Authentication.new.access_token end
current_project_id()
click to toggle source
# File lib/smartling_api/project.rb, line 29 def current_project_id SmartlingApi.configuration.project_id end
smartling_client()
click to toggle source
# File lib/smartling_api/project.rb, line 33 def smartling_client Clients::Smartling.new end