phraseapp-ruby 1.0.21 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3487e16b4afe3dd5b2f6026b1d57a000f30db2b
4
- data.tar.gz: 4d16074811c653844466ca081db5a935db305443
3
+ metadata.gz: 4693d63beeadb110dff0fad3c510818c103e921a
4
+ data.tar.gz: 1ba5f0592bef31b482a76616346bad8c3085dbaf
5
5
  SHA512:
6
- metadata.gz: 38bef50daa4f254ca90a74761c818727feb886461d02cef1239b5fcbc21dff4750a8f1cd190d4ca18d1a6011f763b3fdc395bc2b6e6952833399e310b4fc866d
7
- data.tar.gz: a3eaa8fa580fd8be29693bb5928b5977a7af4f4b611ed5d91cb246e7e96d7e95dd173ecf7db99814dc53d51356f263fe652daae4fb254cf1f715a87bf5bb45c1
6
+ metadata.gz: 0a2499036b2e66549544433090120002ba45ca39ac92d13dafa702004468bba7172019550def2b4e7d0a319e2e2cc17dc65f6d8db023293ce8b467688dbf00b4
7
+ data.tar.gz: 57b77794544dd43bf5c91989530b81f2f0577ace6fc1a088392f96b20712053420eb2c939961031117609402e75b0543b1e2a52c36aa4dcf37fb020c962ec508
data/lib/auth.rb CHANGED
@@ -5,115 +5,85 @@ module PhraseApp
5
5
  module Auth
6
6
 
7
7
  # See PhraseApp::Client for usage example
8
- class AuthHandler < OpenStruct
8
+ class Credentials < OpenStruct
9
+ def initialize(hash={})
10
+ super(hash)
11
+ @host ||= hash.fetch(:host, PhraseApp::URL)
12
+ end
13
+
14
+ def host
15
+ @host
16
+ end
17
+
9
18
  def validate
10
- if self.username == "" && self.token == ""
19
+ if self.username.to_s == "" && self.token.to_s == ""
11
20
  return raise("either username or token must be given")
12
21
  else
13
22
  return nil
14
23
  end
15
24
  end
16
25
 
17
- private
18
- def load_config
19
- path = self.config
20
- tmpA = AuthHandler.new
26
+ def authenticate(req)
27
+ if err = load_config
28
+ return err
29
+ end
21
30
 
22
- puts path
31
+ if err = validate
32
+ return err
33
+ end
34
+
35
+ if self.token && self.token != ""
36
+ req["Authorization"] = "token #{self.token}"
37
+ elsif self.username && self.username != ""
38
+ req.basic_auth(self.username, self.password)
39
+
40
+ if self.tfa or self.tfa_token # TFA only required for username+password based login.
41
+ raise "Multi-Factor Token required in config but not provided." unless self.tfa_token
42
+ req["X-PhraseApp-OTP"] = auth.tfa_token
43
+ end
44
+ else
45
+ raise "No authentication present"
46
+ end
47
+
48
+ return nil
49
+
50
+ end
51
+ private
52
+ def load_config
53
+ path = config
54
+ configCredentials = Credentials.new
23
55
  if path && File.exists?(path)
24
56
  content = File.read(path)
25
- tmpA = AuthHandler.new(JSON.load(content))
57
+ configCredentials = Credentials.new(JSON.load(content))
26
58
  end
27
59
 
28
60
  # Only set token if username not specified on commandline.
29
- if tmpA.token && tmpA.token != "" && self.token.nil? && self.username.nil?
30
- self.token = tmpA.token
31
- elsif tmpA.username && tmpA.username != "" && self.username.nil?
32
- self.username = tmpA.username
33
- elsif tmpA.password && tmpA.password != "" && self.password.nil?
34
- self.password = tmpA.password
61
+ if configCredentials.token && configCredentials.token != "" && self.token.nil? && self.username.nil?
62
+ self.token = configCredentials.token
63
+ elsif configCredentials.username && configCredentials.username != "" && self.username.nil?
64
+ self.username = configCredentials.username
65
+ elsif configCredentials.password && configCredentials.password != "" && self.password.nil?
66
+ self.password = configCredentials.password
35
67
  end
36
68
 
37
- if tmpA.tfa && self.tfa == ""
38
- self.tfa = tmpA.tfa
69
+ if configCredentials.tfa && self.tfa == ""
70
+ self.tfa = configCredentials.tfa
39
71
  end
40
72
 
41
- if tmpA.host
42
- self.host = tmpA.host
73
+ if configCredentials.host
74
+ self.host = configCredentials.host
43
75
  end
44
76
 
45
- if tmpA.skip_ssl_verification
46
- self.skip_ssl_verification = tmpA.skip_ssl_verification
77
+ if configCredentials.skip_ssl_verification
78
+ self.skip_ssl_verification = configCredentials.skip_ssl_verification
47
79
  end
48
80
 
49
- if tmpA.debug
50
- self.debug = tmpA.debug
81
+ if configCredentials.debug
82
+ self.debug = configCredentials.debug
51
83
  end
52
84
 
53
85
  return nil
54
86
  end
55
87
  end
56
-
57
- def self.authH
58
- defined?(@@authH) && @@authH
59
- end
60
-
61
- def self.register_auth_handler(a)
62
- @@authH = a
63
- end
64
-
65
- def self.host
66
- if authH.host && authH.host != ""
67
- return authH.host
68
- else
69
- return PhraseApp::URL
70
- end
71
- end
72
-
73
- def self.skip_ssl_verification
74
- if authH.skip_ssl_verification && authH.skip_ssl_verification
75
- return true
76
- else
77
- return false
78
- end
79
- end
80
-
81
- def self.debug
82
- if authH.debug && authH.debug != ""
83
- return authH.debug
84
- else
85
- return false
86
- end
87
- end
88
-
89
- def self.authenticate(req)
90
- if authH == nil
91
- raise("no auth handler registered")
92
- end
93
-
94
- if err = authH.load_config
95
- return err
96
- end
97
-
98
- if err = authH.validate
99
- return err
100
- end
101
-
102
- if authH.token && authH.token != ""
103
- req["Authorization"] = "token #{authH.token}"
104
- elsif authH.username && authH.username != ""
105
- req.basic_auth(authH.username, authH.password)
106
-
107
- if authH.tfa or authH.tfa_token # TFA only required for username+password based login.
108
- raise "Multi-Factor Token required in config but not provided." unless authH.tfa_token
109
- req["X-PhraseApp-OTP"] = auth.tfa_token
110
- end
111
- else
112
- raise "No authentication present"
113
- end
114
-
115
- return nil
116
-
117
- end
118
88
  end
119
89
  end
@@ -73,14 +73,6 @@ module ResponseObjects
73
73
  end
74
74
  end
75
75
 
76
- class ExcludeRule < ::OpenStruct
77
- #created_at, id, name, updated_at,
78
- def initialize(hash)
79
- super(hash)
80
- PhraseApp.handle_times(self)
81
- end
82
- end
83
-
84
76
  class Format < ::OpenStruct
85
77
  #api_name, default_encoding, default_file, description, exportable, extension, importable, name,
86
78
  def initialize(hash)
@@ -194,7 +186,7 @@ module ResponseObjects
194
186
  end
195
187
 
196
188
  class StyleguidePreview < ::OpenStruct
197
- #id, public_url,
189
+ #id, title,
198
190
  def initialize(hash)
199
191
  super(hash)
200
192
  PhraseApp.handle_times(self)
@@ -282,7 +274,7 @@ module ResponseObjects
282
274
  end
283
275
 
284
276
  class User < ::OpenStruct
285
- #company, created_at, email, id, name, position, updated_at, username,
277
+ #created_at, email, id, name, position, updated_at, username,
286
278
  def initialize(hash)
287
279
  super(hash)
288
280
  PhraseApp.handle_times(self)
@@ -332,18 +324,18 @@ end
332
324
 
333
325
 
334
326
  module RequestParams
335
- # CommentParams
327
+ # BlacklistedKeyParams
336
328
  # == Parameters:
337
- # message::
338
- # Comment message
339
- class CommentParams < ::OpenStruct
340
- def message=(val)
341
- self.message = val
329
+ # name::
330
+ # Blacklisted key name
331
+ class BlacklistedKeyParams < ::OpenStruct
332
+ def name=(val)
333
+ self.name = val
342
334
  end
343
335
 
344
336
  def validate
345
- if self.message == nil || self.message == ""
346
- raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"message\" of \"CommentParams\" not set")
337
+ if self.name == nil || self.name == ""
338
+ raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"name\" of \"BlacklistedKeyParams\" not set")
347
339
  end
348
340
  end
349
341
  end
@@ -351,18 +343,18 @@ end
351
343
 
352
344
 
353
345
  module RequestParams
354
- # ExcludeRuleParams
346
+ # CommentParams
355
347
  # == Parameters:
356
- # name::
357
- # Blacklisted key name
358
- class ExcludeRuleParams < ::OpenStruct
359
- def name=(val)
360
- self.name = val
348
+ # message::
349
+ # Comment message
350
+ class CommentParams < ::OpenStruct
351
+ def message=(val)
352
+ self.message = val
361
353
  end
362
354
 
363
355
  def validate
364
- if self.name == nil || self.name == ""
365
- raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"name\" of \"ExcludeRuleParams\" not set")
356
+ if self.message == nil || self.message == ""
357
+ raise PhraseApp::ParamsHelpers::ParamsValidationError.new("Required parameter \"message\" of \"CommentParams\" not set")
366
358
  end
