phraseapp-ruby 1.0.1 → 1.0.2
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 +739 -334
- data/lib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 647b18886bababdd8c53f3a09605aa9cda0652ac
|
4
|
+
data.tar.gz: e0bd2765da55f24ac7a497c989a9e64f507323d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee9987194795e7e5d6a9fc4ec11522472088f812b2c7184f3e26a2a1eb782ec668b8360c2b895ea4c7150428c003091f092ccbb0f41ceb22ef97f99405f721e9
|
7
|
+
data.tar.gz: 823167866acd7661fe5df913b4aa896273951b43193fa97656832494daa301970ffd7b99f146d842c5ba0cb85d0a572e8c7b51f08e4fe4ac7efbef90677a7813
|
data/lib/phraseapp-ruby.rb
CHANGED
@@ -23,8 +23,16 @@ module PhraseApp
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
class AffectedCount < ::OpenStruct
|
27
|
+
#records_affected,
|
28
|
+
def initialize(hash)
|
29
|
+
super(hash)
|
30
|
+
PhraseApp.handle_times(self)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
26
34
|
class Authorization < ::OpenStruct
|
27
|
-
#created_at, hashed_token, id, note, scopes, token_last_eight, updated_at,
|
35
|
+
#created_at, expires_at, hashed_token, id, note, scopes, token_last_eight, updated_at,
|
28
36
|
def initialize(hash)
|
29
37
|
super(hash)
|
30
38
|
PhraseApp.handle_times(self)
|
@@ -55,6 +63,14 @@ module PhraseApp
|
|
55
63
|
end
|
56
64
|
end
|
57
65
|
|
66
|
+
class ExcludeRule < ::OpenStruct
|
67
|
+
#created_at, id, name, updated_at,
|
68
|
+
def initialize(hash)
|
69
|
+
super(hash)
|
70
|
+
PhraseApp.handle_times(self)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
58
74
|
class Format < ::OpenStruct
|
59
75
|
#api_name, default_encoding, description, exportable, extension, importable, name,
|
60
76
|
def initialize(hash)
|
@@ -72,7 +88,7 @@ module PhraseApp
|
|
72
88
|
end
|
73
89
|
|
74
90
|
class Locale < ::OpenStruct
|
75
|
-
#code, created_at, default, id, main, name, rtl, source_locale, updated_at,
|
91
|
+
#code, created_at, default, id, main, name, plural_forms, rtl, source_locale, updated_at,
|
76
92
|
def initialize(hash)
|
77
93
|
super(hash)
|
78
94
|
PhraseApp.handle_times(self)
|
@@ -88,7 +104,7 @@ module PhraseApp
|
|
88
104
|
end
|
89
105
|
|
90
106
|
class LocaleFileImport < ::OpenStruct
|
91
|
-
#created_at,
|
107
|
+
#created_at, file_format, id, state, updated_at,
|
92
108
|
def initialize(hash)
|
93
109
|
super(hash)
|
94
110
|
PhraseApp.handle_times(self)
|
@@ -200,7 +216,7 @@ module PhraseApp
|
|
200
216
|
end
|
201
217
|
|
202
218
|
class Translation < ::OpenStruct
|
203
|
-
#content, created_at, excluded, id, key, locale, plural_suffix, unverified, updated_at,
|
219
|
+
#content, created_at, excluded, id, key, locale, placeholders, plural_suffix, unverified, updated_at,
|
204
220
|
def initialize(hash)
|
205
221
|
super(hash)
|
206
222
|
PhraseApp.handle_times(self)
|
@@ -216,7 +232,7 @@ module PhraseApp
|
|
216
232
|
end
|
217
233
|
|
218
234
|
class TranslationKey < ::OpenStruct
|
219
|
-
#created_at, description, id, name, name_hash, plural, tags, updated_at,
|
235
|
+
#created_at, data_type, description, id, name, name_hash, plural, tags, updated_at,
|
220
236
|
def initialize(hash)
|
221
237
|
super(hash)
|
222
238
|
PhraseApp.handle_times(self)
|
@@ -224,7 +240,7 @@ module PhraseApp
|
|
224
240
|
end
|
225
241
|
|
226
242
|
class TranslationKeyDetails < TranslationKey
|
227
|
-
#comments_count,
|
243
|
+
#comments_count, format_value_type, max_characters_allowed, name_plural, original_file, screenshot_url, unformatted, xml_space_preserve,
|
228
244
|
def initialize(hash)
|
229
245
|
super(hash)
|
230
246
|
PhraseApp.handle_times(self)
|
@@ -274,7 +290,11 @@ module PhraseApp
|
|
274
290
|
end
|
275
291
|
|
276
292
|
class PhraseApp::AuthorizationParams < ::OpenStruct
|
277
|
-
# :note, :scopes,
|
293
|
+
# :expires_at, :note, :scopes,
|
294
|
+
def expires_at=(val)
|
295
|
+
self.expires_at = Time.parse(val)
|
296
|
+
end
|
297
|
+
|
278
298
|
def note=(val)
|
279
299
|
self.note = val
|
280
300
|
end
|
@@ -290,34 +310,34 @@ class PhraseApp::AuthorizationParams < ::OpenStruct
|
|
290
310
|
end
|
291
311
|
end
|
292
312
|
|
293
|
-
class PhraseApp::
|
294
|
-
# :
|
295
|
-
def
|
296
|
-
self.
|
313
|
+
class PhraseApp::CommentParams < ::OpenStruct
|
314
|
+
# :message,
|
315
|
+
def message=(val)
|
316
|
+
self.message = val
|
297
317
|
end
|
298
318
|
|
299
319
|
def validate
|
300
|
-
if self.
|
301
|
-
raise PhraseApp::ParamsValidationError.new("Required parameter \"
|
320
|
+
if self.message == nil || self.message == ""
|
321
|
+
raise PhraseApp::ParamsValidationError.new("Required parameter \"message\" of \"CommentParams\" not set")
|
302
322
|
end
|
303
323
|
end
|
304
324
|
end
|
305
325
|
|
306
|
-
class PhraseApp::
|
307
|
-
# :
|
308
|
-
def
|
309
|
-
self.
|
326
|
+
class PhraseApp::ExcludeRuleParams < ::OpenStruct
|
327
|
+
# :name,
|
328
|
+
def name=(val)
|
329
|
+
self.name = val
|
310
330
|
end
|
311
331
|
|
312
332
|
def validate
|
313
|
-
if self.
|
314
|
-
raise PhraseApp::ParamsValidationError.new("Required parameter \"
|
333
|
+
if self.name == nil || self.name == ""
|
334
|
+
raise PhraseApp::ParamsValidationError.new("Required parameter \"name\" of \"ExcludeRuleParams\" not set")
|
315
335
|
end
|
316
336
|
end
|
317
337
|
end
|
318
338
|
|
319
339
|
class PhraseApp::TranslationKeyParams < ::OpenStruct
|
320
|
-
# :data_type, :description, :
|
340
|
+
# :data_type, :description, :localized_format_key, :localized_format_string, :max_characters_allowed, :name, :name_plural, :original_file, :plural, :remove_screenshot, :screenshot, :tags, :unformatted, :xml_space_preserve,
|
321
341
|
def data_type=(val)
|
322
342
|
self.data_type = val
|
323
343
|
end
|
@@ -326,8 +346,12 @@ class PhraseApp::TranslationKeyParams < ::OpenStruct
|
|
326
346
|
self.description = val
|
327
347
|
end
|
328
348
|
|
329
|
-
def
|
330
|
-
self.
|
349
|
+
def localized_format_key=(val)
|
350
|
+
self.localized_format_key = val
|
351
|
+
end
|
352
|
+
|
353
|
+
def localized_format_string=(val)
|
354
|
+
self.localized_format_string = val
|
331
355
|
end
|
332
356
|
|
333
357
|
def max_characters_allowed=(val)
|
@@ -700,7 +724,7 @@ class PhraseApp::TranslationParams < ::OpenStruct
|
|
700
724
|
end
|
701
725
|
|
702
726
|
class PhraseApp::LocaleFileImportParams < ::OpenStruct
|
703
|
-
# :convert_emoji, :file, :
|
727
|
+
# :convert_emoji, :file, :file_format, :format_options, :locale_id, :skip_unverification, :skip_upload_tags, :tags, :update_translations,
|
704
728
|
def convert_emoji=(val)
|
705
729
|
if val == "true"
|
706
730
|
self.convert_emoji = true
|
@@ -715,8 +739,8 @@ class PhraseApp::LocaleFileImportParams < ::OpenStruct
|
|
715
739
|
self.file = val
|
716
740
|
end
|
717
741
|
|
718
|
-
def
|
719
|
-
self.
|
742
|
+
def file_format=(val)
|
743
|
+
self.file_format = val
|
720
744
|
end
|
721
745
|
|
722
746
|
def format_options=(val)
|
@@ -807,8 +831,23 @@ end
|
|
807
831
|
class PhraseApp::ParamsError < StandardError; end
|
808
832
|
|
809
833
|
|
810
|
-
class PhraseApp::
|
811
|
-
# :locale_id, :
|
834
|
+
class PhraseApp::KeysDeleteParams < ::OpenStruct
|
835
|
+
# :locale_id, :q,
|
836
|
+
def locale_id=(val)
|
837
|
+
self.locale_id = val
|
838
|
+
end
|
839
|
+
|
840
|
+
def q=(val)
|
841
|
+
self.q = val
|
842
|
+
end
|
843
|
+
|
844
|
+
def validate
|
845
|
+
|
846
|
+
end
|
847
|
+
end
|
848
|
+
|
849
|
+
class PhraseApp::KeysListParams < ::OpenStruct
|
850
|
+
# :locale_id, :order, :q, :sort,
|
812
851
|
def locale_id=(val)
|
813
852
|
self.locale_id = val
|
814
853
|
end
|
@@ -817,18 +856,35 @@ class PhraseApp::KeyListParams < ::OpenStruct
|
|
817
856
|
self.order = val
|
818
857
|
end
|
819
858
|
|
859
|
+
def q=(val)
|
860
|
+
self.q = val
|
861
|
+
end
|
862
|
+
|
820
863
|
def sort=(val)
|
821
864
|
self.sort = val
|
822
865
|
end
|
823
866
|
|
824
|
-
def
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
867
|
+
def validate
|
868
|
+
|
869
|
+
end
|
870
|
+
end
|
871
|
+
|
872
|
+
class PhraseApp::KeysSearchParams < ::OpenStruct
|
873
|
+
# :locale_id, :order, :q, :sort,
|
874
|
+
def locale_id=(val)
|
875
|
+
self.locale_id = val
|
876
|
+
end
|
877
|
+
|
878
|
+
def order=(val)
|
879
|
+
self.order = val
|
880
|
+
end
|
881
|
+
|
882
|
+
def q=(val)
|
883
|
+
self.q = val
|
884
|
+
end
|
885
|
+
|
886
|
+
def sort=(val)
|
887
|
+
self.sort = val
|
832
888
|
end
|
833
889
|
|
834
890
|
def validate
|
@@ -836,8 +892,50 @@ class PhraseApp::KeyListParams < ::OpenStruct
|
|
836
892
|
end
|
837
893
|
end
|
838
894
|
|
895
|
+
class PhraseApp::KeysTagParams < ::OpenStruct
|
896
|
+
# :locale_id, :q, :tags,
|
897
|
+
def locale_id=(val)
|
898
|
+
self.locale_id = val
|
899
|
+
end
|
900
|
+
|
901
|
+
def q=(val)
|
902
|
+
self.q = val
|
903
|
+
end
|
904
|
+
|
905
|
+
def tags=(val)
|
906
|
+
self.tags = val.split(',')
|
907
|
+
end
|
908
|
+
|
909
|
+
def validate
|
910
|
+
if self.tags == nil
|
911
|
+
raise PhraseApp::ParamsValidationError.new("Required parameter \"tags\" of \"keys_tagParams\" not set")
|
912
|
+
end
|
913
|
+
end
|
914
|
+
end
|
915
|
+
|
916
|
+
class PhraseApp::KeysUntagParams < ::OpenStruct
|
917
|
+
# :locale_id, :q, :tags,
|
918
|
+
def locale_id=(val)
|
919
|
+
self.locale_id = val
|
920
|
+
end
|
921
|
+
|
922
|
+
def q=(val)
|
923
|
+
self.q = val
|
924
|
+
end
|
925
|
+
|
926
|
+
def tags=(val)
|
927
|
+
self.tags = val.split(',')
|
928
|
+
end
|
929
|
+
|
930
|
+
def validate
|
931
|
+
if self.tags == nil
|
932
|
+
raise PhraseApp::ParamsValidationError.new("Required parameter \"tags\" of \"keys_untagParams\" not set")
|
933
|
+
end
|
934
|
+
end
|
935
|
+
end
|
936
|
+
|
839
937
|
class PhraseApp::LocaleDownloadParams < ::OpenStruct
|
840
|
-
# :convert_emoji, :
|
938
|
+
# :convert_emoji, :file_format, :format_options, :include_empty_translations, :keep_notranslate_tags, :tag_id,
|
841
939
|
def convert_emoji=(val)
|
842
940
|
if val == "true"
|
843
941
|
self.convert_emoji = true
|
@@ -848,8 +946,8 @@ class PhraseApp::LocaleDownloadParams < ::OpenStruct
|
|
848
946
|
end
|
849
947
|
end
|
850
948
|
|
851
|
-
def
|
852
|
-
self.
|
949
|
+
def file_format=(val)
|
950
|
+
self.file_format = val
|
853
951
|
end
|
854
952
|
|
855
953
|
def format_options=(val)
|
@@ -881,24 +979,30 @@ class PhraseApp::LocaleDownloadParams < ::OpenStruct
|
|
881
979
|
end
|
882
980
|
|
883
981
|
def validate
|
884
|
-
if self.
|
885
|
-
raise PhraseApp::ParamsValidationError.new("Required parameter \"
|
982
|
+
if self.file_format == nil || self.file_format == ""
|
983
|
+
raise PhraseApp::ParamsValidationError.new("Required parameter \"file_format\" of \"locale_downloadParams\" not set")
|
886
984
|
end
|
887
985
|
end
|
888
986
|
end
|
889
987
|
|
890
|
-
class PhraseApp::
|
891
|
-
# :
|
892
|
-
def
|
893
|
-
self.
|
988
|
+
class PhraseApp::TranslationUpdateParams < ::OpenStruct
|
989
|
+
# :content, :excluded, :plural_suffix, :unverified,
|
990
|
+
def content=(val)
|
991
|
+
self.content = val
|
894
992
|
end
|
895
993
|
|
896
|
-
def
|
897
|
-
|
994
|
+
def excluded=(val)
|
995
|
+
if val == "true"
|
996
|
+
self.excluded = true
|
997
|
+
elsif val == "false" #ignore
|
998
|
+
self.excluded = b
|
999
|
+
else
|
1000
|
+
PhraseApp::ParamsValidationError.new("invalid value #{val}")
|
1001
|
+
end
|
898
1002
|
end
|
899
1003
|
|
900
|
-
def
|
901
|
-
self.
|
1004
|
+
def plural_suffix=(val)
|
1005
|
+
self.plural_suffix = val
|
902
1006
|
end
|
903
1007
|
|
904
1008
|
def unverified=(val)
|
@@ -911,33 +1015,63 @@ class PhraseApp::TranslationListAllParams < ::OpenStruct
|
|
911
1015
|
end
|
912
1016
|
end
|
913
1017
|
|
1018
|
+
def validate
|
1019
|
+
if self.content == nil || self.content == ""
|
1020
|
+
raise PhraseApp::ParamsValidationError.new("Required parameter \"content\" of \"translation_updateParams\" not set")
|
1021
|
+
end
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
class PhraseApp::TranslationsByKeyParams < ::OpenStruct
|
1026
|
+
# :order, :q, :sort,
|
1027
|
+
def order=(val)
|
1028
|
+
self.order = val
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
def q=(val)
|
1032
|
+
self.q = val
|
1033
|
+
end
|
1034
|
+
|
1035
|
+
def sort=(val)
|
1036
|
+
self.sort = val
|
1037
|
+
end
|
1038
|
+
|
914
1039
|
def validate
|
915
1040
|
|
916
1041
|
end
|
917
1042
|
end
|
918
1043
|
|
919
|
-
class PhraseApp::
|
920
|
-
# :order, :
|
1044
|
+
class PhraseApp::TranslationsByLocaleParams < ::OpenStruct
|
1045
|
+
# :order, :q, :sort,
|
921
1046
|
def order=(val)
|
922
1047
|
self.order = val
|
923
1048
|
end
|
924
1049
|
|
925
|
-
def
|
926
|
-
self.
|
1050
|
+
def q=(val)
|
1051
|
+
self.q = val
|
927
1052
|
end
|
928
1053
|
|
929
1054
|
def sort=(val)
|
930
1055
|
self.sort = val
|
931
1056
|
end
|
932
1057
|
|
933
|
-
def
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
1058
|
+
def validate
|
1059
|
+
|
1060
|
+
end
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
class PhraseApp::TranslationsExcludeParams < ::OpenStruct
|
1064
|
+
# :order, :q, :sort,
|
1065
|
+
def order=(val)
|
1066
|
+
self.order = val
|
1067
|
+
end
|
1068
|
+
|
1069
|
+
def q=(val)
|
1070
|
+
self.q = val
|
1071
|
+
end
|
1072
|
+
|
1073
|
+
def sort=(val)
|
1074
|
+
self.sort = val
|
941
1075
|
end
|
942
1076
|
|
943
1077
|
def validate
|
@@ -945,28 +1079,37 @@ class PhraseApp::TranslationListKeyParams < ::OpenStruct
|
|
945
1079
|
end
|
946
1080
|
end
|
947
1081
|
|
948
|
-
class PhraseApp::
|
949
|
-
# :order, :
|
1082
|
+
class PhraseApp::TranslationsIncludeParams < ::OpenStruct
|
1083
|
+
# :order, :q, :sort,
|
950
1084
|
def order=(val)
|
951
1085
|
self.order = val
|
952
1086
|
end
|
953
1087
|
|
954
|
-
def
|
955
|
-
self.
|
1088
|
+
def q=(val)
|
1089
|
+
self.q = val
|
956
1090
|
end
|
957
1091
|
|
958
1092
|
def sort=(val)
|
959
1093
|
self.sort = val
|
960
1094
|
end
|
961
1095
|
|
962
|
-
def
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
1096
|
+
def validate
|
1097
|
+
|
1098
|
+
end
|
1099
|
+
end
|
1100
|
+
|
1101
|
+
class PhraseApp::TranslationsListParams < ::OpenStruct
|
1102
|
+
# :order, :q, :sort,
|
1103
|
+
def order=(val)
|
1104
|
+
self.order = val
|
1105
|
+
end
|
1106
|
+
|
1107
|
+
def q=(val)
|
1108
|
+
self.q = val
|
1109
|
+
end
|
1110
|
+
|
1111
|
+
def sort=(val)
|
1112
|
+
self.sort = val
|
970
1113
|
end
|
971
1114
|
|
972
1115
|
def validate
|
@@ -974,40 +1117,60 @@ class PhraseApp::TranslationListLocaleParams < ::OpenStruct
|
|
974
1117
|
end
|
975
1118
|
end
|
976
1119
|
|
977
|
-
class PhraseApp::
|
978
|
-
# :
|
979
|
-
def
|
980
|
-
self.
|
1120
|
+
class PhraseApp::TranslationsSearchParams < ::OpenStruct
|
1121
|
+
# :order, :q, :sort,
|
1122
|
+
def order=(val)
|
1123
|
+
self.order = val
|
981
1124
|
end
|
982
1125
|
|
983
|
-
def
|
984
|
-
|
985
|
-
self.excluded = true
|
986
|
-
elsif val == "false" #ignore
|
987
|
-
self.excluded = b
|
988
|
-
else
|
989
|
-
PhraseApp::ParamsValidationError.new("invalid value #{val}")
|
990
|
-
end
|
1126
|
+
def q=(val)
|
1127
|
+
self.q = val
|
991
1128
|
end
|
992
1129
|
|
993
|
-
def
|
994
|
-
self.
|
1130
|
+
def sort=(val)
|
1131
|
+
self.sort = val
|
995
1132
|
end
|
996
1133
|
|
997
|
-
def
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1134
|
+
def validate
|
1135
|
+
|
1136
|
+
end
|
1137
|
+
end
|
1138
|
+
|
1139
|
+
class PhraseApp::TranslationsUnverifyParams < ::OpenStruct
|
1140
|
+
# :order, :q, :sort,
|
1141
|
+
def order=(val)
|
1142
|
+
self.order = val
|
1143
|
+
end
|
1144
|
+
|
1145
|
+
def q=(val)
|
1146
|
+
self.q = val
|
1147
|
+
end
|
1148
|
+
|
1149
|
+
def sort=(val)
|
1150
|
+
self.sort = val
|
1005
1151
|
end
|
1006
1152
|
|
1007
1153
|
def validate
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1154
|
+
|
1155
|
+
end
|
1156
|
+
end
|
1157
|
+
|
1158
|
+
class PhraseApp::TranslationsVerifyParams < ::OpenStruct
|
1159
|
+
# :order, :q, :sort,
|
1160
|
+
def order=(val)
|
1161
|
+
self.order = val
|
1162
|
+
end
|
1163
|
+
|
1164
|
+
def q=(val)
|
1165
|
+
self.q = val
|
1166
|
+
end
|
1167
|
+
|
1168
|
+
def sort=(val)
|
1169
|
+
self.sort = val
|
1170
|
+
end
|
1171
|
+
|
1172
|
+
def validate
|
1173
|
+
|
1011
1174
|
end
|
1012
1175
|
end
|
1013
1176
|
|
@@ -1039,7 +1202,7 @@ class PhraseApp::Client
|
|
1039
1202
|
return PhraseApp::AuthorizationWithToken.new(JSON.load(rc.body)), err
|
1040
1203
|
end
|
1041
1204
|
|
1042
|
-
# Delete an existing authorization.
|
1205
|
+
# Delete an existing authorization. API calls using that token will stop working.
|
1043
1206
|
def self.authorization_delete(id)
|
1044
1207
|
path = sprintf("/v2/authorizations/%s", id)
|
1045
1208
|
data_hash = {}
|
@@ -1054,21 +1217,6 @@ class PhraseApp::Client
|
|
1054
1217
|
return err
|
1055
1218
|
end
|
1056
1219
|
|
1057
|
-
# List all your authorizations.
|
1058
|
-
def self.authorization_list(page, per_page)
|
1059
|
-
path = sprintf("/v2/authorizations")
|
1060
|
-
data_hash = {}
|
1061
|
-
post_body = nil
|
1062
|
-
|
1063
|
-
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1064
|
-
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1065
|
-
if err != nil
|
1066
|
-
return nil, err
|
1067
|
-
end
|
1068
|
-
|
1069
|
-
return JSON.load(rc.body).map { |item| PhraseApp::Authorization.new(item) }, err
|
1070
|
-
end
|
1071
|
-
|
1072
1220
|
# Get details on a single authorization.
|
1073
1221
|
def self.authorization_show(id)
|
1074
1222
|
path = sprintf("/v2/authorizations/%s", id)
|
@@ -1110,15 +1258,30 @@ class PhraseApp::Client
|
|
1110
1258
|
return PhraseApp::Authorization.new(JSON.load(rc.body)), err
|
1111
1259
|
end
|
1112
1260
|
|
1113
|
-
#
|
1114
|
-
def self.
|
1115
|
-
path = sprintf("/v2/
|
1261
|
+
# List all your authorizations.
|
1262
|
+
def self.authorizations_list(page, per_page)
|
1263
|
+
path = sprintf("/v2/authorizations")
|
1116
1264
|
data_hash = {}
|
1117
1265
|
post_body = nil
|
1118
1266
|
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1267
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1268
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1269
|
+
if err != nil
|
1270
|
+
return nil, err
|
1271
|
+
end
|
1272
|
+
|
1273
|
+
return JSON.load(rc.body).map { |item| PhraseApp::Authorization.new(item) }, err
|
1274
|
+
end
|
1275
|
+
|
1276
|
+
# Create a new comment for a key.
|
1277
|
+
def self.comment_create(project_id, key_id, params)
|
1278
|
+
path = sprintf("/v2/projects/%s/keys/%s/comments", project_id, key_id)
|
1279
|
+
data_hash = {}
|
1280
|
+
post_body = nil
|
1281
|
+
|
1282
|
+
if params.present?
|
1283
|
+
unless params.kind_of?(PhraseApp::CommentCreateParams)
|
1284
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::CommentCreateParams")
|
1122
1285
|
end
|
1123
1286
|
end
|
1124
1287
|
|
@@ -1133,12 +1296,12 @@ class PhraseApp::Client
|
|
1133
1296
|
return nil, err
|
1134
1297
|
end
|
1135
1298
|
|
1136
|
-
return PhraseApp::
|
1299
|
+
return PhraseApp::Comment.new(JSON.load(rc.body)), err
|
1137
1300
|
end
|
1138
1301
|
|
1139
|
-
# Delete an existing
|
1140
|
-
def self.
|
1141
|
-
path = sprintf("/v2/projects/%s/
|
1302
|
+
# Delete an existing comment.
|
1303
|
+
def self.comment_delete(project_id, key_id, id)
|
1304
|
+
path = sprintf("/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
|
1142
1305
|
data_hash = {}
|
1143
1306
|
post_body = nil
|
1144
1307
|
|
@@ -1151,71 +1314,75 @@ class PhraseApp::Client
|
|
1151
1314
|
return err
|
1152
1315
|
end
|
1153
1316
|
|
1154
|
-
#
|
1155
|
-
def self.
|
1156
|
-
path = sprintf("/v2/projects/%s/
|
1317
|
+
# Check if comment was marked as read. Returns 204 if read, 404 if unread.
|
1318
|
+
def self.comment_mark_check(project_id, key_id, id)
|
1319
|
+
path = sprintf("/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
|
1157
1320
|
data_hash = {}
|
1158
1321
|
post_body = nil
|
1159
1322
|
|
1160
1323
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1161
|
-
rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body,
|
1324
|
+
rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 204)
|
1162
1325
|
if err != nil
|
1163
1326
|
return nil, err
|
1164
1327
|
end
|
1165
1328
|
|
1166
|
-
return
|
1329
|
+
return err
|
1167
1330
|
end
|
1168
1331
|
|
1169
|
-
#
|
1170
|
-
def self.
|
1171
|
-
path = sprintf("/v2/projects/%s/
|
1332
|
+
# Mark a comment as read
|
1333
|
+
def self.comment_mark_read(project_id, key_id, id)
|
1334
|
+
path = sprintf("/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
|
1172
1335
|
data_hash = {}
|
1173
1336
|
post_body = nil
|
1174
1337
|
|
1175
|
-
|
1176
|
-
|
1177
|
-
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::BlacklistKeyUpdateParams")
|
1178
|
-
end
|
1179
|
-
end
|
1180
|
-
|
1181
|
-
data_hash = params.to_h
|
1182
|
-
err = params.validate
|
1338
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1339
|
+
rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 204)
|
1183
1340
|
if err != nil
|
1184
1341
|
return nil, err
|
1185
1342
|
end
|
1343
|
+
|
1344
|
+
return err
|
1345
|
+
end
|
1346
|
+
|
1347
|
+
# Mark a comment as unread
|
1348
|
+
def self.comment_mark_unread(project_id, key_id, id)
|
1349
|
+
path = sprintf("/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
|
1350
|
+
data_hash = {}
|
1351
|
+
post_body = nil
|
1352
|
+
|
1186
1353
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1187
|
-
rc, err = PhraseApp.send_request("
|
1354
|
+
rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
1188
1355
|
if err != nil
|
1189
1356
|
return nil, err
|
1190
1357
|
end
|
1191
1358
|
|
1192
|
-
return
|
1359
|
+
return err
|
1193
1360
|
end
|
1194
1361
|
|
1195
|
-
#
|
1196
|
-
def self.
|
1197
|
-
path = sprintf("/v2/projects/%s/
|
1362
|
+
# Get details on a single comment.
|
1363
|
+
def self.comment_show(project_id, key_id, id)
|
1364
|
+
path = sprintf("/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
|
1198
1365
|
data_hash = {}
|
1199
1366
|
post_body = nil
|
1200
1367
|
|
1201
1368
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1202
|
-
rc, err = PhraseApp.
|
1369
|
+
rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
|
1203
1370
|
if err != nil
|
1204
1371
|
return nil, err
|
1205
1372
|
end
|
1206
1373
|
|
1207
|
-
return JSON.load(rc.body)
|
1374
|
+
return PhraseApp::Comment.new(JSON.load(rc.body)), err
|
1208
1375
|
end
|
1209
1376
|
|
1210
|
-
#
|
1211
|
-
def self.
|
1212
|
-
path = sprintf("/v2/projects/%s/keys/%s/comments", project_id, key_id)
|
1377
|
+
# Update an existing comment.
|
1378
|
+
def self.comment_update(project_id, key_id, id, params)
|
1379
|
+
path = sprintf("/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
|
1213
1380
|
data_hash = {}
|
1214
1381
|
post_body = nil
|
1215
1382
|
|
1216
1383
|
if params.present?
|
1217
|
-
unless params.kind_of?(PhraseApp::
|
1218
|
-
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::
|
1384
|
+
unless params.kind_of?(PhraseApp::CommentUpdateParams)
|
1385
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::CommentUpdateParams")
|
1219
1386
|
end
|
1220
1387
|
end
|
1221
1388
|
|
@@ -1225,7 +1392,7 @@ class PhraseApp::Client
|
|
1225
1392
|
return nil, err
|
1226
1393
|
end
|
1227
1394
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1228
|
-
rc, err = PhraseApp.send_request("
|
1395
|
+
rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
1229
1396
|
if err != nil
|
1230
1397
|
return nil, err
|
1231
1398
|
end
|
@@ -1233,23 +1400,8 @@ class PhraseApp::Client
|
|
1233
1400
|
return PhraseApp::Comment.new(JSON.load(rc.body)), err
|
1234
1401
|
end
|
1235
1402
|
|
1236
|
-
# Delete an existing comment.
|
1237
|
-
def self.comment_delete(project_id, key_id, id)
|
1238
|
-
path = sprintf("/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
|
1239
|
-
data_hash = {}
|
1240
|
-
post_body = nil
|
1241
|
-
|
1242
|
-
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1243
|
-
rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
1244
|
-
if err != nil
|
1245
|
-
return nil, err
|
1246
|
-
end
|
1247
|
-
|
1248
|
-
return err
|
1249
|
-
end
|
1250
|
-
|
1251
1403
|
# List all comments for a key.
|
1252
|
-
def self.
|
1404
|
+
def self.comments_list(project_id, key_id, page, per_page)
|
1253
1405
|
path = sprintf("/v2/projects/%s/keys/%s/comments", project_id, key_id)
|
1254
1406
|
data_hash = {}
|
1255
1407
|
post_body = nil
|
@@ -1263,39 +1415,35 @@ class PhraseApp::Client
|
|
1263
1415
|
return JSON.load(rc.body).map { |item| PhraseApp::Comment.new(item) }, err
|
1264
1416
|
end
|
1265
1417
|
|
1266
|
-
#
|
1267
|
-
def self.
|
1268
|
-
path = sprintf("/v2/projects/%s/
|
1418
|
+
# Create a new blacklisted key.
|
1419
|
+
def self.exclude_rule_create(project_id, params)
|
1420
|
+
path = sprintf("/v2/projects/%s/blacklisted_keys", project_id)
|
1269
1421
|
data_hash = {}
|
1270
1422
|
post_body = nil
|
1271
1423
|
|
1272
|
-
|
1273
|
-
|
1424
|
+
if params.present?
|
1425
|
+
unless params.kind_of?(PhraseApp::ExcludeRuleCreateParams)
|
1426
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::ExcludeRuleCreateParams")
|
1427
|
+
end
|
1428
|
+
end
|
1429
|
+
|
1430
|
+
data_hash = params.to_h
|
1431
|
+
err = params.validate
|
1274
1432
|
if err != nil
|
1275
1433
|
return nil, err
|
1276
1434
|
end
|
1277
|
-
|
1278
|
-
return err
|
1279
|
-
end
|
1280
|
-
|
1281
|
-
# Mark a comment as read
|
1282
|
-
def self.comment_mark_read(project_id, key_id, id)
|
1283
|
-
path = sprintf("/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
|
1284
|
-
data_hash = {}
|
1285
|
-
post_body = nil
|
1286
|
-
|
1287
1435
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1288
|
-
rc, err = PhraseApp.send_request("
|
1436
|
+
rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
|
1289
1437
|
if err != nil
|
1290
1438
|
return nil, err
|
1291
1439
|
end
|
1292
1440
|
|
1293
|
-
return err
|
1441
|
+
return PhraseApp::BlacklistedKey.new(JSON.load(rc.body)), err
|
1294
1442
|
end
|
1295
1443
|
|
1296
|
-
#
|
1297
|
-
def self.
|
1298
|
-
path = sprintf("/v2/projects/%s/
|
1444
|
+
# Delete an existing blacklisted key.
|
1445
|
+
def self.exclude_rule_delete(project_id, id)
|
1446
|
+
path = sprintf("/v2/projects/%s/blacklisted_keys/%s", project_id, id)
|
1299
1447
|
data_hash = {}
|
1300
1448
|
post_body = nil
|
1301
1449
|
|
@@ -1308,9 +1456,9 @@ class PhraseApp::Client
|
|
1308
1456
|
return err
|
1309
1457
|
end
|
1310
1458
|
|
1311
|
-
# Get details on a single
|
1312
|
-
def self.
|
1313
|
-
path = sprintf("/v2/projects/%s/
|
1459
|
+
# Get details on a single blacklisted key for a given project.
|
1460
|
+
def self.exclude_rule_show(project_id, id)
|
1461
|
+
path = sprintf("/v2/projects/%s/blacklisted_keys/%s", project_id, id)
|
1314
1462
|
data_hash = {}
|
1315
1463
|
post_body = nil
|
1316
1464
|
|
@@ -1320,18 +1468,18 @@ class PhraseApp::Client
|
|
1320
1468
|
return nil, err
|
1321
1469
|
end
|
1322
1470
|
|
1323
|
-
return PhraseApp::
|
1471
|
+
return PhraseApp::BlacklistedKey.new(JSON.load(rc.body)), err
|
1324
1472
|
end
|
1325
1473
|
|
1326
|
-
# Update an existing
|
1327
|
-
def self.
|
1328
|
-
path = sprintf("/v2/projects/%s/
|
1474
|
+
# Update an existing blacklisted key.
|
1475
|
+
def self.exclude_rule_update(project_id, id, params)
|
1476
|
+
path = sprintf("/v2/projects/%s/blacklisted_keys/%s", project_id, id)
|
1329
1477
|
data_hash = {}
|
1330
1478
|
post_body = nil
|
1331
1479
|
|
1332
1480
|
if params.present?
|
1333
|
-
unless params.kind_of?(PhraseApp::
|
1334
|
-
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::
|
1481
|
+
unless params.kind_of?(PhraseApp::ExcludeRuleUpdateParams)
|
1482
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::ExcludeRuleUpdateParams")
|
1335
1483
|
end
|
1336
1484
|
end
|
1337
1485
|
|
@@ -1346,7 +1494,22 @@ class PhraseApp::Client
|
|
1346
1494
|
return nil, err
|
1347
1495
|
end
|
1348
1496
|
|
1349
|
-
return PhraseApp::
|
1497
|
+
return PhraseApp::BlacklistedKey.new(JSON.load(rc.body)), err
|
1498
|
+
end
|
1499
|
+
|
1500
|
+
# List all blacklisted keys for the given project.
|
1501
|
+
def self.exclude_rules_index(project_id, page, per_page)
|
1502
|
+
path = sprintf("/v2/projects/%s/blacklisted_keys", project_id)
|
1503
|
+
data_hash = {}
|
1504
|
+
post_body = nil
|
1505
|
+
|
1506
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1507
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1508
|
+
if err != nil
|
1509
|
+
return nil, err
|
1510
|
+
end
|
1511
|
+
|
1512
|
+
return JSON.load(rc.body).map { |item| PhraseApp::BlacklistedKey.new(item) }, err
|
1350
1513
|
end
|
1351
1514
|
|
1352
1515
|
# Get a handy list of all localization file formats supported in PhraseApp.
|
@@ -1383,8 +1546,12 @@ class PhraseApp::Client
|
|
1383
1546
|
data_hash["description"] = params.description
|
1384
1547
|
end
|
1385
1548
|
|
1386
|
-
if params.
|
1387
|
-
data_hash["
|
1549
|
+
if params.localized_format_key != nil
|
1550
|
+
data_hash["localized_format_key"] = params.localized_format_key
|
1551
|
+
end
|
1552
|
+
|
1553
|
+
if params.localized_format_string != nil
|
1554
|
+
data_hash["localized_format_string"] = params.localized_format_string
|
1388
1555
|
end
|
1389
1556
|
|
1390
1557
|
if params.max_characters_allowed != nil
|
@@ -1459,32 +1626,6 @@ class PhraseApp::Client
|
|
1459
1626
|
return err
|
1460
1627
|
end
|
1461
1628
|
|
1462
|
-
# List all keys for the given project.
|
1463
|
-
def self.key_list(project_id, page, per_page, params)
|
1464
|
-
path = sprintf("/v2/projects/%s/keys", project_id)
|
1465
|
-
data_hash = {}
|
1466
|
-
post_body = nil
|
1467
|
-
|
1468
|
-
if params.present?
|
1469
|
-
unless params.kind_of?(PhraseApp::KeyListParams)
|
1470
|
-
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeyListParams")
|
1471
|
-
end
|
1472
|
-
end
|
1473
|
-
|
1474
|
-
data_hash = params.to_h
|
1475
|
-
err = params.validate
|
1476
|
-
if err != nil
|
1477
|
-
return nil, err
|
1478
|
-
end
|
1479
|
-
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1480
|
-
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1481
|
-
if err != nil
|
1482
|
-
return nil, err
|
1483
|
-
end
|
1484
|
-
|
1485
|
-
return JSON.load(rc.body).map { |item| PhraseApp::TranslationKey.new(item) }, err
|
1486
|
-
end
|
1487
|
-
|
1488
1629
|
# Get details on a single key for a given project.
|
1489
1630
|
def self.key_show(project_id, id)
|
1490
1631
|
path = sprintf("/v2/projects/%s/keys/%s", project_id, id)
|
@@ -1519,8 +1660,12 @@ class PhraseApp::Client
|
|
1519
1660
|
data_hash["description"] = params.description
|
1520
1661
|
end
|
1521
1662
|
|
1522
|
-
if params.
|
1523
|
-
data_hash["
|
1663
|
+
if params.localized_format_key != nil
|
1664
|
+
data_hash["localized_format_key"] = params.localized_format_key
|
1665
|
+
end
|
1666
|
+
|
1667
|
+
if params.localized_format_string != nil
|
1668
|
+
data_hash["localized_format_string"] = params.localized_format_string
|
1524
1669
|
end
|
1525
1670
|
|
1526
1671
|
if params.max_characters_allowed != nil
|
@@ -1580,6 +1725,136 @@ class PhraseApp::Client
|
|
1580
1725
|
return PhraseApp::TranslationKeyDetails.new(JSON.load(rc.body)), err
|
1581
1726
|
end
|
1582
1727
|
|
1728
|
+
# Delete all keys matching query. Same constraints as list.
|
1729
|
+
def self.keys_delete(project_id, params)
|
1730
|
+
path = sprintf("/v2/projects/%s/keys", project_id)
|
1731
|
+
data_hash = {}
|
1732
|
+
post_body = nil
|
1733
|
+
|
1734
|
+
if params.present?
|
1735
|
+
unless params.kind_of?(PhraseApp::KeysDeleteParams)
|
1736
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeysDeleteParams")
|
1737
|
+
end
|
1738
|
+
end
|
1739
|
+
|
1740
|
+
data_hash = params.to_h
|
1741
|
+
err = params.validate
|
1742
|
+
if err != nil
|
1743
|
+
return nil, err
|
1744
|
+
end
|
1745
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1746
|
+
rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
1747
|
+
if err != nil
|
1748
|
+
return nil, err
|
1749
|
+
end
|
1750
|
+
|
1751
|
+
return err
|
1752
|
+
end
|
1753
|
+
|
1754
|
+
# List all keys for the given project. Alternatively you can POST requests to /search.
|
1755
|
+
def self.keys_list(project_id, page, per_page, params)
|
1756
|
+
path = sprintf("/v2/projects/%s/keys", project_id)
|
1757
|
+
data_hash = {}
|
1758
|
+
post_body = nil
|
1759
|
+
|
1760
|
+
if params.present?
|
1761
|
+
unless params.kind_of?(PhraseApp::KeysListParams)
|
1762
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeysListParams")
|
1763
|
+
end
|
1764
|
+
end
|
1765
|
+
|
1766
|
+
data_hash = params.to_h
|
1767
|
+
err = params.validate
|
1768
|
+
if err != nil
|
1769
|
+
return nil, err
|
1770
|
+
end
|
1771
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1772
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1773
|
+
if err != nil
|
1774
|
+
return nil, err
|
1775
|
+
end
|
1776
|
+
|
1777
|
+
return JSON.load(rc.body).map { |item| PhraseApp::TranslationKey.new(item) }, err
|
1778
|
+
end
|
1779
|
+
|
1780
|
+
# List all keys for the given project matching query.
|
1781
|
+
def self.keys_search(project_id, page, per_page, params)
|
1782
|
+
path = sprintf("/v2/projects/%s/keys/search", project_id)
|
1783
|
+
data_hash = {}
|
1784
|
+
post_body = nil
|
1785
|
+
|
1786
|
+
if params.present?
|
1787
|
+
unless params.kind_of?(PhraseApp::KeysSearchParams)
|
1788
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeysSearchParams")
|
1789
|
+
end
|
1790
|
+
end
|
1791
|
+
|
1792
|
+
data_hash = params.to_h
|
1793
|
+
err = params.validate
|
1794
|
+
if err != nil
|
1795
|
+
return nil, err
|
1796
|
+
end
|
1797
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1798
|
+
rc, err = PhraseApp.send_request_paginated("POST", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1799
|
+
if err != nil
|
1800
|
+
return nil, err
|
1801
|
+
end
|
1802
|
+
|
1803
|
+
return JSON.load(rc.body).map { |item| PhraseApp::TranslationKey.new(item) }, err
|
1804
|
+
end
|
1805
|
+
|
1806
|
+
# Tags all keys matching query. Same constraints as list.
|
1807
|
+
def self.keys_tag(project_id, params)
|
1808
|
+
path = sprintf("/v2/projects/%s/keys/tag", project_id)
|
1809
|
+
data_hash = {}
|
1810
|
+
post_body = nil
|
1811
|
+
|
1812
|
+
if params.present?
|
1813
|
+
unless params.kind_of?(PhraseApp::KeysTagParams)
|
1814
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeysTagParams")
|
1815
|
+
end
|
1816
|
+
end
|
1817
|
+
|
1818
|
+
data_hash = params.to_h
|
1819
|
+
err = params.validate
|
1820
|
+
if err != nil
|
1821
|
+
return nil, err
|
1822
|
+
end
|
1823
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1824
|
+
rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 204)
|
1825
|
+
if err != nil
|
1826
|
+
return nil, err
|
1827
|
+
end
|
1828
|
+
|
1829
|
+
return err
|
1830
|
+
end
|
1831
|
+
|
1832
|
+
# Removes specified tags from keys matching query.
|
1833
|
+
def self.keys_untag(project_id, params)
|
1834
|
+
path = sprintf("/v2/projects/%s/keys/tag", project_id)
|
1835
|
+
data_hash = {}
|
1836
|
+
post_body = nil
|
1837
|
+
|
1838
|
+
if params.present?
|
1839
|
+
unless params.kind_of?(PhraseApp::KeysUntagParams)
|
1840
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::KeysUntagParams")
|
1841
|
+
end
|
1842
|
+
end
|
1843
|
+
|
1844
|
+
data_hash = params.to_h
|
1845
|
+
err = params.validate
|
1846
|
+
if err != nil
|
1847
|
+
return nil, err
|
1848
|
+
end
|
1849
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1850
|
+
rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
|
1851
|
+
if err != nil
|
1852
|
+
return nil, err
|
1853
|
+
end
|
1854
|
+
|
1855
|
+
return err
|
1856
|
+
end
|
1857
|
+
|
1583
1858
|
# Create a new locale.
|
1584
1859
|
def self.locale_create(project_id, params)
|
1585
1860
|
path = sprintf("/v2/projects/%s/locales", project_id)
|
@@ -1643,23 +1918,8 @@ class PhraseApp::Client
|
|
1643
1918
|
if err != nil
|
1644
1919
|
return nil, err
|
1645
1920
|
end
|
1646
|
-
return rc.body
|
1647
|
-
return err
|
1648
|
-
end
|
1649
|
-
|
1650
|
-
# List all locales for the given project.
|
1651
|
-
def self.locale_list(project_id, page, per_page)
|
1652
|
-
path = sprintf("/v2/projects/%s/locales", project_id)
|
1653
|
-
data_hash = {}
|
1654
|
-
post_body = nil
|
1655
|
-
|
1656
|
-
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1657
|
-
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1658
|
-
if err != nil
|
1659
|
-
return nil, err
|
1660
|
-
end
|
1661
|
-
|
1662
|
-
return JSON.load(rc.body).map { |item| PhraseApp::Locale.new(item) }, err
|
1921
|
+
return rc.body
|
1922
|
+
return err
|
1663
1923
|
end
|
1664
1924
|
|
1665
1925
|
# Get details on a single locale for a given project.
|
@@ -1703,7 +1963,22 @@ class PhraseApp::Client
|
|
1703
1963
|
return PhraseApp::LocaleDetails.new(JSON.load(rc.body)), err
|
1704
1964
|
end
|
1705
1965
|
|
1706
|
-
#
|
1966
|
+
# List all locales for the given project.
|
1967
|
+
def self.locales_list(project_id, page, per_page)
|
1968
|
+
path = sprintf("/v2/projects/%s/locales", project_id)
|
1969
|
+
data_hash = {}
|
1970
|
+
post_body = nil
|
1971
|
+
|
1972
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1973
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1974
|
+
if err != nil
|
1975
|
+
return nil, err
|
1976
|
+
end
|
1977
|
+
|
1978
|
+
return JSON.load(rc.body).map { |item| PhraseApp::Locale.new(item) }, err
|
1979
|
+
end
|
1980
|
+
|
1981
|
+
# Confirm an existing order and send it to the provider for translation. Same constraints as for create.
|
1707
1982
|
def self.order_confirm(project_id, id)
|
1708
1983
|
path = sprintf("/v2/projects/%s/orders/%s/confirm", project_id, id)
|
1709
1984
|
data_hash = {}
|
@@ -1718,7 +1993,7 @@ class PhraseApp::Client
|
|
1718
1993
|
return PhraseApp::TranslationOrder.new(JSON.load(rc.body)), err
|
1719
1994
|
end
|
1720
1995
|
|
1721
|
-
# Create a new order.
|
1996
|
+
# Create a new order. Access token scope must include <code>orders.create</code>.
|
1722
1997
|
def self.order_create(project_id, params)
|
1723
1998
|
path = sprintf("/v2/projects/%s/orders", project_id)
|
1724
1999
|
data_hash = {}
|
@@ -1759,34 +2034,34 @@ class PhraseApp::Client
|
|
1759
2034
|
return err
|
1760
2035
|
end
|
1761
2036
|
|
1762
|
-
#
|
1763
|
-
def self.
|
1764
|
-
path = sprintf("/v2/projects/%s/orders", project_id)
|
2037
|
+
# Get details on a single order.
|
2038
|
+
def self.order_show(project_id, id)
|
2039
|
+
path = sprintf("/v2/projects/%s/orders/%s", project_id, id)
|
1765
2040
|
data_hash = {}
|
1766
2041
|
post_body = nil
|
1767
2042
|
|
1768
2043
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1769
|
-
rc, err = PhraseApp.
|
2044
|
+
rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
|
1770
2045
|
if err != nil
|
1771
2046
|
return nil, err
|
1772
2047
|
end
|
1773
2048
|
|
1774
|
-
return JSON.load(rc.body)
|
2049
|
+
return PhraseApp::TranslationOrder.new(JSON.load(rc.body)), err
|
1775
2050
|
end
|
1776
2051
|
|
1777
|
-
#
|
1778
|
-
def self.
|
1779
|
-
path = sprintf("/v2/projects/%s/orders
|
2052
|
+
# List all orders for the given project.
|
2053
|
+
def self.orders_list(project_id, page, per_page)
|
2054
|
+
path = sprintf("/v2/projects/%s/orders", project_id)
|
1780
2055
|
data_hash = {}
|
1781
2056
|
post_body = nil
|
1782
2057
|
|
1783
2058
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1784
|
-
rc, err = PhraseApp.
|
2059
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1785
2060
|
if err != nil
|
1786
2061
|
return nil, err
|
1787
2062
|
end
|
1788
2063
|
|
1789
|
-
return
|
2064
|
+
return JSON.load(rc.body).map { |item| PhraseApp::TranslationOrder.new(item) }, err
|
1790
2065
|
end
|
1791
2066
|
|
1792
2067
|
# Create a new project.
|
@@ -1830,21 +2105,6 @@ class PhraseApp::Client
|
|
1830
2105
|
return err
|
1831
2106
|
end
|
1832
2107
|
|
1833
|
-
# List all projects the current user has access to.
|
1834
|
-
def self.project_list(page, per_page)
|
1835
|
-
path = sprintf("/v2/projects")
|
1836
|
-
data_hash = {}
|
1837
|
-
post_body = nil
|
1838
|
-
|
1839
|
-
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1840
|
-
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1841
|
-
if err != nil
|
1842
|
-
return nil, err
|
1843
|
-
end
|
1844
|
-
|
1845
|
-
return JSON.load(rc.body).map { |item| PhraseApp::Project.new(item) }, err
|
1846
|
-
end
|
1847
|
-
|
1848
2108
|
# Get details on a single project.
|
1849
2109
|
def self.project_show(id)
|
1850
2110
|
path = sprintf("/v2/projects/%s", id)
|
@@ -1886,6 +2146,21 @@ class PhraseApp::Client
|
|
1886
2146
|
return PhraseApp::ProjectDetails.new(JSON.load(rc.body)), err
|
1887
2147
|
end
|
1888
2148
|
|
2149
|
+
# List all projects the current user has access to.
|
2150
|
+
def self.projects_list(page, per_page)
|
2151
|
+
path = sprintf("/v2/projects")
|
2152
|
+
data_hash = {}
|
2153
|
+
post_body = nil
|
2154
|
+
|
2155
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2156
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
2157
|
+
if err != nil
|
2158
|
+
return nil, err
|
2159
|
+
end
|
2160
|
+
|
2161
|
+
return JSON.load(rc.body).map { |item| PhraseApp::Project.new(item) }, err
|
2162
|
+
end
|
2163
|
+
|
1889
2164
|
# Show details for current User.
|
1890
2165
|
def self.show_user()
|
1891
2166
|
path = sprintf("/v2/user")
|
@@ -1942,21 +2217,6 @@ class PhraseApp::Client
|
|
1942
2217
|
return err
|
1943
2218
|
end
|
1944
2219
|
|
1945
|
-
# List all styleguides for the given project.
|
1946
|
-
def self.styleguide_list(project_id, page, per_page)
|
1947
|
-
path = sprintf("/v2/projects/%s/styleguides", project_id)
|
1948
|
-
data_hash = {}
|
1949
|
-
post_body = nil
|
1950
|
-
|
1951
|
-
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
1952
|
-
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
1953
|
-
if err != nil
|
1954
|
-
return nil, err
|
1955
|
-
end
|
1956
|
-
|
1957
|
-
return JSON.load(rc.body).map { |item| PhraseApp::Styleguide.new(item) }, err
|
1958
|
-
end
|
1959
|
-
|
1960
2220
|
# Get details on a single style guide.
|
1961
2221
|
def self.styleguide_show(project_id, id)
|
1962
2222
|
path = sprintf("/v2/projects/%s/styleguides/%s", project_id, id)
|
@@ -1998,6 +2258,21 @@ class PhraseApp::Client
|
|
1998
2258
|
return PhraseApp::StyleguideDetails.new(JSON.load(rc.body)), err
|
1999
2259
|
end
|
2000
2260
|
|
2261
|
+
# List all styleguides for the given project.
|
2262
|
+
def self.styleguides_list(project_id, page, per_page)
|
2263
|
+
path = sprintf("/v2/projects/%s/styleguides", project_id)
|
2264
|
+
data_hash = {}
|
2265
|
+
post_body = nil
|
2266
|
+
|
2267
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2268
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
2269
|
+
if err != nil
|
2270
|
+
return nil, err
|
2271
|
+
end
|
2272
|
+
|
2273
|
+
return JSON.load(rc.body).map { |item| PhraseApp::Styleguide.new(item) }, err
|
2274
|
+
end
|
2275
|
+
|
2001
2276
|
# Create a new tag.
|
2002
2277
|
def self.tag_create(project_id, params)
|
2003
2278
|
path = sprintf("/v2/projects/%s/tags", project_id)
|
@@ -2039,34 +2314,34 @@ class PhraseApp::Client
|
|
2039
2314
|
return err
|
2040
2315
|
end
|
2041
2316
|
|
2042
|
-
#
|
2043
|
-
def self.
|
2044
|
-
path = sprintf("/v2/projects/%s/tags", project_id)
|
2317
|
+
# Get details and progress information on a single tag for a given project.
|
2318
|
+
def self.tag_show(project_id, name)
|
2319
|
+
path = sprintf("/v2/projects/%s/tags/%s", project_id, name)
|
2045
2320
|
data_hash = {}
|
2046
2321
|
post_body = nil
|
2047
2322
|
|
2048
2323
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2049
|
-
rc, err = PhraseApp.
|
2324
|
+
rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
|
2050
2325
|
if err != nil
|
2051
2326
|
return nil, err
|
2052
2327
|
end
|
2053
2328
|
|
2054
|
-
return JSON.load(rc.body)
|
2329
|
+
return PhraseApp::TagWithStats.new(JSON.load(rc.body)), err
|
2055
2330
|
end
|
2056
2331
|
|
2057
|
-
#
|
2058
|
-
def self.
|
2059
|
-
path = sprintf("/v2/projects/%s/tags
|
2332
|
+
# List all tags for the given project.
|
2333
|
+
def self.tags_list(project_id, page, per_page)
|
2334
|
+
path = sprintf("/v2/projects/%s/tags", project_id)
|
2060
2335
|
data_hash = {}
|
2061
2336
|
post_body = nil
|
2062
2337
|
|
2063
2338
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2064
|
-
rc, err = PhraseApp.
|
2339
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
2065
2340
|
if err != nil
|
2066
2341
|
return nil, err
|
2067
2342
|
end
|
2068
2343
|
|
2069
|
-
return
|
2344
|
+
return JSON.load(rc.body).map { |item| PhraseApp::Tag.new(item) }, err
|
2070
2345
|
end
|
2071
2346
|
|
2072
2347
|
# Create a translation.
|
@@ -2095,15 +2370,30 @@ class PhraseApp::Client
|
|
2095
2370
|
return PhraseApp::TranslationDetails.new(JSON.load(rc.body)), err
|
2096
2371
|
end
|
2097
2372
|
|
2098
|
-
#
|
2099
|
-
def self.
|
2100
|
-
path = sprintf("/v2/projects/%s/translations", project_id)
|
2373
|
+
# Get details on a single translation.
|
2374
|
+
def self.translation_show(project_id, id)
|
2375
|
+
path = sprintf("/v2/projects/%s/translations/%s", project_id, id)
|
2376
|
+
data_hash = {}
|
2377
|
+
post_body = nil
|
2378
|
+
|
2379
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2380
|
+
rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
|
2381
|
+
if err != nil
|
2382
|
+
return nil, err
|
2383
|
+
end
|
2384
|
+
|
2385
|
+
return PhraseApp::TranslationDetails.new(JSON.load(rc.body)), err
|
2386
|
+
end
|
2387
|
+
|
2388
|
+
# Update an existing translation.
|
2389
|
+
def self.translation_update(project_id, id, params)
|
2390
|
+
path = sprintf("/v2/projects/%s/translations/%s", project_id, id)
|
2101
2391
|
data_hash = {}
|
2102
2392
|
post_body = nil
|
2103
2393
|
|
2104
2394
|
if params.present?
|
2105
|
-
unless params.kind_of?(PhraseApp::
|
2106
|
-
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::
|
2395
|
+
unless params.kind_of?(PhraseApp::TranslationUpdateParams)
|
2396
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationUpdateParams")
|
2107
2397
|
end
|
2108
2398
|
end
|
2109
2399
|
|
@@ -2113,23 +2403,23 @@ class PhraseApp::Client
|
|
2113
2403
|
return nil, err
|
2114
2404
|
end
|
2115
2405
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2116
|
-
rc, err = PhraseApp.
|
2406
|
+
rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
2117
2407
|
if err != nil
|
2118
2408
|
return nil, err
|
2119
2409
|
end
|
2120
2410
|
|
2121
|
-
return JSON.load(rc.body)
|
2411
|
+
return PhraseApp::TranslationDetails.new(JSON.load(rc.body)), err
|
2122
2412
|
end
|
2123
2413
|
|
2124
2414
|
# List translations for a specific key.
|
2125
|
-
def self.
|
2415
|
+
def self.translations_by_key(project_id, key_id, page, per_page, params)
|
2126
2416
|
path = sprintf("/v2/projects/%s/keys/%s/translations", project_id, key_id)
|
2127
2417
|
data_hash = {}
|
2128
2418
|
post_body = nil
|
2129
2419
|
|
2130
2420
|
if params.present?
|
2131
|
-
unless params.kind_of?(PhraseApp::
|
2132
|
-
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::
|
2421
|
+
unless params.kind_of?(PhraseApp::TranslationsByKeyParams)
|
2422
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationsByKeyParams")
|
2133
2423
|
end
|
2134
2424
|
end
|
2135
2425
|
|
@@ -2148,14 +2438,14 @@ class PhraseApp::Client
|
|
2148
2438
|
end
|
2149
2439
|
|
2150
2440
|
# List translations for a specific locale.
|
2151
|
-
def self.
|
2441
|
+
def self.translations_by_locale(project_id, locale_id, page, per_page, params)
|
2152
2442
|
path = sprintf("/v2/projects/%s/locales/%s/translations", project_id, locale_id)
|
2153
2443
|
data_hash = {}
|
2154
2444
|
post_body = nil
|
2155
2445
|
|
2156
2446
|
if params.present?
|
2157
|
-
unless params.kind_of?(PhraseApp::
|
2158
|
-
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::
|
2447
|
+
unless params.kind_of?(PhraseApp::TranslationsByLocaleParams)
|
2448
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationsByLocaleParams")
|
2159
2449
|
end
|
2160
2450
|
end
|
2161
2451
|
|
@@ -2173,30 +2463,41 @@ class PhraseApp::Client
|
|
2173
2463
|
return JSON.load(rc.body).map { |item| PhraseApp::Translation.new(item) }, err
|
2174
2464
|
end
|
2175
2465
|
|
2176
|
-
#
|
2177
|
-
def self.
|
2178
|
-
path = sprintf("/v2/projects/%s/translations
|
2466
|
+
# Exclude translations matching query from locale export.
|
2467
|
+
def self.translations_exclude(project_id, params)
|
2468
|
+
path = sprintf("/v2/projects/%s/translations/exclude", project_id)
|
2179
2469
|
data_hash = {}
|
2180
2470
|
post_body = nil
|
2181
2471
|
|
2472
|
+
if params.present?
|
2473
|
+
unless params.kind_of?(PhraseApp::TranslationsExcludeParams)
|
2474
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationsExcludeParams")
|
2475
|
+
end
|
2476
|
+
end
|
2477
|
+
|
2478
|
+
data_hash = params.to_h
|
2479
|
+
err = params.validate
|
2480
|
+
if err != nil
|
2481
|
+
return nil, err
|
2482
|
+
end
|
2182
2483
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2183
|
-
rc, err = PhraseApp.send_request("
|
2484
|
+
rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
2184
2485
|
if err != nil
|
2185
2486
|
return nil, err
|
2186
2487
|
end
|
2187
2488
|
|
2188
|
-
return PhraseApp::
|
2489
|
+
return PhraseApp::AffectedCount.new(JSON.load(rc.body)), err
|
2189
2490
|
end
|
2190
2491
|
|
2191
|
-
#
|
2192
|
-
def self.
|
2193
|
-
path = sprintf("/v2/projects/%s/translations
|
2492
|
+
# Include translations matching query in locale export
|
2493
|
+
def self.translations_include(project_id, params)
|
2494
|
+
path = sprintf("/v2/projects/%s/translations/include", project_id)
|
2194
2495
|
data_hash = {}
|
2195
2496
|
post_body = nil
|
2196
2497
|
|
2197
2498
|
if params.present?
|
2198
|
-
unless params.kind_of?(PhraseApp::
|
2199
|
-
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::
|
2499
|
+
unless params.kind_of?(PhraseApp::TranslationsIncludeParams)
|
2500
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationsIncludeParams")
|
2200
2501
|
end
|
2201
2502
|
end
|
2202
2503
|
|
@@ -2211,10 +2512,114 @@ class PhraseApp::Client
|
|
2211
2512
|
return nil, err
|
2212
2513
|
end
|
2213
2514
|
|
2214
|
-
return PhraseApp::
|
2515
|
+
return PhraseApp::AffectedCount.new(JSON.load(rc.body)), err
|
2516
|
+
end
|
2517
|
+
|
2518
|
+
# List translations for the given project. Alternatively, POST request to /search
|
2519
|
+
def self.translations_list(project_id, page, per_page, params)
|
2520
|
+
path = sprintf("/v2/projects/%s/translations", project_id)
|
2521
|
+
data_hash = {}
|
2522
|
+
post_body = nil
|
2523
|
+
|
2524
|
+
if params.present?
|
2525
|
+
unless params.kind_of?(PhraseApp::TranslationsListParams)
|
2526
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationsListParams")
|
2527
|
+
end
|
2528
|
+
end
|
2529
|
+
|
2530
|
+
data_hash = params.to_h
|
2531
|
+
err = params.validate
|
2532
|
+
if err != nil
|
2533
|
+
return nil, err
|
2534
|
+
end
|
2535
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2536
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
2537
|
+
if err != nil
|
2538
|
+
return nil, err
|
2539
|
+
end
|
2540
|
+
|
2541
|
+
return JSON.load(rc.body).map { |item| PhraseApp::Translation.new(item) }, err
|
2542
|
+
end
|
2543
|
+
|
2544
|
+
# List translations for the given project if you exceed GET request limitations on translations list.
|
2545
|
+
def self.translations_search(project_id, page, per_page, params)
|
2546
|
+
path = sprintf("/v2/projects/%s/translations/search", project_id)
|
2547
|
+
data_hash = {}
|
2548
|
+
post_body = nil
|
2549
|
+
|
2550
|
+
if params.present?
|
2551
|
+
unless params.kind_of?(PhraseApp::TranslationsSearchParams)
|
2552
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationsSearchParams")
|
2553
|
+
end
|
2554
|
+
end
|
2555
|
+
|
2556
|
+
data_hash = params.to_h
|
2557
|
+
err = params.validate
|
2558
|
+
if err != nil
|
2559
|
+
return nil, err
|
2560
|
+
end
|
2561
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2562
|
+
rc, err = PhraseApp.send_request_paginated("POST", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
2563
|
+
if err != nil
|
2564
|
+
return nil, err
|
2565
|
+
end
|
2566
|
+
|
2567
|
+
return JSON.load(rc.body).map { |item| PhraseApp::Translation.new(item) }, err
|
2568
|
+
end
|
2569
|
+
|
2570
|
+
# Mark translations matching query as unverified
|
2571
|
+
def self.translations_unverify(project_id, params)
|
2572
|
+
path = sprintf("/v2/projects/%s/translations/unverify", project_id)
|
2573
|
+
data_hash = {}
|
2574
|
+
post_body = nil
|
2575
|
+
|
2576
|
+
if params.present?
|
2577
|
+
unless params.kind_of?(PhraseApp::TranslationsUnverifyParams)
|
2578
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationsUnverifyParams")
|
2579
|
+
end
|
2580
|
+
end
|
2581
|
+
|
2582
|
+
data_hash = params.to_h
|
2583
|
+
err = params.validate
|
2584
|
+
if err != nil
|
2585
|
+
return nil, err
|
2586
|
+
end
|
2587
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2588
|
+
rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
2589
|
+
if err != nil
|
2590
|
+
return nil, err
|
2591
|
+
end
|
2592
|
+
|
2593
|
+
return PhraseApp::AffectedCount.new(JSON.load(rc.body)), err
|
2594
|
+
end
|
2595
|
+
|
2596
|
+
# Verify translations matching query.
|
2597
|
+
def self.translations_verify(project_id, params)
|
2598
|
+
path = sprintf("/v2/projects/%s/translations/verify", project_id)
|
2599
|
+
data_hash = {}
|
2600
|
+
post_body = nil
|
2601
|
+
|
2602
|
+
if params.present?
|
2603
|
+
unless params.kind_of?(PhraseApp::TranslationsVerifyParams)
|
2604
|
+
raise PhraseApp::ParamsError.new("Expected params to be kind_of PhraseApp::TranslationsVerifyParams")
|
2605
|
+
end
|
2606
|
+
end
|
2607
|
+
|
2608
|
+
data_hash = params.to_h
|
2609
|
+
err = params.validate
|
2610
|
+
if err != nil
|
2611
|
+
return nil, err
|
2612
|
+
end
|
2613
|
+
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2614
|
+
rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
|
2615
|
+
if err != nil
|
2616
|
+
return nil, err
|
2617
|
+
end
|
2618
|
+
|
2619
|
+
return PhraseApp::AffectedCount.new(JSON.load(rc.body)), err
|
2215
2620
|
end
|
2216
2621
|
|
2217
|
-
# Upload a new file
|
2622
|
+
# Upload a new language file. Creates necessary resources in your project.
|
2218
2623
|
def self.upload_create(project_id, params)
|
2219
2624
|
path = sprintf("/v2/projects/%s/uploads", project_id)
|
2220
2625
|
data_hash = {}
|
@@ -2239,8 +2644,8 @@ class PhraseApp::Client
|
|
2239
2644
|
post_body << "\r\n"
|
2240
2645
|
end
|
2241
2646
|
|
2242
|
-
if params.
|
2243
|
-
data_hash["
|
2647
|
+
if params.file_format != nil
|
2648
|
+
data_hash["file_format"] = params.file_format
|
2244
2649
|
end
|
2245
2650
|
|
2246
2651
|
if params.format_options != nil
|
@@ -2295,34 +2700,34 @@ class PhraseApp::Client
|
|
2295
2700
|
return PhraseApp::LocaleFileImportWithSummary.new(JSON.load(rc.body)), err
|
2296
2701
|
end
|
2297
2702
|
|
2298
|
-
#
|
2299
|
-
def self.
|
2300
|
-
path = sprintf("/v2/projects/%s/translations/%s/versions", project_id, translation_id)
|
2703
|
+
# Get details on a single version.
|
2704
|
+
def self.version_show(project_id, translation_id, id)
|
2705
|
+
path = sprintf("/v2/projects/%s/translations/%s/versions/%s", project_id, translation_id, id)
|
2301
2706
|
data_hash = {}
|
2302
2707
|
post_body = nil
|
2303
2708
|
|
2304
2709
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2305
|
-
rc, err = PhraseApp.
|
2710
|
+
rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
|
2306
2711
|
if err != nil
|
2307
2712
|
return nil, err
|
2308
2713
|
end
|
2309
2714
|
|
2310
|
-
return JSON.load(rc.body)
|
2715
|
+
return PhraseApp::TranslationVersionWithUser.new(JSON.load(rc.body)), err
|
2311
2716
|
end
|
2312
2717
|
|
2313
|
-
#
|
2314
|
-
def self.
|
2315
|
-
path = sprintf("/v2/projects/%s/translations/%s/versions
|
2718
|
+
# List all versions for the given translation.
|
2719
|
+
def self.versions_list(project_id, translation_id, page, per_page)
|
2720
|
+
path = sprintf("/v2/projects/%s/translations/%s/versions", project_id, translation_id)
|
2316
2721
|
data_hash = {}
|
2317
2722
|
post_body = nil
|
2318
2723
|
|
2319
2724
|
reqHelper = PhraseApp::RequestHelper.new(data_hash, post_body)
|
2320
|
-
rc, err = PhraseApp.
|
2725
|
+
rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
|
2321
2726
|
if err != nil
|
2322
2727
|
return nil, err
|
2323
2728
|
end
|
2324
2729
|
|
2325
|
-
return
|
2730
|
+
return JSON.load(rc.body).map { |item| PhraseApp::TranslationVersion.new(item) }, err
|
2326
2731
|
end
|
2327
2732
|
|
2328
2733
|
end
|