Class: SmartlingApi::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/smartling_api/project.rb

Overview

Access to Smartling Project API

Instance Method Summary collapse

Constructor Details

#initialize(smartling: smartling_client, token: access_token, project_id: current_project_id) ⇒ Project

Returns a new instance of Project.



7
8
9
10
11
# 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

Instance Method Details

#list_localesArray

Access to Smartling project api to retrieve list of locales available

Examples:

List Files

SmartlingApi::Project.new.list_locales #=> [{ "localeId" => "de-DE", "description" => "German (Germany)" }, ...]

Returns:

  • (Array)

    Details of the locales available

See Also:



21
22
23
# 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