367
359
  end
368
360
  end
@@ -583,7 +575,7 @@ module RequestParams
583
575
  # tag::
584
576
  # Tag you want to order translations for.
585
577
  # target_locale_ids::
586
- # Target locales you want the source content translate to. Can be the name or public id of the target locales. Preferred is the public id.
578
+ # List of target locales you want the source content translate to. Can be the name or public id of the target locales. Preferred is the public id.
587
579
  # translation_type::
588
580
  # Name of the quality level, availability depends on the LSP. Can be one of: standard, pro (for orders processed by Gengo) and one of regular, premium, enterprise (for orders processed by TextMaster)
589
581
  # unverify_translations_upon_delivery::
@@ -691,11 +683,17 @@ end
691
683
  module RequestParams
692
684
  # ProjectParams
693
685
  # == Parameters:
686
+ # main_format::
687
+ # Main file format specified by its API Extension name. Used for locale downloads if no format is specified. For API Extension names of available file formats see <a href="/guides/formats/">Format Guide</a> or our <a href="https://api.phraseapp.com/api/v2/formats">Formats API Endpoint</a>.
694
688
  # name::
695
689
  # Name of the project
696
690
  # shares_translation_memory::
697
691
  # Indicates whether the project should share the account's translation memory
698
692
  class ProjectParams < ::OpenStruct
693
+ def main_format=(val)
694
+ self.main_format = val
695
+ end
696
+
699
697
  def name=(val)
700
698
  self.name = val
701
699
  end
@@ -1028,7 +1026,7 @@ module RequestParams
1028
1026
  # locale_id::
1029
1027
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
1030
1028
  # q::
1031
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1029
+ # q_description_placeholder
1032
1030
  class KeysDeleteParams < ::OpenStruct
1033
1031
  def locale_id=(val)
1034
1032
  self.locale_id = val
@@ -1053,7 +1051,7 @@ module RequestParams
1053
1051
  # order::
1054
1052
  # Order direction. Can be one of: asc, desc.
1055
1053
  # q::
1056
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1054
+ # q_description_placeholder
1057
1055
  # sort::
1058
1056
  # Sort by field. Can be one of: name, created_at, updated_at.
1059
1057
  class KeysListParams < ::OpenStruct
@@ -1088,7 +1086,7 @@ module RequestParams
1088
1086
  # order::
1089
1087
  # Order direction. Can be one of: asc, desc.
1090
1088
  # q::
1091
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1089
+ # q_description_placeholder
1092
1090
  # sort::
1093
1091
  # Sort by field. Can be one of: name, created_at, updated_at.
1094
1092
  class KeysSearchParams < ::OpenStruct
@@ -1121,7 +1119,7 @@ module RequestParams
1121
1119
  # locale_id::
1122
1120
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
1123
1121
  # q::
1124
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1122
+ # q_description_placeholder
1125
1123
  # tags::
1126
1124
  # Tag or comma-separated list of tags to add to the matching collection of keys
1127
1125
  class KeysTagParams < ::OpenStruct
@@ -1152,7 +1150,7 @@ module RequestParams
1152
1150
  # locale_id::
1153
1151
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
1154
1152
  # q::
1155
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>name:key_name</code> for text queries on key names</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1153
+ # q_description_placeholder
1156
1154
  # tags::
1157
1155
  # Tag or comma-separated list of tags to add to the matching collection of keys
1158
1156
  class KeysUntagParams < ::OpenStruct
@@ -1182,6 +1180,8 @@ module RequestParams
1182
1180
  # == Parameters:
1183
1181
  # convert_emoji::
1184
1182
  # Indicates whether Emoji symbols should be converted to actual Emojis.
1183
+ # encoding::
1184
+ # Specify an encoding for the locale file. See the format guide for a list of supported encodings for each format.
1185
1185
  # file_format::
1186
1186
  # File format name. See the format guide for all supported file formats.
1187
1187
  # format_options::
@@ -1190,6 +1190,8 @@ module RequestParams
1190
1190
  # Indicates whether keys without translations should be included in the output as well.
1191
1191
  # keep_notranslate_tags::
1192
1192
  # Indicates whether [NOTRANSLATE] tags should be kept.
1193
+ # skip_unverified_translations::
1194
+ # Indicates whether the locale file should skip all unverified translations.
1193
1195
  # tag::
1194
1196
  # Limit result to keys tagged with the given tag (identified by its name).
1195
1197
  class LocaleDownloadParams < ::OpenStruct
@@ -1203,6 +1205,10 @@ module RequestParams
1203
1205
  end
1204
1206
  end
1205
1207
 
1208
+ def encoding=(val)
1209
+ self.encoding = val
1210
+ end
1211
+
1206
1212
  def file_format=(val)
1207
1213
  self.file_format = val
1208
1214
  end
@@ -1231,6 +1237,16 @@ module RequestParams
1231
1237
  end
1232
1238
  end
1233
1239
 
1240
+ def skip_unverified_translations=(val)
1241
+ if val.is_a?(TrueClass)
1242
+ self.skip_unverified_translations = true
1243
+ elsif val.is_a?(FalseClass) #ignore
1244
+ self.skip_unverified_translations = b
1245
+ else
1246
+ PhraseApp::ParamsHelpers::ParamsValidationError.new("invalid value #{val}")
1247
+ end
1248
+ end
1249
+
1234
1250
  def tag=(val)
1235
1251
  self.tag = val
1236
1252
  end
@@ -1299,7 +1315,7 @@ module RequestParams
1299
1315
  # order::
1300
1316
  # Order direction. Can be one of: asc, desc.
1301
1317
  # q::
1302
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1318
+ # q_description_placeholder
1303
1319
  # sort::
1304
1320
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1305
1321
  class TranslationsByKeyParams < ::OpenStruct
@@ -1328,7 +1344,7 @@ module RequestParams
1328
1344
  # order::
1329
1345
  # Order direction. Can be one of: asc, desc.
1330
1346
  # q::
1331
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1347
+ # q_description_placeholder
1332
1348
  # sort::
1333
1349
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1334
1350
  class TranslationsByLocaleParams < ::OpenStruct
@@ -1357,7 +1373,7 @@ module RequestParams
1357
1373
  # order::
1358
1374
  # Order direction. Can be one of: asc, desc.
1359
1375
  # q::
1360
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1376
+ # q_description_placeholder
1361
1377
  # sort::
1362
1378
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1363
1379
  class TranslationsExcludeParams < ::OpenStruct
@@ -1386,7 +1402,7 @@ module RequestParams
1386
1402
  # order::
1387
1403
  # Order direction. Can be one of: asc, desc.
1388
1404
  # q::
1389
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1405
+ # q_description_placeholder
1390
1406
  # sort::
1391
1407
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1392
1408
  class TranslationsIncludeParams < ::OpenStruct
@@ -1415,7 +1431,7 @@ module RequestParams
1415
1431
  # order::
1416
1432
  # Order direction. Can be one of: asc, desc.
1417
1433
  # q::
1418
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1434
+ # q_description_placeholder
1419
1435
  # sort::
1420
1436
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1421
1437
  class TranslationsListParams < ::OpenStruct
@@ -1444,7 +1460,7 @@ module RequestParams
1444
1460
  # order::
1445
1461
  # Order direction. Can be one of: asc, desc.
1446
1462
  # q::
1447
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1463
+ # q_description_placeholder
1448
1464
  # sort::
1449
1465
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1450
1466
  class TranslationsSearchParams < ::OpenStruct
@@ -1473,7 +1489,7 @@ module RequestParams
1473
1489
  # order::
1474
1490
  # Order direction. Can be one of: asc, desc.
1475
1491
  # q::
1476
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1492
+ # q_description_placeholder
1477
1493
  # sort::
1478
1494
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1479
1495
  class TranslationsUnverifyParams < ::OpenStruct
@@ -1502,7 +1518,7 @@ module RequestParams
1502
1518
  # order::
1503
1519
  # Order direction. Can be one of: asc, desc.
1504
1520
  # q::
1505
- # Specify a search term query including wildcard or exact matching. It will search the key metadata for matching results. Searched fields include key name, description, tags, translations.<br><br> Also supports the following qualifiers in the query:<br> <ul> <li><code>tags:XYZ</code> for tags on the translation</li> <li><code>unverified:{true|false}</code> for verification status</li> <li><code>updated_at{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> </ul> Please note that the argument is named <code>--query</code> when using the <a href="https://phraseapp.com/cli" target="_blank">PhraseApp Client</a>. <br /><br /> Find more examples <a href="/api/v2/general/examples/">here</a>.
1521
+ # q_description_placeholder
1506
1522
  # sort::
1507
1523
  # Sort criteria. Can be one of: key_name, created_at, updated_at.
1508
1524
  class TranslationsVerifyParams < ::OpenStruct
@@ -1529,11 +1545,10 @@ end
1529
1545
  #
1530
1546
  # Require the gem
1531
1547
  # require 'phraseapp-ruby'
1532
- # Setup Authentication
1533
- # auth_handler = PhraseApp::Auth::AuthHandler.new({:token => "YOUR_ACCESS_TOKEN"})
1534
- # PhraseApp::Auth.register_auth_handler(auth_handler)
1535
- # Create a client
1536
- # client = PhraseApp::Client
1548
+ # Setup Credentials for Authentication
1549
+ # credentials = PhraseApp::Auth::Credentials.new(token: "YOUR_ACCESS_TOKEN")
1550
+ # Create a client
1551
+ # client = PhraseApp::Client.new(credentials)
1537
1552
  # List Projects
