phraseapp-ruby 1.3.3 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/phraseapp-ruby.rb +706 -11
- data/lib/phraseapp-ruby/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64cc2033b2c5f73079cf4a180ef34fb06f502198
|
4
|
+
data.tar.gz: 46cab52cbebff68a470554c97ef6701787ba38d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c56ea5b7075c1a8cf63141b386ed987a342cd12bb668a0b82f566f93def6728fc0e06a094a47fbf2ff40bd2d9b4757ff129e6c712e94c2a663a9a184ed507868
|
7
|
+
data.tar.gz: 58521f7e4fc17a4b3778ecbb2bd2c80bc3b4ff3a6eb2911dbee2ac06b69832d67c432301dbbaf84f12e1c8b873e3c5220042dccac9158c32085ded51c7743c79
|
data/lib/phraseapp-ruby.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
# revision_docs:
|
4
|
-
# revision_generator:
|
3
|
+
# revision_docs:03e0d595d106c8f672cb3ff9871d15eb7ab13905
|
4
|
+
# revision_generator:HEAD/2017-09-19T104754/stefan
|
5
5
|
require 'ostruct'
|
6
6
|
require 'net/https'
|
7
7
|
require 'uri'
|
@@ -125,6 +125,38 @@ module ResponseObjects
|
|
125
125
|
end
|
126
126
|
end
|
127
127
|
|
128
|
+
class Job < ::OpenStruct
|
129
|
+
#briefing, created_at, due_date, id, name, state, updated_at,
|
130
|
+
def initialize(hash)
|
131
|
+
super(hash)
|
132
|
+
PhraseApp.handle_times(self)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
class JobDetails < Job
|
137
|
+
#job_tag_name, keys, locales, owner,
|
138
|
+
def initialize(hash)
|
139
|
+
super(hash)
|
140
|
+
PhraseApp.handle_times(self)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
class JobLocale < ::OpenStruct
|
145
|
+
#id, job, locale, users,
|
146
|
+
def initialize(hash)
|
147
|
+
super(hash)
|
148
|
+
PhraseApp.handle_times(self)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
class JobPreview < ::OpenStruct
|
153
|
+
#id, name, state,
|
154
|
+
def initialize(hash)
|
155
|
+
super(hash)
|
156
|
+
PhraseApp.handle_times(self)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
128
160
|
class KeyPreview < ::OpenStruct
|
129
161
|
#id, name, plural,
|
130
162
|
def initialize(hash)
|
@@ -547,6 +579,86 @@ module RequestParams
|
|
547
579
|
end
|
548
580
|
|
549
581
|
|
582
|
+
module RequestParams
|
583
|
+
# JobLocaleParams
|
584
|
+
# == Parameters:
|
585
|
+
# locale_id::
|
586
|
+
# locale id
|
587
|
+
# user_ids::
|
588
|
+
# Array of ids assigned to the JobLocale
|
589
|
+
class JobLocaleParams < ::OpenStruct
|
590
|
+
|
591
|
+
def locale_id=(val)
|
592
|
+
super(val)
|
593
|
+
end
|
594
|
+
|
595
|
+
def user_ids=(val)
|
596
|
+
super(val.split(','))
|
597
|
+
end
|
598
|
+
|
599
|
+
def validate
|
600
|
+
|
601
|
+
if locale_id == nil || locale_id == ""
|
602
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"locale_id\" of \"JobLocaleParams\" not set")
|
603
|
+
end
|
604
|
+
end
|
605
|
+
|
606
|
+
end
|
607
|
+
end
|
608
|
+
|
609
|
+
|
610
|
+
module RequestParams
|
611
|
+
# JobParams
|
612
|
+
# == Parameters:
|
613
|
+
# briefing::
|
614
|
+
# Briefing for the translators
|
615
|
+
# due_date::
|
616
|
+
# Date the job should be finished
|
617
|
+
# name::
|
618
|
+
# Job name
|
619
|
+
# tags::
|
620
|
+
# tags of keys that should be included within the job
|
621
|
+
# translation_key_ids::
|
622
|
+
# ids of keys that should be included within the job
|
623
|
+
class JobParams < ::OpenStruct
|
624
|
+
|
625
|
+
def briefing=(val)
|
626
|
+
super(val)
|
627
|
+
end
|
628
|
+
|
629
|
+
def due_date=(val)
|
630
|
+
super(DateTime.parse(val))
|
631
|
+
end
|
632
|
+
|
633
|
+
def name=(val)
|
634
|
+
super(val)
|
635
|
+
end
|
636
|
+
|
637
|
+
def tags=(val)
|
638
|
+
super(val.split(','))
|
639
|
+
end
|
640
|
+
|
641
|
+
def translation_key_ids=(val)
|
642
|
+
super(val.split(','))
|
643
|
+
end
|
644
|
+
|
645
|
+
def validate
|
646
|
+
|
647
|
+
if name == nil || name == ""
|
648
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"name\" of \"JobParams\" not set")
|
649
|
+
end
|
650
|
+
if tags == nil
|
651
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"tags\" of \"JobParams\" not set")
|
652
|
+
end
|
653
|
+
if translation_key_ids == nil
|
654
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"translation_key_ids\" of \"JobParams\" not set")
|
655
|
+
end
|
656
|
+
end
|
657
|
+
|
658
|
+
end
|
659
|
+
end
|
660
|
+
|
661
|
+
|
550
662
|
module RequestParams
|
551
663
|
# TranslationKeyParams
|
552
664
|
# == Parameters:
|
@@ -679,7 +791,7 @@ module RequestParams
|
|
679
791
|
# default::
|
680
792
|
# Indicates whether locale is the default locale. If set to true, the previous default locale the project is no longer the default locale.
|
681
793
|
# main::
|
682
|
-
# Indicates whether locale is a main locale.
|
794
|
+
# Indicates whether locale is a main locale. Main locales are part of the <a href="https://phraseapp.com/docs/guides/working-with-phraseapp/verification-proofreading" target="_blank">Verification System</a> feature and only available in <a href="https://phraseapp.com/pricing" target="_blank">Control Package</a>.
|
683
795
|
# name::
|
684
796
|
# Locale name
|
685
797
|
# rtl::
|
@@ -687,9 +799,9 @@ module RequestParams
|
|
687
799
|
# source_locale_id::
|
688
800
|
# Source locale. Can be the name or public id of the locale. Preferred is the public id.
|
689
801
|
# unverify_new_translations::
|
690
|
-
# Indicates that new translations for this locale should be marked as unverified.
|
802
|
+
# Indicates that new translations for this locale should be marked as unverified. Part of the <a href="https://phraseapp.com/docs/guides/working-with-phraseapp/verification-proofreading" target="_blank">Advanced Workflows</a> feature and only available in <a href="https://phraseapp.com/pricing" target="_blank">Control Package</a>.
|
691
803
|
# unverify_updated_translations::
|
692
|
-
# Indicates that updated translations for this locale should be marked as unverified.
|
804
|
+
# Indicates that updated translations for this locale should be marked as unverified. Part of the <a href="https://phraseapp.com/docs/guides/working-with-phraseapp/verification-proofreading" target="_blank">Advanced Workflows</a> feature and only available in <a href="https://phraseapp.com/pricing" target="_blank">Control Package</a>.
|
693
805
|
class LocaleParams < ::OpenStruct
|
694
806
|
|
695
807
|
def code=(val)
|
@@ -1078,9 +1190,9 @@ module RequestParams
|
|
1078
1190
|
# locale_id::
|
1079
1191
|
# Locale. Can be the name or public id of the locale. Preferred is the public id.
|
1080
1192
|
# plural_suffix::
|
1081
|
-
# Plural suffix. Can be one of: zero, one, two, few, many, other.
|
1193
|
+
# Plural suffix. Can be one of: zero, one, two, few, many, other. Must be specified if the key associated to the translation is pluralized.
|
1082
1194
|
# unverified::
|
1083
|
-
# Indicates whether translation is unverified.
|
1195
|
+
# Indicates whether translation is unverified. Part of the <a href="https://phraseapp.com/docs/guides/working-with-phraseapp/verification-proofreading" target="_blank">Advanced Workflows</a> feature and only available in <a href="https://phraseapp.com/pricing" target="_blank">Control Package</a>.
|
1084
1196
|
class TranslationParams < ::OpenStruct
|
1085
1197
|
|
1086
1198
|
def content=(val)
|
@@ -1417,6 +1529,124 @@ module RequestParams
|
|
1417
1529
|
end
|
1418
1530
|
|
1419
1531
|
|
1532
|
+
module RequestParams
|
1533
|
+
# JobKeysCreateParams
|
1534
|
+
# == Parameters:
|
1535
|
+
# translation_key_ids::
|
1536
|
+
# ids of keys that should added to the job
|
1537
|
+
class JobKeysCreateParams < ::OpenStruct
|
1538
|
+
|
1539
|
+
def translation_key_ids=(val)
|
1540
|
+
super(val.split(','))
|
1541
|
+
end
|
1542
|
+
|
1543
|
+
def validate
|
1544
|
+
|
1545
|
+
if translation_key_ids == nil
|
1546
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"translation_key_ids\" of \"job_keys_createParams\" not set")
|
1547
|
+
end
|
1548
|
+
end
|
1549
|
+
|
1550
|
+
end
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
|
1554
|
+
module RequestParams
|
1555
|
+
# JobKeysDeleteParams
|
1556
|
+
# == Parameters:
|
1557
|
+
# translation_key_ids::
|
1558
|
+
# ids of keys that should added to the job
|
1559
|
+
class JobKeysDeleteParams < ::OpenStruct
|
1560
|
+
|
1561
|
+
def translation_key_ids=(val)
|
1562
|
+
super(val.split(','))
|
1563
|
+
end
|
1564
|
+
|
1565
|
+
def validate
|
1566
|
+
|
1567
|
+
if translation_key_ids == nil
|
1568
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"translation_key_ids\" of \"job_keys_deleteParams\" not set")
|
1569
|
+
end
|
1570
|
+
end
|
1571
|
+
|
1572
|
+
end
|
1573
|
+
end
|
1574
|
+
|
1575
|
+
|
1576
|
+
module RequestParams
|
1577
|
+
# JobUpdateParams
|
1578
|
+
# == Parameters:
|
1579
|
+
# briefing::
|
1580
|
+
# Briefing for the translators
|
1581
|
+
# due_date::
|
1582
|
+
# Date the job should be finished
|
1583
|
+
# name::
|
1584
|
+
# Job name
|
1585
|
+
class JobUpdateParams < ::OpenStruct
|
1586
|
+
|
1587
|
+
def briefing=(val)
|
1588
|
+
super(val)
|
1589
|
+
end
|
1590
|
+
|
1591
|
+
def due_date=(val)
|
1592
|
+
super(DateTime.parse(val))
|
1593
|
+
end
|
1594
|
+
|
1595
|
+
def name=(val)
|
1596
|
+
super(val)
|
1597
|
+
end
|
1598
|
+
|
1599
|
+
def validate
|
1600
|
+
|
1601
|
+
if name == nil || name == ""
|
1602
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"name\" of \"job_updateParams\" not set")
|
1603
|
+
end
|
1604
|
+
end
|
1605
|
+
|
1606
|
+
end
|
1607
|
+
end
|
1608
|
+
|
1609
|
+
|
1610
|
+
module RequestParams
|
1611
|
+
# JobsListParams
|
1612
|
+
# == Parameters:
|
1613
|
+
# assigned_to::
|
1614
|
+
# filter by user assigned to job
|
1615
|
+
# owned_by::
|
1616
|
+
# filter by user owning job
|
1617
|
+
# state::
|
1618
|
+
# filter by state of job Valid states are <code>draft</code>, <code>in_progress</code>, <code>completed</code>
|
1619
|
+
class JobsListParams < ::OpenStruct
|
1620
|
+
|
1621
|
+
def assigned_to=(val)
|
1622
|
+
super(val)
|
1623
|
+
end
|
1624
|
+
|
1625
|
+
def owned_by=(val)
|
1626
|
+
super(val)
|
1627
|
+
end
|
1628
|
+
|
1629
|
+
def state=(val)
|
1630
|
+
super(val)
|
1631
|
+
end
|
1632
|
+
|
1633
|
+
def validate
|
1634
|
+
|
1635
|
+
if assigned_to == nil || assigned_to == ""
|
1636
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"assigned_to\" of \"jobs_listParams\" not set")
|
1637
|
+
end
|
1638
|
+
if owned_by == nil || owned_by == ""
|
1639
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"owned_by\" of \"jobs_listParams\" not set")
|
1640
|
+
end
|
1641
|
+
if state == nil || state == ""
|
1642
|
+
raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"state\" of \"jobs_listParams\" not set")
|
1643
|
+
end
|
1644
|
+
end
|
1645
|
+
|
1646
|
+
end
|
1647
|
+
end
|
1648
|
+
|
1649
|
+
|
1420
1650
|
module RequestParams
|
1421
1651
|
# KeysDeleteParams
|
1422
1652
|
# == Parameters:
|
@@ -1720,9 +1950,9 @@ module RequestParams
|
|
1720
1950
|
# excluded::
|
1721
1951
|
# Indicates whether translation is excluded.
|
1722
1952
|
# plural_suffix::
|
1723
|
-
# Plural suffix. Can be one of: zero, one, two, few, many, other.
|
1953
|
+
# Plural suffix. Can be one of: zero, one, two, few, many, other. Must be specified if the key associated to the translation is pluralized.
|
1724
1954
|
# unverified::
|
1725
|
-
# Indicates whether translation is unverified.
|
1955
|
+
# Indicates whether translation is unverified. Part of the <a href="https://phraseapp.com/docs/guides/working-with-phraseapp/verification-proofreading" target="_blank">Advanced Workflows</a> feature and only available in <a href="https://phraseapp.com/pricing" target="_blank">Control Package</a>.
|
1726
1956
|
class TranslationUpdateParams < ::OpenStruct
|
1727
1957
|
|
1728
1958
|
def content=(val)
|
@@ -3197,6 +3427,471 @@ end
|
|
3197
3427
|
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Invitation.new(item) }, err
|
3198
3428
|
end
|
3199
3429
|
|
3430
|
+
# Mark a job as completed.
|
3431
|
+
# API Path: /v2/projects/:project_id/jobs/:id/complete
|
3432
|
+
# == Parameters:
|
3433
|
+
# project_id::
|
3434
|
+
# project_id
|
3435
|
+
# id::
|
3436
|
+
# id
|
3437
|
+
#
|
3438
|
+
# == Returns:
|
3439
|
+
# PhraseApp::ResponseObjects::JobDetails
|
3440
|
+
# err
|
3441
|
+
def job_complete(project_id, id)
|
3442
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/complete", project_id, id)
|
3443
|
+
data_hash = {}
|
3444
|
+
post_body = nil
|
3445
|
+
|
3446
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3447
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
|
3448
|
+
if err != nil
|
3449
|
+
return nil, err
|
3450
|
+
end
|
3451
|
+
|
3452
|
+
return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
|
3453
|
+
end
|
3454
|
+
|
3455
|
+
# Create a new job.
|
3456
|
+
# API Path: /v2/projects/:project_id/jobs
|
3457
|
+
# == Parameters:
|
3458
|
+
# project_id::
|
3459
|
+
# project_id
|
3460
|
+
# params::
|
3461
|
+
# Parameters of type PhraseApp::RequestParams::JobParams
|
3462
|
+
#
|
3463
|
+
# == Returns:
|
3464
|
+
# PhraseApp::ResponseObjects::JobDetails
|
3465
|
+
# err
|
3466
|
+
def job_create(project_id, params)
|
3467
|
+
path = sprintf("/api/v2/projects/%s/jobs", project_id)
|
3468
|
+
data_hash = {}
|
3469
|
+
post_body = nil
|
3470
|
+
|
3471
|
+
if params.present?
|
3472
|
+
unless params.kind_of?(PhraseApp::RequestParams::JobParams)
|
3473
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobParams")
|
3474
|
+
end
|
3475
|
+
end
|
3476
|
+
|
3477
|
+
data_hash = params.to_h
|
3478
|
+
err = params.validate
|
3479
|
+
if err != nil
|
3480
|
+
return nil, err
|
3481
|
+
end
|
3482
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3483
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
|
3484
|
+
if err != nil
|
3485
|
+
return nil, err
|
3486
|
+
end
|
3487
|
+
|
3488
|
+
return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
|
3489
|
+
end
|
3490
|
+
|
3491
|
+
# Delete an existing job.
|
3492
|
+
# API Path: /v2/projects/:project_id/jobs/:id
|
3493
|
+
# == Parameters:
|
3494
|
+
# project_id::
|
3495
|
+
# project_id
|
3496
|
+
# id::
|
3497
|
+
# id
|
3498
|
+
#
|
3499
|
+
# == Returns:
|
3500
|
+
# err
|
3501
|
+
def job_delete(project_id, id)
|
3502
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s", project_id, id)
|
3503
|
+
data_hash = {}
|
3504
|
+
post_body = nil
|
3505
|
+
|
3506
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3507
|
+
rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
3508
|
+
if err != nil
|
3509
|
+
return nil, err
|
3510
|
+
end
|
3511
|
+
|
3512
|
+
return err
|
3513
|
+
end
|
3514
|
+
|
3515
|
+
# Add multiple keys to a existing job.
|
3516
|
+
# API Path: /v2/projects/:project_id/jobs/:id/keys
|
3517
|
+
# == Parameters:
|
3518
|
+
# project_id::
|
3519
|
+
# project_id
|
3520
|
+
# id::
|
3521
|
+
# id
|
3522
|
+
# params::
|
3523
|
+
# Parameters of type PhraseApp::RequestParams::JobKeysCreateParams
|
3524
|
+
#
|
3525
|
+
# == Returns:
|
3526
|
+
# PhraseApp::ResponseObjects::JobDetails
|
3527
|
+
# err
|
3528
|
+
def job_keys_create(project_id, id, params)
|
3529
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/keys", project_id, id)
|
3530
|
+
data_hash = {}
|
3531
|
+
post_body = nil
|
3532
|
+
|
3533
|
+
if params.present?
|
3534
|
+
unless params.kind_of?(PhraseApp::RequestParams::JobKeysCreateParams)
|
3535
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobKeysCreateParams")
|
3536
|
+
end
|
3537
|
+
end
|
3538
|
+
|
3539
|
+
data_hash = params.to_h
|
3540
|
+
err = params.validate
|
3541
|
+
if err != nil
|
3542
|
+
return nil, err
|
3543
|
+
end
|
3544
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3545
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
|
3546
|
+
if err != nil
|
3547
|
+
return nil, err
|
3548
|
+
end
|
3549
|
+
|
3550
|
+
return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
|
3551
|
+
end
|
3552
|
+
|
3553
|
+
# Remove multiple keys from existing job.
|
3554
|
+
# API Path: /v2/projects/:project_id/jobs/:id/keys
|
3555
|
+
# == Parameters:
|
3556
|
+
# project_id::
|
3557
|
+
# project_id
|
3558
|
+
# id::
|
3559
|
+
# id
|
3560
|
+
# params::
|
3561
|
+
# Parameters of type PhraseApp::RequestParams::JobKeysDeleteParams
|
3562
|
+
#
|
3563
|
+
# == Returns:
|
3564
|
+
# err
|
3565
|
+
def job_keys_delete(project_id, id, params)
|
3566
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/keys", project_id, id)
|
3567
|
+
data_hash = {}
|
3568
|
+
post_body = nil
|
3569
|
+
|
3570
|
+
if params.present?
|
3571
|
+
unless params.kind_of?(PhraseApp::RequestParams::JobKeysDeleteParams)
|
3572
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobKeysDeleteParams")
|
3573
|
+
end
|
3574
|
+
end
|
3575
|
+
|
3576
|
+
data_hash = params.to_h
|
3577
|
+
err = params.validate
|
3578
|
+
if err != nil
|
3579
|
+
return nil, err
|
3580
|
+
end
|
3581
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3582
|
+
rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
3583
|
+
if err != nil
|
3584
|
+
return nil, err
|
3585
|
+
end
|
3586
|
+
|
3587
|
+
return err
|
3588
|
+
end
|
3589
|
+
|
3590
|
+
# Get details on a single job for a given project.
|
3591
|
+
# API Path: /v2/projects/:project_id/jobs/:id
|
3592
|
+
# == Parameters:
|
3593
|
+
# project_id::
|
3594
|
+
# project_id
|
3595
|
+
# id::
|
3596
|
+
# id
|
3597
|
+
#
|
3598
|
+
# == Returns:
|
3599
|
+
# PhraseApp::ResponseObjects::JobDetails
|
3600
|
+
# err
|
3601
|
+
def job_show(project_id, id)
|
3602
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s", project_id, id)
|
3603
|
+
data_hash = {}
|
3604
|
+
post_body = nil
|
3605
|
+
|
3606
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3607
|
+
rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
|
3608
|
+
if err != nil
|
3609
|
+
return nil, err
|
3610
|
+
end
|
3611
|
+
|
3612
|
+
return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
|
3613
|
+
end
|
3614
|
+
|
3615
|
+
# Starts an existing job in state draft.
|
3616
|
+
# API Path: /v2/projects/:project_id/jobs/:id/start
|
3617
|
+
# == Parameters:
|
3618
|
+
# project_id::
|
3619
|
+
# project_id
|
3620
|
+
# id::
|
3621
|
+
# id
|
3622
|
+
#
|
3623
|
+
# == Returns:
|
3624
|
+
# PhraseApp::ResponseObjects::JobDetails
|
3625
|
+
# err
|
3626
|
+
def job_start(project_id, id)
|
3627
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/start", project_id, id)
|
3628
|
+
data_hash = {}
|
3629
|
+
post_body = nil
|
3630
|
+
|
3631
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3632
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
|
3633
|
+
if err != nil
|
3634
|
+
return nil, err
|
3635
|
+
end
|
3636
|
+
|
3637
|
+
return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
|
3638
|
+
end
|
3639
|
+
|
3640
|
+
# Update an existing job.
|
3641
|
+
# API Path: /v2/projects/:project_id/jobs/:id
|
3642
|
+
# == Parameters:
|
3643
|
+
# project_id::
|
3644
|
+
# project_id
|
3645
|
+
# id::
|
3646
|
+
# id
|
3647
|
+
# params::
|
3648
|
+
# Parameters of type PhraseApp::RequestParams::JobUpdateParams
|
3649
|
+
#
|
3650
|
+
# == Returns:
|
3651
|
+
# PhraseApp::ResponseObjects::JobDetails
|
3652
|
+
# err
|
3653
|
+
def job_update(project_id, id, params)
|
3654
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s", project_id, id)
|
3655
|
+
data_hash = {}
|
3656
|
+
post_body = nil
|
3657
|
+
|
3658
|
+
if params.present?
|
3659
|
+
unless params.kind_of?(PhraseApp::RequestParams::JobUpdateParams)
|
3660
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobUpdateParams")
|
3661
|
+
end
|
3662
|
+
end
|
3663
|
+
|
3664
|
+
data_hash = params.to_h
|
3665
|
+
err = params.validate
|
3666
|
+
if err != nil
|
3667
|
+
return nil, err
|
3668
|
+
end
|
3669
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3670
|
+
rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
3671
|
+
if err != nil
|
3672
|
+
return nil, err
|
3673
|
+
end
|
3674
|
+
|
3675
|
+
return PhraseApp::ResponseObjects::JobDetails.new(JSON.load(rc.body)), err
|
3676
|
+
end
|
3677
|
+
|
3678
|
+
# Mark a JobLocale as completed.
|
3679
|
+
# API Path: /v2/projects/:project_id/jobs/:id/complete
|
3680
|
+
# == Parameters:
|
3681
|
+
# project_id::
|
3682
|
+
# project_id
|
3683
|
+
# id::
|
3684
|
+
# id
|
3685
|
+
#
|
3686
|
+
# == Returns:
|
3687
|
+
# PhraseApp::ResponseObjects::JobLocale
|
3688
|
+
# err
|
3689
|
+
def job_locale_complete(project_id, id)
|
3690
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/complete", project_id, id)
|
3691
|
+
data_hash = {}
|
3692
|
+
post_body = nil
|
3693
|
+
|
3694
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3695
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200)
|
3696
|
+
if err != nil
|
3697
|
+
return nil, err
|
3698
|
+
end
|
3699
|
+
|
3700
|
+
return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
|
3701
|
+
end
|
3702
|
+
|
3703
|
+
# Delete an existing JobLocale.
|
3704
|
+
# API Path: /v2/projects/:project_id/jobs/:job_id/locale/:id
|
3705
|
+
# == Parameters:
|
3706
|
+
# project_id::
|
3707
|
+
# project_id
|
3708
|
+
# job_id::
|
3709
|
+
# job_id
|
3710
|
+
# id::
|
3711
|
+
# id
|
3712
|
+
#
|
3713
|
+
# == Returns:
|
3714
|
+
# err
|
3715
|
+
def job_locale_delete(project_id, job_id, id)
|
3716
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/locale/%s", project_id, job_id, id)
|
3717
|
+
data_hash = {}
|
3718
|
+
post_body = nil
|
3719
|
+
|
3720
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3721
|
+
rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
3722
|
+
if err != nil
|
3723
|
+
return nil, err
|
3724
|
+
end
|
3725
|
+
|
3726
|
+
return err
|
3727
|
+
end
|
3728
|
+
|
3729
|
+
# Get a single JobLocale for a given job.
|
3730
|
+
# API Path: /v2/projects/:project_id/jobs/:job_id/locale/:id
|
3731
|
+
# == Parameters:
|
3732
|
+
# project_id::
|
3733
|
+
# project_id
|
3734
|
+
# job_id::
|
3735
|
+
# job_id
|
3736
|
+
# id::
|
3737
|
+
# id
|
3738
|
+
#
|
3739
|
+
# == Returns:
|
3740
|
+
# PhraseApp::ResponseObjects::JobLocale
|
3741
|
+
# err
|
3742
|
+
def job_locale_show(project_id, job_id, id)
|
3743
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/locale/%s", project_id, job_id, id)
|
3744
|
+
data_hash = {}
|
3745
|
+
post_body = nil
|
3746
|
+
|
3747
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3748
|
+
rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
|
3749
|
+
if err != nil
|
3750
|
+
return nil, err
|
3751
|
+
end
|
3752
|
+
|
3753
|
+
return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
|
3754
|
+
end
|
3755
|
+
|
3756
|
+
# Update an existing job.
|
3757
|
+
# API Path: /v2/projects/:project_id/jobs/:job_id/locales/:id
|
3758
|
+
# == Parameters:
|
3759
|
+
# project_id::
|
3760
|
+
# project_id
|
3761
|
+
# job_id::
|
3762
|
+
# job_id
|
3763
|
+
# id::
|
3764
|
+
# id
|
3765
|
+
# params::
|
3766
|
+
# Parameters of type PhraseApp::RequestParams::JobLocaleParams
|
3767
|
+
#
|
3768
|
+
# == Returns:
|
3769
|
+
# PhraseApp::ResponseObjects::JobLocale
|
3770
|
+
# err
|
3771
|
+
def job_locale_update(project_id, job_id, id, params)
|
3772
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/locales/%s", project_id, job_id, id)
|
3773
|
+
data_hash = {}
|
3774
|
+
post_body = nil
|
3775
|
+
|
3776
|
+
if params.present?
|
3777
|
+
unless params.kind_of?(PhraseApp::RequestParams::JobLocaleParams)
|
3778
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocaleParams")
|
3779
|
+
end
|
3780
|
+
end
|
3781
|
+
|
3782
|
+
data_hash = params.to_h
|
3783
|
+
err = params.validate
|
3784
|
+
if err != nil
|
3785
|
+
return nil, err
|
3786
|
+
end
|
3787
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3788
|
+
rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
3789
|
+
if err != nil
|
3790
|
+
return nil, err
|
3791
|
+
end
|
3792
|
+
|
3793
|
+
return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
|
3794
|
+
end
|
3795
|
+
|
3796
|
+
# Create a new JobLocale.
|
3797
|
+
# API Path: /v2/projects/:project_id/jobs/:job_id/locales
|
3798
|
+
# == Parameters:
|
3799
|
+
# project_id::
|
3800
|
+
# project_id
|
3801
|
+
# job_id::
|
3802
|
+
# job_id
|
3803
|
+
# params::
|
3804
|
+
# Parameters of type PhraseApp::RequestParams::JobLocaleParams
|
3805
|
+
#
|
3806
|
+
# == Returns:
|
3807
|
+
# PhraseApp::ResponseObjects::JobLocale
|
3808
|
+
# err
|
3809
|
+
def job_locales_create(project_id, job_id, params)
|
3810
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/locales", project_id, job_id)
|
3811
|
+
data_hash = {}
|
3812
|
+
post_body = nil
|
3813
|
+
|
3814
|
+
if params.present?
|
3815
|
+
unless params.kind_of?(PhraseApp::RequestParams::JobLocaleParams)
|
3816
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobLocaleParams")
|
3817
|
+
end
|
3818
|
+
end
|
3819
|
+
|
3820
|
+
data_hash = params.to_h
|
3821
|
+
err = params.validate
|
3822
|
+
if err != nil
|
3823
|
+
return nil, err
|
3824
|
+
end
|
3825
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3826
|
+
rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
|
3827
|
+
if err != nil
|
3828
|
+
return nil, err
|
3829
|
+
end
|
3830
|
+
|
3831
|
+
return PhraseApp::ResponseObjects::JobLocale.new(JSON.load(rc.body)), err
|
3832
|
+
end
|
3833
|
+
|
3834
|
+
# List all JobLocales for a given job.
|
3835
|
+
# API Path: /v2/projects/:project_id/jobs/:job_id/locales
|
3836
|
+
# == Parameters:
|
3837
|
+
# project_id::
|
3838
|
+
# project_id
|
3839
|
+
# job_id::
|
3840
|
+
# job_id
|
3841
|
+
#
|
3842
|
+
# == Returns:
|
3843
|
+
# PhraseApp::ResponseObjects::JobLocale
|
3844
|
+
# err
|
3845
|
+
def job_locales_list(project_id, job_id, page, per_page)
|
3846
|
+
path = sprintf("/api/v2/projects/%s/jobs/%s/locales", project_id, job_id)
|
3847
|
+
data_hash = {}
|
3848
|
+
post_body = nil
|
3849
|
+
|
3850
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3851
|
+
rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
3852
|
+
if err != nil
|
3853
|
+
return nil, err
|
3854
|
+
end
|
3855
|
+
|
3856
|
+
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::JobLocale.new(item) }, err
|
3857
|
+
end
|
3858
|
+
|
3859
|
+
# List all jobs for the given project.
|
3860
|
+
# API Path: /v2/projects/:project_id/jobs
|
3861
|
+
# == Parameters:
|
3862
|
+
# project_id::
|
3863
|
+
# project_id
|
3864
|
+
# params::
|
3865
|
+
# Parameters of type PhraseApp::RequestParams::JobsListParams
|
3866
|
+
#
|
3867
|
+
# == Returns:
|
3868
|
+
# PhraseApp::ResponseObjects::Job
|
3869
|
+
# err
|
3870
|
+
def jobs_list(project_id, page, per_page, params)
|
3871
|
+
path = sprintf("/api/v2/projects/%s/jobs", project_id)
|
3872
|
+
data_hash = {}
|
3873
|
+
post_body = nil
|
3874
|
+
|
3875
|
+
if params.present?
|
3876
|
+
unless params.kind_of?(PhraseApp::RequestParams::JobsListParams)
|
3877
|
+
raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::JobsListParams")
|
3878
|
+
end
|
3879
|
+
end
|
3880
|
+
|
3881
|
+
data_hash = params.to_h
|
3882
|
+
err = params.validate
|
3883
|
+
if err != nil
|
3884
|
+
return nil, err
|
3885
|
+
end
|
3886
|
+
reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
|
3887
|
+
rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
3888
|
+
if err != nil
|
3889
|
+
return nil, err
|
3890
|
+
end
|
3891
|
+
|
3892
|
+
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Job.new(item) }, err
|
3893
|
+
end
|
3894
|
+
|
3200
3895
|
# Create a new key.
|
3201
3896
|
# API Path: /v2/projects/:project_id/keys
|
3202
3897
|
# == Parameters:
|
@@ -4772,7 +5467,7 @@ end
|
|
4772
5467
|
return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Translation.new(item) }, err
|
4773
5468
|
end
|
4774
5469
|
|
4775
|
-
# Mark translations matching query as unverified.
|
5470
|
+
# <div class='alert alert-info'>Only available in the <a href='https://phraseapp.com/pricing' target='_blank'>Control Package</a>.</div>Mark translations matching query as unverified.
|
4776
5471
|
# API Path: /v2/projects/:project_id/translations/unverify
|
4777
5472
|
# == Parameters:
|
4778
5473
|
# project_id::
|
@@ -4808,7 +5503,7 @@ end
|
|
4808
5503
|
return PhraseApp::ResponseObjects::AffectedCount.new(JSON.load(rc.body)), err
|
4809
5504
|
end
|
4810
5505
|
|
4811
|
-
# Verify translations matching query.
|
5506
|
+
# <div class='alert alert-info'>Only available in the <a href='https://phraseapp.com/pricing' target='_blank'>Control Package</a>.</div>Verify translations matching query.
|
4812
5507
|
# API Path: /v2/projects/:project_id/translations/verify
|
4813
5508
|
# == Parameters:
|
4814
5509
|
# project_id::
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phraseapp-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PhraseApp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: PhraseApp API client libary
|
14
14
|
email:
|
@@ -41,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
41
41
|
version: '0'
|
42
42
|
requirements: []
|
43
43
|
rubyforge_project:
|
44
|
-
rubygems_version: 2.
|
44
|
+
rubygems_version: 2.6.12
|
45
45
|
signing_key:
|
46
46
|
specification_version: 4
|
47
47
|
summary: Interact with the PhraseApp API
|