Sha256: d6d4dc6c49ac5854d681956387bdbc463de4382154a631627faa8ead640f6831

Contents?: true

Size: 1.03 KB

Versions: 94

Compression:

Stored size: 1.03 KB

Contents

module Translator
  module Smartling
    module API
      class CreateJob
        include Base

        def initialize(project_id:, locales:, due_date:, token:)
          @project_id = project_id
          @locales    = locales
          @due_date   = due_date
          @token      = token
        end

        def request_body
          {
            'jobName' => "ADP Translation Job: #{@locales.join(',')} - #{Time.current.to_date}",
            'targetLocaleIds' => @locales,
            'dueDate' => @due_date,
          }
        end

        def success?
          @response.code == '200'
        end

        def return_value
          @return_value ||= response_body['response']['data']['translationJobUid']
        end

        def uri
          @uri ||= URI("https://api.smartling.com/jobs-api/v3/projects/#{@project_id}/jobs")
        end

        def headers
          { 'Content-Type' => 'application/json', 'Authorization' => "Bearer #{@token}" }
        end

        def to_s
          return_value
        end
      end
    end
  end
end

Version data entries

94 entries across 94 versions & 1 rubygems

Version Path
station-0.5.16 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.15 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.14 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.13 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.12 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.11 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.10 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.9 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.8 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.7 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.6 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.5 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.4 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.3 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.2 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.1 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.5.0 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.4.9 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.4.8 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb
station-0.4.7 lib/nexmo_developer/app/services/translator/smartling/api/create_job.rb