1538
1553
  # rsp, err = client.projects_list(1, 10)
1539
1554
  # puts rsp
@@ -1542,6 +1557,10 @@ end
1542
1557
  # rsp, err = client.key_create('YOUR_PROJECT_ID', params)
1543
1558
  # puts rsp
1544
1559
  class Client
1560
+ def initialize(credentials)
1561
+ @credentials = credentials
1562
+ end
1563
+
1545
1564
 
1546
1565
  # Create a new authorization.
1547
1566
  # API Path: /v2/authorizations
@@ -1552,7 +1571,7 @@ end
1552
1571
  # == Returns:
1553
1572
  # PhraseApp::ResponseObjects::AuthorizationWithToken
1554
1573
  # err
1555
- def self.authorization_create(params)
1574
+ def authorization_create(params)
1556
1575
  path = sprintf("/api/v2/authorizations")
1557
1576
  data_hash = {}
1558
1577
  post_body = nil
@@ -1569,7 +1588,7 @@ end
1569
1588
  return nil, err
1570
1589
  end
1571
1590
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1572
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
1591
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
1573
1592
  if err != nil
1574
1593
  return nil, err
1575
1594
  end
@@ -1585,13 +1604,13 @@ end
1585
1604
  #
1586
1605
  # == Returns:
1587
1606
  # err
1588
- def self.authorization_delete(id)
1607
+ def authorization_delete(id)
1589
1608
  path = sprintf("/api/v2/authorizations/%s", id)
1590
1609
  data_hash = {}
1591
1610
  post_body = nil
1592
1611
 
1593
1612
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1594
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
1613
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
1595
1614
  if err != nil
1596
1615
  return nil, err
1597
1616
  end
@@ -1608,13 +1627,13 @@ end
1608
1627
  # == Returns:
1609
1628
  # PhraseApp::ResponseObjects::Authorization
1610
1629
  # err
1611
- def self.authorization_show(id)
1630
+ def authorization_show(id)
1612
1631
  path = sprintf("/api/v2/authorizations/%s", id)
1613
1632
  data_hash = {}
1614
1633
  post_body = nil
1615
1634
 
1616
1635
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1617
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
1636
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
1618
1637
  if err != nil
1619
1638
  return nil, err
1620
1639
  end
@@ -1633,7 +1652,7 @@ end
1633
1652
  # == Returns:
1634
1653
  # PhraseApp::ResponseObjects::Authorization
1635
1654
  # err
1636
- def self.authorization_update(id, params)
1655
+ def authorization_update(id, params)
1637
1656
  path = sprintf("/api/v2/authorizations/%s", id)
1638
1657
  data_hash = {}
1639
1658
  post_body = nil
@@ -1650,7 +1669,7 @@ end
1650
1669
  return nil, err
1651
1670
  end
1652
1671
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1653
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
1672
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
1654
1673
  if err != nil
1655
1674
  return nil, err
1656
1675
  end
@@ -1665,13 +1684,13 @@ end
1665
1684
  # == Returns:
1666
1685
  # PhraseApp::ResponseObjects::Authorization
1667
1686
  # err
1668
- def self.authorizations_list(page, per_page)
1687
+ def authorizations_list(page, per_page)
1669
1688
  path = sprintf("/api/v2/authorizations")
1670
1689
  data_hash = {}
1671
1690
  post_body = nil
1672
1691
 
1673
1692
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1674
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
1693
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
1675
1694
  if err != nil
1676
1695
  return nil, err
1677
1696
  end
@@ -1679,27 +1698,25 @@ end
1679
1698
  return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Authorization.new(item) }, err
1680
1699
  end
1681
1700
 
1682
- # Create a new comment for a key.
1683
- # API Path: /v2/projects/:project_id/keys/:key_id/comments
1701
+ # Create a new rule for blacklisting keys.
1702
+ # API Path: /v2/projects/:project_id/blacklisted_keys
1684
1703
  # == Parameters:
1685
1704
  # project_id::
1686
1705
  # project_id
1687
- # key_id::
1688
- # key_id
1689
1706
  # params::
1690
- # Parameters of type PhraseApp::RequestParams::CommentParams
1707
+ # Parameters of type PhraseApp::RequestParams::BlacklistedKeyParams
1691
1708
  #
1692
1709
  # == Returns:
1693
- # PhraseApp::ResponseObjects::Comment
1710
+ # PhraseApp::ResponseObjects::BlacklistedKey
1694
1711
  # err
1695
- def self.comment_create(project_id, key_id, params)
1696
- path = sprintf("/api/v2/projects/%s/keys/%s/comments", project_id, key_id)
1712
+ def blacklisted_key_create(project_id, params)
1713
+ path = sprintf("/api/v2/projects/%s/blacklisted_keys", project_id)
1697
1714
  data_hash = {}
1698
1715
  post_body = nil
1699
1716
 
1700
1717
  if params.present?
1701
- unless params.kind_of?(PhraseApp::RequestParams::CommentParams)
1702
- raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentParams")
1718
+ unless params.kind_of?(PhraseApp::RequestParams::BlacklistedKeyParams)
1719
+ raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BlacklistedKeyParams")
1703
1720
  end
1704
1721
  end
1705
1722
 
@@ -1709,33 +1726,31 @@ end
1709
1726
  return nil, err
1710
1727
  end
1711
1728
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1712
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
1729
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
1713
1730
  if err != nil
1714
1731
  return nil, err
1715
1732
  end
1716
1733
 
1717
- return PhraseApp::ResponseObjects::Comment.new(JSON.load(rc.body)), err
1734
+ return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
1718
1735
  end
1719
1736
 
1720
- # Delete an existing comment.
1721
- # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id
1737
+ # Delete an existing rule for blacklisting keys.
1738
+ # API Path: /v2/projects/:project_id/blacklisted_keys/:id
1722
1739
  # == Parameters:
1723
1740
  # project_id::
1724
1741
  # project_id
1725
- # key_id::
1726
- # key_id
1727
1742
  # id::
1728
1743
  # id
1729
1744
  #
1730
1745
  # == Returns:
1731
1746
  # err
1732
- def self.comment_delete(project_id, key_id, id)
1733
- path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
1747
+ def blacklisted_key_delete(project_id, id)
1748
+ path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
1734
1749
  data_hash = {}
1735
1750
  post_body = nil
1736
1751
 
1737
1752
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1738
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
1753
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
1739
1754
  if err != nil
1740
1755
  return nil, err
1741
1756
  end
@@ -1743,104 +1758,123 @@ end
1743
1758
  return err
1744
1759
  end
1745
1760
 
1746
- # Check if comment was marked as read. Returns 204 if read, 404 if unread.
1747
- # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id/read
1761
+ # Get details on a single rule for blacklisting keys for a given project.
1762
+ # API Path: /v2/projects/:project_id/blacklisted_keys/:id
1748
1763
  # == Parameters:
1749
1764
  # project_id::
1750
1765
  # project_id
1751
- # key_id::
1752
- # key_id
1753
1766
  # id::
1754
1767
  # id
1755
1768
  #
1756
1769
  # == Returns:
1770
+ # PhraseApp::ResponseObjects::BlacklistedKey
1757
1771
  # err
1758
- def self.comment_mark_check(project_id, key_id, id)
1759
- path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
1772
+ def blacklisted_key_show(project_id, id)
1773
+ path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
1760
1774
  data_hash = {}
1761
1775
  post_body = nil
1762
1776
 
1763
1777
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1764
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 204)
1778
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
1765
1779
  if err != nil
1766
1780
  return nil, err
1767
1781
  end
1768
1782
 
1769
- return err
1783
+ return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
1770
1784
  end
1771
1785
 
1772
- # Mark a comment as read.
1773
- # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id/read
1786
+ # Update an existing rule for blacklisting keys.
1787
+ # API Path: /v2/projects/:project_id/blacklisted_keys/:id
1774
1788
  # == Parameters:
1775
1789
  # project_id::
1776
1790
  # project_id
1777
- # key_id::
1778
- # key_id
1779
1791
  # id::
1780
1792
  # id
1793
+ # params::
1794
+ # Parameters of type PhraseApp::RequestParams::BlacklistedKeyParams
1781
1795
  #
1782
1796
  # == Returns:
1797
+ # PhraseApp::ResponseObjects::BlacklistedKey
1783
1798
  # err
1784
- def self.comment_mark_read(project_id, key_id, id)
1785
- path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
1799
+ def blacklisted_key_update(project_id, id, params)
1800
+ path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
1786
1801
  data_hash = {}
1787
1802
  post_body = nil
1788
1803
 
1804
+ if params.present?
1805
+ unless params.kind_of?(PhraseApp::RequestParams::BlacklistedKeyParams)
1806
+ raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::BlacklistedKeyParams")
1807
+ end
1808
+ end
1809
+
1810
+ data_hash = params.to_h
1811
+ err = params.validate
1812
+ if err != nil
1813
+ return nil, err
1814
+ end
1789
1815
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1790
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 204)
1816
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
1791
1817
  if err != nil
1792
1818
  return nil, err
1793
1819
  end
1794
1820
 
1795
- return err
1821
+ return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
1796
1822
  end
1797
1823
 
1798
- # Mark a comment as unread.
1799
- # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id/read
1824
+ # List all rules for blacklisting keys for the given project.
1825
+ # API Path: /v2/projects/:project_id/blacklisted_keys
1800
1826
  # == Parameters:
1801
1827
  # project_id::
1802
1828
  # project_id
1803
- # key_id::
1804
- # key_id
1805
- # id::
1806
- # id
1807
1829
  #
1808
1830
  # == Returns:
1831
+ # PhraseApp::ResponseObjects::BlacklistedKey
1809
1832
  # err
1810
- def self.comment_mark_unread(project_id, key_id, id)
1811
- path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
1833
+ def blacklisted_keys_list(project_id, page, per_page)
1834
+ path = sprintf("/api/v2/projects/%s/blacklisted_keys", project_id)
1812
1835
  data_hash = {}
1813
1836
  post_body = nil
1814
1837
 
1815
1838
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1816
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
1839
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
1817
1840
  if err != nil
1818
1841
  return nil, err
1819
1842
  end
1820
1843
 
1821
- return err
1844
+ return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::BlacklistedKey.new(item) }, err
1822
1845
  end
1823
1846
 
1824
- # Get details on a single comment.
1825
- # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id
1847
+ # Create a new comment for a key.
1848
+ # API Path: /v2/projects/:project_id/keys/:key_id/comments
1826
1849
  # == Parameters:
1827
1850
  # project_id::
1828
1851
  # project_id
1829
1852
  # key_id::
1830
1853
  # key_id
1831
- # id::
1832
- # id
1854
+ # params::
1855
+ # Parameters of type PhraseApp::RequestParams::CommentParams
1833
1856
  #
1834
1857
  # == Returns:
1835
1858
  # PhraseApp::ResponseObjects::Comment
1836
1859
  # err
1837
- def self.comment_show(project_id, key_id, id)
1838
- path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
1860
+ def comment_create(project_id, key_id, params)
1861
+ path = sprintf("/api/v2/projects/%s/keys/%s/comments", project_id, key_id)
1839
1862
  data_hash = {}
1840
1863
  post_body = nil
1841
1864
 
1865
+ if params.present?
1866
+ unless params.kind_of?(PhraseApp::RequestParams::CommentParams)
1867
+ raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentParams")
1868
+ end
1869
+ end
1870
+
1871
+ data_hash = params.to_h
1872
+ err = params.validate
1873
+ if err != nil
1874
+ return nil, err
1875
+ end
1842
1876
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1843
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
1877
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
1844
1878
  if err != nil
1845
1879
  return nil, err
1846
1880
  end
@@ -1848,7 +1882,7 @@ end
1848
1882
  return PhraseApp::ResponseObjects::Comment.new(JSON.load(rc.body)), err
1849
1883
  end
1850
1884
 
1851
- # Update an existing comment.
1885
+ # Delete an existing comment.
1852
1886
  # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id
1853
1887
  # == Parameters:
1854
1888
  # project_id::
@@ -1857,115 +1891,94 @@ end
1857
1891
  # key_id
1858
1892
  # id::
1859
1893
  # id
1860
- # params::
1861
- # Parameters of type PhraseApp::RequestParams::CommentParams
1862
1894
  #
1863
1895
  # == Returns:
1864
- # PhraseApp::ResponseObjects::Comment
1865
1896
  # err
1866
- def self.comment_update(project_id, key_id, id, params)
1897
+ def comment_delete(project_id, key_id, id)
1867
1898
  path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
1868
1899
  data_hash = {}
1869
1900
  post_body = nil
1870
1901
 
1871
- if params.present?
1872
- unless params.kind_of?(PhraseApp::RequestParams::CommentParams)
1873
- raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentParams")
1874
- end
1875
- end
1876
-
1877
- data_hash = params.to_h
1878
- err = params.validate
1879
- if err != nil
1880
- return nil, err
1881
- end
1882
1902
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1883
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
1903
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
1884
1904
  if err != nil
1885
1905
  return nil, err
1886
1906
  end
1887
1907
 
1888
- return PhraseApp::ResponseObjects::Comment.new(JSON.load(rc.body)), err
1908
+ return err
1889
1909
  end
1890
1910
 
1891
- # List all comments for a key.
1892
- # API Path: /v2/projects/:project_id/keys/:key_id/comments
1911
+ # Check if comment was marked as read. Returns 204 if read, 404 if unread.
1912
+ # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id/read
1893
1913
  # == Parameters:
1894
1914
  # project_id::
1895
1915
  # project_id
1896
1916
  # key_id::
1897
1917
  # key_id
1918
+ # id::
1919
+ # id
1898
1920
  #
1899
1921
  # == Returns:
1900
- # PhraseApp::ResponseObjects::Comment
1901
1922
  # err
1902
- def self.comments_list(project_id, key_id, page, per_page)
1903
- path = sprintf("/api/v2/projects/%s/keys/%s/comments", project_id, key_id)
1923
+ def comment_mark_check(project_id, key_id, id)
1924
+ path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
1904
1925
  data_hash = {}
1905
1926
  post_body = nil
1906
1927
 
1907
1928
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1908
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
1929
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 204)
1909
1930
  if err != nil
1910
1931
  return nil, err
1911
1932
  end
1912
1933
 
1913
- return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Comment.new(item) }, err
1934
+ return err
1914
1935
  end
1915
1936
 
1916
- # Create a new blacklisted key.
1917
- # API Path: /v2/projects/:project_id/blacklisted_keys
1937
+ # Mark a comment as read.
1938
+ # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id/read
1918
1939
  # == Parameters:
1919
1940
  # project_id::
1920
1941
  # project_id
1921
- # params::
1922
- # Parameters of type PhraseApp::RequestParams::ExcludeRuleParams
1942
+ # key_id::
1943
+ # key_id
1944
+ # id::
1945
+ # id
1923
1946
  #
1924
1947
  # == Returns:
1925
- # PhraseApp::ResponseObjects::BlacklistedKey
1926
1948
  # err
1927
- def self.exclude_rule_create(project_id, params)
1928
- path = sprintf("/api/v2/projects/%s/blacklisted_keys", project_id)
1949
+ def comment_mark_read(project_id, key_id, id)
1950
+ path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
1929
1951
  data_hash = {}
1930
1952
  post_body = nil
1931
1953
 
1932
- if params.present?
1933
- unless params.kind_of?(PhraseApp::RequestParams::ExcludeRuleParams)
1934
- raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ExcludeRuleParams")
1935
- end
1936
- end
1937
-
1938
- data_hash = params.to_h
1939
- err = params.validate
1940
- if err != nil
1941
- return nil, err
1942
- end
1943
1954
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1944
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
1955
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 204)
1945
1956
  if err != nil
1946
1957
  return nil, err
1947
1958
  end
1948
1959
 
1949
- return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
1960
+ return err
1950
1961
  end
1951
1962
 
1952
- # Delete an existing blacklisted key.
1953
- # API Path: /v2/projects/:project_id/blacklisted_keys/:id
1963
+ # Mark a comment as unread.
1964
+ # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id/read
1954
1965
  # == Parameters:
1955
1966
  # project_id::
1956
1967
  # project_id
1968
+ # key_id::
1969
+ # key_id
1957
1970
  # id::
1958
1971
  # id
1959
1972
  #
1960
1973
  # == Returns:
1961
1974
  # err
1962
- def self.exclude_rule_delete(project_id, id)
1963
- path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
1975
+ def comment_mark_unread(project_id, key_id, id)
1976
+ path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s/read", project_id, key_id, id)
1964
1977
  data_hash = {}
1965
1978
  post_body = nil
1966
1979
 
1967
1980
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1968
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
1981
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
1969
1982
  if err != nil
1970
1983
  return nil, err
1971
1984
  end
@@ -1973,52 +1986,56 @@ end
1973
1986
  return err
1974
1987
  end
1975
1988
 
1976
- # Get details on a single blacklisted key for a given project.
1977
- # API Path: /v2/projects/:project_id/blacklisted_keys/:id
1989
+ # Get details on a single comment.
1990
+ # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id
1978
1991
  # == Parameters:
1979
1992
  # project_id::
1980
1993
  # project_id
1994
+ # key_id::
1995
+ # key_id
1981
1996
  # id::
1982
1997
  # id
1983
1998
  #
1984
1999
  # == Returns:
1985
- # PhraseApp::ResponseObjects::BlacklistedKey
2000
+ # PhraseApp::ResponseObjects::Comment
1986
2001
  # err
1987
- def self.exclude_rule_show(project_id, id)
1988
- path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
2002
+ def comment_show(project_id, key_id, id)
2003
+ path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
1989
2004
  data_hash = {}
1990
2005
  post_body = nil
1991
2006
 
1992
2007
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
1993
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
2008
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
1994
2009
  if err != nil
1995
2010
  return nil, err
1996
2011
  end
1997
2012
 
1998
- return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
2013
+ return PhraseApp::ResponseObjects::Comment.new(JSON.load(rc.body)), err
1999
2014
  end
2000
2015
 
2001
- # Update an existing blacklisted key.
2002
- # API Path: /v2/projects/:project_id/blacklisted_keys/:id
2016
+ # Update an existing comment.
2017
+ # API Path: /v2/projects/:project_id/keys/:key_id/comments/:id
2003
2018
  # == Parameters:
2004
2019
  # project_id::
2005
2020
  # project_id
2021
+ # key_id::
2022
+ # key_id
2006
2023
  # id::
2007
2024
  # id
2008
2025
  # params::
2009
- # Parameters of type PhraseApp::RequestParams::ExcludeRuleParams
2026
+ # Parameters of type PhraseApp::RequestParams::CommentParams
2010
2027
  #
2011
2028
  # == Returns:
2012
- # PhraseApp::ResponseObjects::BlacklistedKey
2029
+ # PhraseApp::ResponseObjects::Comment
2013
2030
  # err
2014
- def self.exclude_rule_update(project_id, id, params)
2015
- path = sprintf("/api/v2/projects/%s/blacklisted_keys/%s", project_id, id)
2031
+ def comment_update(project_id, key_id, id, params)
2032
+ path = sprintf("/api/v2/projects/%s/keys/%s/comments/%s", project_id, key_id, id)
2016
2033
  data_hash = {}
2017
2034
  post_body = nil
2018
2035
 
2019
2036
  if params.present?
2020
- unless params.kind_of?(PhraseApp::RequestParams::ExcludeRuleParams)
2021
- raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::ExcludeRuleParams")
2037
+ unless params.kind_of?(PhraseApp::RequestParams::CommentParams)
2038
+ raise PhraseApp::ParamsHelpers::ParamsError.new("Expects params to be kind_of PhraseApp::RequestParams::CommentParams")
2022
2039
  end
2023
2040
  end
2024
2041
 
@@ -2028,35 +2045,37 @@ end
2028
2045
  return nil, err
2029
2046
  end
2030
2047
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2031
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2048
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2032
2049
  if err != nil
2033
2050
  return nil, err
2034
2051
  end
2035
2052
 
2036
- return PhraseApp::ResponseObjects::BlacklistedKey.new(JSON.load(rc.body)), err
2053
+ return PhraseApp::ResponseObjects::Comment.new(JSON.load(rc.body)), err
2037
2054
  end
2038
2055
 
2039
- # List all blacklisted keys for the given project.
2040
- # API Path: /v2/projects/:project_id/blacklisted_keys
2056
+ # List all comments for a key.
2057
+ # API Path: /v2/projects/:project_id/keys/:key_id/comments
2041
2058
  # == Parameters:
2042
2059
  # project_id::
2043
2060
  # project_id
2061
+ # key_id::
2062
+ # key_id
2044
2063
  #
2045
2064
  # == Returns:
2046
- # PhraseApp::ResponseObjects::BlacklistedKey
2065
+ # PhraseApp::ResponseObjects::Comment
2047
2066
  # err
2048
- def self.exclude_rules_index(project_id, page, per_page)
2049
- path = sprintf("/api/v2/projects/%s/blacklisted_keys", project_id)
2067
+ def comments_list(project_id, key_id, page, per_page)
2068
+ path = sprintf("/api/v2/projects/%s/keys/%s/comments", project_id, key_id)
2050
2069
  data_hash = {}
2051
2070
  post_body = nil
2052
2071
 
2053
2072
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2054
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2073
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2055
2074
  if err != nil
2056
2075
  return nil, err
2057
2076
  end
2058
2077
 
2059
- return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::BlacklistedKey.new(item) }, err
2078
+ return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::Comment.new(item) }, err
2060
2079
  end
2061
2080
 
2062
2081
  # Get a handy list of all localization file formats supported in PhraseApp.
@@ -2066,13 +2085,13 @@ end
2066
2085
  # == Returns:
2067
2086
  # PhraseApp::ResponseObjects::Format
2068
2087
  # err
2069
- def self.formats_list(page, per_page)
2088
+ def formats_list(page, per_page)
2070
2089
  path = sprintf("/api/v2/formats")
2071
2090
  data_hash = {}
2072
2091
  post_body = nil
2073
2092
 
2074
2093
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2075
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2094
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2076
2095
  if err != nil
2077
2096
  return nil, err
2078
2097
  end
@@ -2091,7 +2110,7 @@ end
2091
2110
  # == Returns:
2092
2111
  # PhraseApp::ResponseObjects::TranslationKeyDetails
2093
2112
  # err
2094
- def self.key_create(project_id, params)
2113
+ def key_create(project_id, params)
2095
2114
  path = sprintf("/api/v2/projects/%s/keys", project_id)
2096
2115
  data_hash = {}
2097
2116
  post_body = nil
@@ -2166,7 +2185,7 @@ end
2166
2185
 
2167
2186
 
2168
2187
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2169
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
2188
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
2170
2189
  if err != nil
2171
2190
  return nil, err
2172
2191
  end
@@ -2184,13 +2203,13 @@ end
2184
2203
  #
2185
2204
  # == Returns:
2186
2205
  # err
2187
- def self.key_delete(project_id, id)
2206
+ def key_delete(project_id, id)
2188
2207
  path = sprintf("/api/v2/projects/%s/keys/%s", project_id, id)
2189
2208
  data_hash = {}
2190
2209
  post_body = nil
2191
2210
 
2192
2211
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2193
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
2212
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
2194
2213
  if err != nil
2195
2214
  return nil, err
2196
2215
  end
@@ -2209,13 +2228,13 @@ end
2209
2228
  # == Returns:
2210
2229
  # PhraseApp::ResponseObjects::TranslationKeyDetails
2211
2230
  # err
2212
- def self.key_show(project_id, id)
2231
+ def key_show(project_id, id)
2213
2232
  path = sprintf("/api/v2/projects/%s/keys/%s", project_id, id)
2214
2233
  data_hash = {}
2215
2234
  post_body = nil
2216
2235
 
2217
2236
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2218
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
2237
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
2219
2238
  if err != nil
2220
2239
  return nil, err
2221
2240
  end
@@ -2236,7 +2255,7 @@ end
2236
2255
  # == Returns:
2237
2256
  # PhraseApp::ResponseObjects::TranslationKeyDetails
2238
2257
  # err
2239
- def self.key_update(project_id, id, params)
2258
+ def key_update(project_id, id, params)
2240
2259
  path = sprintf("/api/v2/projects/%s/keys/%s", project_id, id)
2241
2260
  data_hash = {}
2242
2261
  post_body = nil
@@ -2311,7 +2330,7 @@ end
2311
2330
 
2312
2331
 
2313
2332
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2314
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2333
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2315
2334
  if err != nil
2316
2335
  return nil, err
2317
2336
  end
@@ -2330,7 +2349,7 @@ end
2330
2349
  # == Returns:
2331
2350
  # PhraseApp::ResponseObjects::AffectedResources
2332
2351
  # err
2333
- def self.keys_delete(project_id, params)
2352
+ def keys_delete(project_id, params)
2334
2353
  path = sprintf("/api/v2/projects/%s/keys", project_id)
2335
2354
  data_hash = {}
2336
2355
  post_body = nil
@@ -2347,7 +2366,7 @@ end
2347
2366
  return nil, err
2348
2367
  end
2349
2368
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2350
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 200)
2369
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 200)
2351
2370
  if err != nil
2352
2371
  return nil, err
2353
2372
  end
@@ -2366,7 +2385,7 @@ end
2366
2385
  # == Returns:
2367
2386
  # PhraseApp::ResponseObjects::TranslationKey
2368
2387
  # err
2369
- def self.keys_list(project_id, page, per_page, params)
2388
+ def keys_list(project_id, page, per_page, params)
2370
2389
  path = sprintf("/api/v2/projects/%s/keys", project_id)
2371
2390
  data_hash = {}
2372
2391
  post_body = nil
@@ -2383,7 +2402,7 @@ end
2383
2402
  return nil, err
2384
2403
  end
2385
2404
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2386
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2405
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2387
2406
  if err != nil
2388
2407
  return nil, err
2389
2408
  end
@@ -2402,7 +2421,7 @@ end
2402
2421
  # == Returns:
2403
2422
  # PhraseApp::ResponseObjects::TranslationKey
2404
2423
  # err
2405
- def self.keys_search(project_id, page, per_page, params)
2424
+ def keys_search(project_id, page, per_page, params)
2406
2425
  path = sprintf("/api/v2/projects/%s/keys/search", project_id)
2407
2426
  data_hash = {}
2408
2427
  post_body = nil
@@ -2419,7 +2438,7 @@ end
2419
2438
  return nil, err
2420
2439
  end
2421
2440
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2422
- rc, err = PhraseApp.send_request_paginated("POST", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2441
+ rc, err = PhraseApp.send_request_paginated(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2423
2442
  if err != nil
2424
2443
  return nil, err
2425
2444
  end
@@ -2438,7 +2457,7 @@ end
2438
2457
  # == Returns:
2439
2458
  # PhraseApp::ResponseObjects::AffectedResources
2440
2459
  # err
2441
- def self.keys_tag(project_id, params)
2460
+ def keys_tag(project_id, params)
2442
2461
  path = sprintf("/api/v2/projects/%s/keys/tag", project_id)
2443
2462
  data_hash = {}
2444
2463
  post_body = nil
@@ -2455,7 +2474,7 @@ end
2455
2474
  return nil, err
2456
2475
  end
2457
2476
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2458
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2477
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2459
2478
  if err != nil
2460
2479
  return nil, err
2461
2480
  end
@@ -2464,7 +2483,7 @@ end
2464
2483
  end
2465
2484
 
2466
2485
  # Removes specified tags from keys matching query.
2467
- # API Path: /v2/projects/:project_id/keys/tag
2486
+ # API Path: /v2/projects/:project_id/keys/untag
2468
2487
  # == Parameters:
2469
2488
  # project_id::
2470
2489
  # project_id
@@ -2474,8 +2493,8 @@ end
2474
2493
  # == Returns:
2475
2494
  # PhraseApp::ResponseObjects::AffectedResources
2476
2495
  # err
2477
- def self.keys_untag(project_id, params)
2478
- path = sprintf("/api/v2/projects/%s/keys/tag", project_id)
2496
+ def keys_untag(project_id, params)
2497
+ path = sprintf("/api/v2/projects/%s/keys/untag", project_id)
2479
2498
  data_hash = {}
2480
2499
  post_body = nil
2481
2500
 
@@ -2491,7 +2510,7 @@ end
2491
2510
  return nil, err
2492
2511
  end
2493
2512
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2494
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 200)
2513
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2495
2514
  if err != nil
2496
2515
  return nil, err
2497
2516
  end
@@ -2510,7 +2529,7 @@ end
2510
2529
  # == Returns:
2511
2530
  # PhraseApp::ResponseObjects::LocaleDetails
2512
2531
  # err
2513
- def self.locale_create(project_id, params)
2532
+ def locale_create(project_id, params)
2514
2533
  path = sprintf("/api/v2/projects/%s/locales", project_id)
2515
2534
  data_hash = {}
2516
2535
  post_body = nil
@@ -2527,7 +2546,7 @@ end
2527
2546
  return nil, err
2528
2547
  end
2529
2548
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2530
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
2549
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
2531
2550
  if err != nil
2532
2551
  return nil, err
2533
2552
  end
@@ -2545,13 +2564,13 @@ end
2545
2564
  #
2546
2565
  # == Returns:
2547
2566
  # err
2548
- def self.locale_delete(project_id, id)
2567
+ def locale_delete(project_id, id)
2549
2568
  path = sprintf("/api/v2/projects/%s/locales/%s", project_id, id)
2550
2569
  data_hash = {}
2551
2570
  post_body = nil
2552
2571
 
2553
2572
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2554
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
2573
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
2555
2574
  if err != nil
2556
2575
  return nil, err
2557
2576
  end
@@ -2571,7 +2590,7 @@ end
2571
2590
  #
2572
2591
  # == Returns:
2573
2592
  # err
2574
- def self.locale_download(project_id, id, params)
2593
+ def locale_download(project_id, id, params)
2575
2594
  path = sprintf("/api/v2/projects/%s/locales/%s/download", project_id, id)
2576
2595
  data_hash = {}
2577
2596
  post_body = nil
@@ -2588,7 +2607,7 @@ end
2588
2607
  return nil, err
2589
2608
  end
2590
2609
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2591
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
2610
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
2592
2611
  if err != nil
2593
2612
  return nil, err
2594
2613
  end
@@ -2607,13 +2626,13 @@ end
2607
2626
  # == Returns:
2608
2627
  # PhraseApp::ResponseObjects::LocaleDetails
2609
2628
  # err
2610
- def self.locale_show(project_id, id)
2629
+ def locale_show(project_id, id)
2611
2630
  path = sprintf("/api/v2/projects/%s/locales/%s", project_id, id)
2612
2631
  data_hash = {}
2613
2632
  post_body = nil
2614
2633
 
2615
2634
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2616
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
2635
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
2617
2636
  if err != nil
2618
2637
  return nil, err
2619
2638
  end
@@ -2634,7 +2653,7 @@ end
2634
2653
  # == Returns:
2635
2654
  # PhraseApp::ResponseObjects::LocaleDetails
2636
2655
  # err
2637
- def self.locale_update(project_id, id, params)
2656
+ def locale_update(project_id, id, params)
2638
2657
  path = sprintf("/api/v2/projects/%s/locales/%s", project_id, id)
2639
2658
  data_hash = {}
2640
2659
  post_body = nil
@@ -2651,7 +2670,7 @@ end
2651
2670
  return nil, err
2652
2671
  end
2653
2672
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2654
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2673
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2655
2674
  if err != nil
2656
2675
  return nil, err
2657
2676
  end
@@ -2668,13 +2687,13 @@ end
2668
2687
  # == Returns:
2669
2688
  # PhraseApp::ResponseObjects::Locale
2670
2689
  # err
2671
- def self.locales_list(project_id, page, per_page)
2690
+ def locales_list(project_id, page, per_page)
2672
2691
  path = sprintf("/api/v2/projects/%s/locales", project_id)
2673
2692
  data_hash = {}
2674
2693
  post_body = nil
2675
2694
 
2676
2695
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2677
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2696
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2678
2697
  if err != nil
2679
2698
  return nil, err
2680
2699
  end
@@ -2693,13 +2712,13 @@ end
2693
2712
  # == Returns:
2694
2713
  # PhraseApp::ResponseObjects::TranslationOrder
2695
2714
  # err
2696
- def self.order_confirm(project_id, id)
2715
+ def order_confirm(project_id, id)
2697
2716
  path = sprintf("/api/v2/projects/%s/orders/%s/confirm", project_id, id)
2698
2717
  data_hash = {}
2699
2718
  post_body = nil
2700
2719
 
2701
2720
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2702
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2721
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2703
2722
  if err != nil
2704
2723
  return nil, err
2705
2724
  end
@@ -2718,7 +2737,7 @@ end
2718
2737
  # == Returns:
2719
2738
  # PhraseApp::ResponseObjects::TranslationOrder
2720
2739
  # err
2721
- def self.order_create(project_id, params)
2740
+ def order_create(project_id, params)
2722
2741
  path = sprintf("/api/v2/projects/%s/orders", project_id)
2723
2742
  data_hash = {}
2724
2743
  post_body = nil
@@ -2735,7 +2754,7 @@ end
2735
2754
  return nil, err
2736
2755
  end
2737
2756
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2738
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
2757
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
2739
2758
  if err != nil
2740
2759
  return nil, err
2741
2760
  end
@@ -2753,13 +2772,13 @@ end
2753
2772
  #
2754
2773
  # == Returns:
2755
2774
  # err
2756
- def self.order_delete(project_id, id)
2775
+ def order_delete(project_id, id)
2757
2776
  path = sprintf("/api/v2/projects/%s/orders/%s", project_id, id)
2758
2777
  data_hash = {}
2759
2778
  post_body = nil
2760
2779
 
2761
2780
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2762
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
2781
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
2763
2782
  if err != nil
2764
2783
  return nil, err
2765
2784
  end
@@ -2778,13 +2797,13 @@ end
2778
2797
  # == Returns:
2779
2798
  # PhraseApp::ResponseObjects::TranslationOrder
2780
2799
  # err
2781
- def self.order_show(project_id, id)
2800
+ def order_show(project_id, id)
2782
2801
  path = sprintf("/api/v2/projects/%s/orders/%s", project_id, id)
2783
2802
  data_hash = {}
2784
2803
  post_body = nil
2785
2804
 
2786
2805
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2787
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
2806
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
2788
2807
  if err != nil
2789
2808
  return nil, err
2790
2809
  end
@@ -2801,13 +2820,13 @@ end
2801
2820
  # == Returns:
2802
2821
  # PhraseApp::ResponseObjects::TranslationOrder
2803
2822
  # err
2804
- def self.orders_list(project_id, page, per_page)
2823
+ def orders_list(project_id, page, per_page)
2805
2824
  path = sprintf("/api/v2/projects/%s/orders", project_id)
2806
2825
  data_hash = {}
2807
2826
  post_body = nil
2808
2827
 
2809
2828
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2810
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2829
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2811
2830
  if err != nil
2812
2831
  return nil, err
2813
2832
  end
@@ -2824,7 +2843,7 @@ end
2824
2843
  # == Returns:
2825
2844
  # PhraseApp::ResponseObjects::ProjectDetails
2826
2845
  # err
2827
- def self.project_create(params)
2846
+ def project_create(params)
2828
2847
  path = sprintf("/api/v2/projects")
2829
2848
  data_hash = {}
2830
2849
  post_body = nil
@@ -2841,7 +2860,7 @@ end
2841
2860
  return nil, err
2842
2861
  end
2843
2862
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2844
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
2863
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
2845
2864
  if err != nil
2846
2865
  return nil, err
2847
2866
  end
@@ -2857,13 +2876,13 @@ end
2857
2876
  #
2858
2877
  # == Returns:
2859
2878
  # err
2860
- def self.project_delete(id)
2879
+ def project_delete(id)
2861
2880
  path = sprintf("/api/v2/projects/%s", id)
2862
2881
  data_hash = {}
2863
2882
  post_body = nil
2864
2883
 
2865
2884
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2866
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
2885
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
2867
2886
  if err != nil
2868
2887
  return nil, err
2869
2888
  end
@@ -2880,13 +2899,13 @@ end
2880
2899
  # == Returns:
2881
2900
  # PhraseApp::ResponseObjects::ProjectDetails
2882
2901
  # err
2883
- def self.project_show(id)
2902
+ def project_show(id)
2884
2903
  path = sprintf("/api/v2/projects/%s", id)
2885
2904
  data_hash = {}
2886
2905
  post_body = nil
2887
2906
 
2888
2907
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2889
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
2908
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
2890
2909
  if err != nil
2891
2910
  return nil, err
2892
2911
  end
@@ -2905,7 +2924,7 @@ end
2905
2924
  # == Returns:
2906
2925
  # PhraseApp::ResponseObjects::ProjectDetails
2907
2926
  # err
2908
- def self.project_update(id, params)
2927
+ def project_update(id, params)
2909
2928
  path = sprintf("/api/v2/projects/%s", id)
2910
2929
  data_hash = {}
2911
2930
  post_body = nil
@@ -2922,7 +2941,7 @@ end
2922
2941
  return nil, err
2923
2942
  end
2924
2943
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2925
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2944
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
2926
2945
  if err != nil
2927
2946
  return nil, err
2928
2947
  end
@@ -2937,13 +2956,13 @@ end
2937
2956
  # == Returns:
2938
2957
  # PhraseApp::ResponseObjects::Project
2939
2958
  # err
2940
- def self.projects_list(page, per_page)
2959
+ def projects_list(page, per_page)
2941
2960
  path = sprintf("/api/v2/projects")
2942
2961
  data_hash = {}
2943
2962
  post_body = nil
2944
2963
 
2945
2964
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2946
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2965
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
2947
2966
  if err != nil
2948
2967
  return nil, err
2949
2968
  end
@@ -2958,13 +2977,13 @@ end
2958
2977
  # == Returns:
2959
2978
  # PhraseApp::ResponseObjects::User
2960
2979
  # err
2961
- def self.show_user()
2980
+ def show_user()
2962
2981
  path = sprintf("/api/v2/user")
2963
2982
  data_hash = {}
2964
2983
  post_body = nil
2965
2984
 
2966
2985
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
2967
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
2986
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
2968
2987
  if err != nil
2969
2988
  return nil, err
2970
2989
  end
@@ -2983,7 +3002,7 @@ end
2983
3002
  # == Returns:
2984
3003
  # PhraseApp::ResponseObjects::StyleguideDetails
2985
3004
  # err
2986
- def self.styleguide_create(project_id, params)
3005
+ def styleguide_create(project_id, params)
2987
3006
  path = sprintf("/api/v2/projects/%s/styleguides", project_id)
2988
3007
  data_hash = {}
2989
3008
  post_body = nil
@@ -3000,7 +3019,7 @@ end
3000
3019
  return nil, err
3001
3020
  end
3002
3021
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3003
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
3022
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
3004
3023
  if err != nil
3005
3024
  return nil, err
3006
3025
  end
@@ -3018,13 +3037,13 @@ end
3018
3037
  #
3019
3038
  # == Returns:
3020
3039
  # err
3021
- def self.styleguide_delete(project_id, id)
3040
+ def styleguide_delete(project_id, id)
3022
3041
  path = sprintf("/api/v2/projects/%s/styleguides/%s", project_id, id)
3023
3042
  data_hash = {}
3024
3043
  post_body = nil
3025
3044
 
3026
3045
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3027
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
3046
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
3028
3047
  if err != nil
3029
3048
  return nil, err
3030
3049
  end
@@ -3043,13 +3062,13 @@ end
3043
3062
  # == Returns:
3044
3063
  # PhraseApp::ResponseObjects::StyleguideDetails
3045
3064
  # err
3046
- def self.styleguide_show(project_id, id)
3065
+ def styleguide_show(project_id, id)
3047
3066
  path = sprintf("/api/v2/projects/%s/styleguides/%s", project_id, id)
3048
3067
  data_hash = {}
3049
3068
  post_body = nil
3050
3069
 
3051
3070
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3052
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
3071
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
3053
3072
  if err != nil
3054
3073
  return nil, err
3055
3074
  end
@@ -3070,7 +3089,7 @@ end
3070
3089
  # == Returns:
3071
3090
  # PhraseApp::ResponseObjects::StyleguideDetails
3072
3091
  # err
3073
- def self.styleguide_update(project_id, id, params)
3092
+ def styleguide_update(project_id, id, params)
3074
3093
  path = sprintf("/api/v2/projects/%s/styleguides/%s", project_id, id)
3075
3094
  data_hash = {}
3076
3095
  post_body = nil
@@ -3087,7 +3106,7 @@ end
3087
3106
  return nil, err
3088
3107
  end
3089
3108
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3090
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3109
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3091
3110
  if err != nil
3092
3111
  return nil, err
3093
3112
  end
@@ -3104,13 +3123,13 @@ end
3104
3123
  # == Returns:
3105
3124
  # PhraseApp::ResponseObjects::Styleguide
3106
3125
  # err
3107
- def self.styleguides_list(project_id, page, per_page)
3126
+ def styleguides_list(project_id, page, per_page)
3108
3127
  path = sprintf("/api/v2/projects/%s/styleguides", project_id)
3109
3128
  data_hash = {}
3110
3129
  post_body = nil
3111
3130
 
3112
3131
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3113
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3132
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3114
3133
  if err != nil
3115
3134
  return nil, err
3116
3135
  end
@@ -3129,7 +3148,7 @@ end
3129
3148
  # == Returns:
3130
3149
  # PhraseApp::ResponseObjects::TagWithStats
3131
3150
  # err
3132
- def self.tag_create(project_id, params)
3151
+ def tag_create(project_id, params)
3133
3152
  path = sprintf("/api/v2/projects/%s/tags", project_id)
3134
3153
  data_hash = {}
3135
3154
  post_body = nil
@@ -3146,7 +3165,7 @@ end
3146
3165
  return nil, err
3147
3166
  end
3148
3167
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3149
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
3168
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
3150
3169
  if err != nil
3151
3170
  return nil, err
3152
3171
  end
@@ -3164,13 +3183,13 @@ end
3164
3183
  #
3165
3184
  # == Returns:
3166
3185
  # err
3167
- def self.tag_delete(project_id, name)
3186
+ def tag_delete(project_id, name)
3168
3187
  path = sprintf("/api/v2/projects/%s/tags/%s", project_id, name)
3169
3188
  data_hash = {}
3170
3189
  post_body = nil
3171
3190
 
3172
3191
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3173
- rc, err = PhraseApp.send_request("DELETE", path, reqHelper.ctype, reqHelper.body, 204)
3192
+ rc, err = PhraseApp.send_request(@credentials, "DELETE", path, reqHelper.ctype, reqHelper.body, 204)
3174
3193
  if err != nil
3175
3194
  return nil, err
3176
3195
  end
@@ -3189,13 +3208,13 @@ end
3189
3208
  # == Returns:
3190
3209
  # PhraseApp::ResponseObjects::TagWithStats
3191
3210
  # err
3192
- def self.tag_show(project_id, name)
3211
+ def tag_show(project_id, name)
3193
3212
  path = sprintf("/api/v2/projects/%s/tags/%s", project_id, name)
3194
3213
  data_hash = {}
3195
3214
  post_body = nil
3196
3215
 
3197
3216
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3198
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
3217
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
3199
3218
  if err != nil
3200
3219
  return nil, err
3201
3220
  end
@@ -3212,13 +3231,13 @@ end
3212
3231
  # == Returns:
3213
3232
  # PhraseApp::ResponseObjects::Tag
3214
3233
  # err
3215
- def self.tags_list(project_id, page, per_page)
3234
+ def tags_list(project_id, page, per_page)
3216
3235
  path = sprintf("/api/v2/projects/%s/tags", project_id)
3217
3236
  data_hash = {}
3218
3237
  post_body = nil
3219
3238
 
3220
3239
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3221
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3240
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3222
3241
  if err != nil
3223
3242
  return nil, err
3224
3243
  end
@@ -3237,7 +3256,7 @@ end
3237
3256
  # == Returns:
3238
3257
  # PhraseApp::ResponseObjects::TranslationDetails
3239
3258
  # err
3240
- def self.translation_create(project_id, params)
3259
+ def translation_create(project_id, params)
3241
3260
  path = sprintf("/api/v2/projects/%s/translations", project_id)
3242
3261
  data_hash = {}
3243
3262
  post_body = nil
@@ -3254,7 +3273,7 @@ end
3254
3273
  return nil, err
3255
3274
  end
3256
3275
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3257
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
3276
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
3258
3277
  if err != nil
3259
3278
  return nil, err
3260
3279
  end
@@ -3273,13 +3292,13 @@ end
3273
3292
  # == Returns:
3274
3293
  # PhraseApp::ResponseObjects::TranslationDetails
3275
3294
  # err
3276
- def self.translation_show(project_id, id)
3295
+ def translation_show(project_id, id)
3277
3296
  path = sprintf("/api/v2/projects/%s/translations/%s", project_id, id)
3278
3297
  data_hash = {}
3279
3298
  post_body = nil
3280
3299
 
3281
3300
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3282
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
3301
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
3283
3302
  if err != nil
3284
3303
  return nil, err
3285
3304
  end
@@ -3300,7 +3319,7 @@ end
3300
3319
  # == Returns:
3301
3320
  # PhraseApp::ResponseObjects::TranslationDetails
3302
3321
  # err
3303
- def self.translation_update(project_id, id, params)
3322
+ def translation_update(project_id, id, params)
3304
3323
  path = sprintf("/api/v2/projects/%s/translations/%s", project_id, id)
3305
3324
  data_hash = {}
3306
3325
  post_body = nil
@@ -3317,7 +3336,7 @@ end
3317
3336
  return nil, err
3318
3337
  end
3319
3338
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3320
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3339
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3321
3340
  if err != nil
3322
3341
  return nil, err
3323
3342
  end
@@ -3338,7 +3357,7 @@ end
3338
3357
  # == Returns:
3339
3358
  # PhraseApp::ResponseObjects::Translation
3340
3359
  # err
3341
- def self.translations_by_key(project_id, key_id, page, per_page, params)
3360
+ def translations_by_key(project_id, key_id, page, per_page, params)
3342
3361
  path = sprintf("/api/v2/projects/%s/keys/%s/translations", project_id, key_id)
3343
3362
  data_hash = {}
3344
3363
  post_body = nil
@@ -3355,7 +3374,7 @@ end
3355
3374
  return nil, err
3356
3375
  end
3357
3376
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3358
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3377
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3359
3378
  if err != nil
3360
3379
  return nil, err
3361
3380
  end
@@ -3376,7 +3395,7 @@ end
3376
3395
  # == Returns:
3377
3396
  # PhraseApp::ResponseObjects::Translation
3378
3397
  # err
3379
- def self.translations_by_locale(project_id, locale_id, page, per_page, params)
3398
+ def translations_by_locale(project_id, locale_id, page, per_page, params)
3380
3399
  path = sprintf("/api/v2/projects/%s/locales/%s/translations", project_id, locale_id)
3381
3400
  data_hash = {}
3382
3401
  post_body = nil
@@ -3393,7 +3412,7 @@ end
3393
3412
  return nil, err
3394
3413
  end
3395
3414
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3396
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3415
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3397
3416
  if err != nil
3398
3417
  return nil, err
3399
3418
  end
@@ -3412,7 +3431,7 @@ end
3412
3431
  # == Returns:
3413
3432
  # PhraseApp::ResponseObjects::AffectedCount
3414
3433
  # err
3415
- def self.translations_exclude(project_id, params)
3434
+ def translations_exclude(project_id, params)
3416
3435
  path = sprintf("/api/v2/projects/%s/translations/exclude", project_id)
3417
3436
  data_hash = {}
3418
3437
  post_body = nil
@@ -3429,7 +3448,7 @@ end
3429
3448
  return nil, err
3430
3449
  end
3431
3450
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3432
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3451
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3433
3452
  if err != nil
3434
3453
  return nil, err
3435
3454
  end
@@ -3448,7 +3467,7 @@ end
3448
3467
  # == Returns:
3449
3468
  # PhraseApp::ResponseObjects::AffectedCount
3450
3469
  # err
3451
- def self.translations_include(project_id, params)
3470
+ def translations_include(project_id, params)
3452
3471
  path = sprintf("/api/v2/projects/%s/translations/include", project_id)
3453
3472
  data_hash = {}
3454
3473
  post_body = nil
@@ -3465,7 +3484,7 @@ end
3465
3484
  return nil, err
3466
3485
  end
3467
3486
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3468
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3487
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3469
3488
  if err != nil
3470
3489
  return nil, err
3471
3490
  end
@@ -3484,7 +3503,7 @@ end
3484
3503
  # == Returns:
3485
3504
  # PhraseApp::ResponseObjects::Translation
3486
3505
  # err
3487
- def self.translations_list(project_id, page, per_page, params)
3506
+ def translations_list(project_id, page, per_page, params)
3488
3507
  path = sprintf("/api/v2/projects/%s/translations", project_id)
3489
3508
  data_hash = {}
3490
3509
  post_body = nil
@@ -3501,7 +3520,7 @@ end
3501
3520
  return nil, err
3502
3521
  end
3503
3522
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3504
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3523
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3505
3524
  if err != nil
3506
3525
  return nil, err
3507
3526
  end
@@ -3520,7 +3539,7 @@ end
3520
3539
  # == Returns:
3521
3540
  # PhraseApp::ResponseObjects::Translation
3522
3541
  # err
3523
- def self.translations_search(project_id, page, per_page, params)
3542
+ def translations_search(project_id, page, per_page, params)
3524
3543
  path = sprintf("/api/v2/projects/%s/translations/search", project_id)
3525
3544
  data_hash = {}
3526
3545
  post_body = nil
@@ -3537,7 +3556,7 @@ end
3537
3556
  return nil, err
3538
3557
  end
3539
3558
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3540
- rc, err = PhraseApp.send_request_paginated("POST", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3559
+ rc, err = PhraseApp.send_request_paginated(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3541
3560
  if err != nil
3542
3561
  return nil, err
3543
3562
  end
@@ -3556,7 +3575,7 @@ end
3556
3575
  # == Returns:
3557
3576
  # PhraseApp::ResponseObjects::AffectedCount
3558
3577
  # err
3559
- def self.translations_unverify(project_id, params)
3578
+ def translations_unverify(project_id, params)
3560
3579
  path = sprintf("/api/v2/projects/%s/translations/unverify", project_id)
3561
3580
  data_hash = {}
3562
3581
  post_body = nil
@@ -3573,7 +3592,7 @@ end
3573
3592
  return nil, err
3574
3593
  end
3575
3594
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3576
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3595
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3577
3596
  if err != nil
3578
3597
  return nil, err
3579
3598
  end
@@ -3592,7 +3611,7 @@ end
3592
3611
  # == Returns:
3593
3612
  # PhraseApp::ResponseObjects::AffectedCount
3594
3613
  # err
3595
- def self.translations_verify(project_id, params)
3614
+ def translations_verify(project_id, params)
3596
3615
  path = sprintf("/api/v2/projects/%s/translations/verify", project_id)
3597
3616
  data_hash = {}
3598
3617
  post_body = nil
@@ -3609,7 +3628,7 @@ end
3609
3628
  return nil, err
3610
3629
  end
3611
3630
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3612
- rc, err = PhraseApp.send_request("PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3631
+ rc, err = PhraseApp.send_request(@credentials, "PATCH", path, reqHelper.ctype, reqHelper.body, 200)
3613
3632
  if err != nil
3614
3633
  return nil, err
3615
3634
  end
@@ -3628,7 +3647,7 @@ end
3628
3647
  # == Returns:
3629
3648
  # PhraseApp::ResponseObjects::LocaleFileImportWithSummary
3630
3649
  # err
3631
- def self.upload_create(project_id, params)
3650
+ def upload_create(project_id, params)
3632
3651
  path = sprintf("/api/v2/projects/%s/uploads", project_id)
3633
3652
  data_hash = {}
3634
3653
  post_body = nil
@@ -3679,7 +3698,7 @@ end
3679
3698
 
3680
3699
 
3681
3700
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3682
- rc, err = PhraseApp.send_request("POST", path, reqHelper.ctype, reqHelper.body, 201)
3701
+ rc, err = PhraseApp.send_request(@credentials, "POST", path, reqHelper.ctype, reqHelper.body, 201)
3683
3702
  if err != nil
3684
3703
  return nil, err
3685
3704
  end
@@ -3698,13 +3717,13 @@ end
3698
3717
  # == Returns:
3699
3718
  # PhraseApp::ResponseObjects::LocaleFileImportWithSummary
3700
3719
  # err
3701
- def self.upload_show(project_id, id)
3720
+ def upload_show(project_id, id)
3702
3721
  path = sprintf("/api/v2/projects/%s/uploads/%s", project_id, id)
3703
3722
  data_hash = {}
3704
3723
  post_body = nil
3705
3724
 
3706
3725
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3707
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
3726
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
3708
3727
  if err != nil
3709
3728
  return nil, err
3710
3729
  end
@@ -3712,6 +3731,29 @@ end
3712
3731
  return PhraseApp::ResponseObjects::LocaleFileImportWithSummary.new(JSON.load(rc.body)), err
3713
3732
  end
3714
3733
 
3734
+ # List all uploads for the given project.
3735
+ # API Path: /v2/projects/:project_id/uploads
3736
+ # == Parameters:
3737
+ # project_id::
3738
+ # project_id
3739
+ #
3740
+ # == Returns:
3741
+ # PhraseApp::ResponseObjects::LocaleFileImportWithSummary
3742
+ # err
3743
+ def uploads_list(project_id, page, per_page)
3744
+ path = sprintf("/api/v2/projects/%s/uploads", project_id)
3745
+ data_hash = {}
3746
+ post_body = nil
3747
+
3748
+ reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3749
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3750
+ if err != nil
3751
+ return nil, err
3752
+ end
3753
+
3754
+ return JSON.load(rc.body).map { |item| PhraseApp::ResponseObjects::LocaleFileImportWithSummary.new(item) }, err
3755
+ end
3756
+
3715
3757
  # Get details on a single version.
3716
3758
  # API Path: /v2/projects/:project_id/translations/:translation_id/versions/:id
3717
3759
  # == Parameters:
@@ -3725,13 +3767,13 @@ end
3725
3767
  # == Returns:
3726
3768
  # PhraseApp::ResponseObjects::TranslationVersionWithUser
3727
3769
  # err
3728
- def self.version_show(project_id, translation_id, id)
3770
+ def version_show(project_id, translation_id, id)
3729
3771
  path = sprintf("/api/v2/projects/%s/translations/%s/versions/%s", project_id, translation_id, id)
3730
3772
  data_hash = {}
3731
3773
  post_body = nil
3732
3774
 
3733
3775
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3734
- rc, err = PhraseApp.send_request("GET", path, reqHelper.ctype, reqHelper.body, 200)
3776
+ rc, err = PhraseApp.send_request(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200)
3735
3777
  if err != nil
3736
3778
  return nil, err
3737
3779
  end
@@ -3750,13 +3792,13 @@ end
3750
3792
  # == Returns:
3751
3793
  # PhraseApp::ResponseObjects::TranslationVersion
3752
3794
  # err
3753
- def self.versions_list(project_id, translation_id, page, per_page)
3795
+ def versions_list(project_id, translation_id, page, per_page)
3754
3796
  path = sprintf("/api/v2/projects/%s/translations/%s/versions", project_id, translation_id)
3755
3797
  data_hash = {}
3756
3798
  post_body = nil
3757
3799
 
3758
3800
  reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)
3759
- rc, err = PhraseApp.send_request_paginated("GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3801
+ rc, err = PhraseApp.send_request_paginated(@credentials, "GET", path, reqHelper.ctype, reqHelper.body, 200, page, per_page)
3760
3802
  if err != nil
3761
3803
  return nil, err
3762
3804
  end