lingotek-client 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/VERSION +1 -0
- data/lib/VERSION +1 -0
- data/lib/lingotek-client/api.rb +58 -0
- data/lib/lingotek-client/api_schema.rb +178 -0
- data/lib/lingotek-client/schema.rb +37 -0
- data/lib/lingotek-client/version.rb +3 -0
- data/lib/lingotek-client.rb +5 -0
- data/update_schema/table.html +1481 -0
- data/update_schema/test +357 -0
- data/update_schema/update_schema +52 -0
- metadata +109 -0
data/update_schema/test
ADDED
@@ -0,0 +1,357 @@
|
|
1
|
+
{:acceptExternalInvite=>{:required=>["invite_id"], :optional=>[]},
|
2
|
+
:addCommunityDictionaryEntry=>{:required=>["type", "entry"], :optional=>[]},
|
3
|
+
:addCompany=>{:required=>["companyName"], :optional=>[]},
|
4
|
+
:addContact=>{:required=>["userEmail"], :optional=>["comment"]},
|
5
|
+
:addContentDocument=>
|
6
|
+
{:required=>
|
7
|
+
["projectId",
|
8
|
+
"content",
|
9
|
+
"documentName",
|
10
|
+
"sourceLanguage",
|
11
|
+
"tmVaultId",
|
12
|
+
"format"],
|
13
|
+
:optional=>
|
14
|
+
["documentDesc",
|
15
|
+
"note",
|
16
|
+
"srxFileContents",
|
17
|
+
"itsFileContents",
|
18
|
+
"fprmFileContents",
|
19
|
+
"secondaryFilter",
|
20
|
+
"secondaryFprmFileContents",
|
21
|
+
"placeholderMode",
|
22
|
+
"priority"]},
|
23
|
+
:addDocument=>
|
24
|
+
{:required=>
|
25
|
+
["projectId",
|
26
|
+
"file",
|
27
|
+
"documentName",
|
28
|
+
"format",
|
29
|
+
"encoding",
|
30
|
+
"sourceLanguage",
|
31
|
+
"tmVaultId"],
|
32
|
+
:optional=>
|
33
|
+
["tmTarget",
|
34
|
+
"zipFile",
|
35
|
+
"note",
|
36
|
+
"srxFile",
|
37
|
+
"itsFile",
|
38
|
+
"fprmFile",
|
39
|
+
"secondaryFilter",
|
40
|
+
"secondaryFprmFile",
|
41
|
+
"placeholderMode",
|
42
|
+
"priority"]},
|
43
|
+
:addDocumentURL=>
|
44
|
+
{:required=>["projectId", "url", "sourceLanguage", "tmVaultId"],
|
45
|
+
:optional=>
|
46
|
+
["format",
|
47
|
+
"target",
|
48
|
+
"tmTarget",
|
49
|
+
"template",
|
50
|
+
"depth",
|
51
|
+
"srxFile",
|
52
|
+
"itsFile",
|
53
|
+
"fprmFile",
|
54
|
+
"secondaryFilter",
|
55
|
+
"secondaryFprmFile",
|
56
|
+
"placeholderMode",
|
57
|
+
"priority"]},
|
58
|
+
:addDocumentWithTargets=>
|
59
|
+
{:required=>
|
60
|
+
["projectId",
|
61
|
+
"file",
|
62
|
+
"applyWorkflow",
|
63
|
+
"documentName",
|
64
|
+
"format",
|
65
|
+
"encoding",
|
66
|
+
"phaseTemplateId",
|
67
|
+
"sourceLanguage",
|
68
|
+
"tmVaultId"],
|
69
|
+
:optional=>["targetLanguage", "targetAsJSON", "tmTarget", "zipFile"]},
|
70
|
+
:addGlossary=>{:required=>["glossaryName", "asTerminology"], :optional=>[]},
|
71
|
+
:addLabel=>{:required=>["name"], :optional=>["status"]},
|
72
|
+
:addPhase=>
|
73
|
+
{:required=>["translationTargetId", "phaseName"],
|
74
|
+
:optional=>["phaseDescription", "isCommunityAccess", "isSelfAssigned"]},
|
75
|
+
:"addPhaseTemplate (deprecated)"=>
|
76
|
+
{:required=>["phaseTemplateName"], :optional=>[]},
|
77
|
+
:"addPhaseToTemplate (deprecated)"=>
|
78
|
+
{:required=>["phaseTemplateId", "phaseName"],
|
79
|
+
:optional=>["phaseDescription", "isCommunityAccess", "isSelfAssigned"]},
|
80
|
+
:addPreference=>{:required=>["key"], :optional=>["value"]},
|
81
|
+
:addProject=>
|
82
|
+
{:required=>["projectName"],
|
83
|
+
:optional=>["projectDueDate", "companyId", "workflowId", "searchPublic"]},
|
84
|
+
:addProjectDictionary=>
|
85
|
+
{:required=>["project_id", "dictionary_id"], :optional=>[]},
|
86
|
+
:addProjectMT=>{:required=>["project_id", "mt_engine_name"], :optional=>[]},
|
87
|
+
:addProjectTMVault=>
|
88
|
+
{:required=>["tmVaultName", "project_id", "index_id"],
|
89
|
+
:optional=>["isPublic"]},
|
90
|
+
:addSegmentLabelTemplate=>
|
91
|
+
{:required=>["segmentLabelTemplateName"], :optional=>["segmentLabels"]},
|
92
|
+
:addSegmentLabelToTemplate=>
|
93
|
+
{:required=>["segmentLabelTemplateName", "segmentLabels"], :optional=>[]},
|
94
|
+
:addTeam=>{:required=>["name"], :optional=>["description", "image"]},
|
95
|
+
:addTeamLead=>{:required=>["teamId", "clientId"], :optional=>[]},
|
96
|
+
:addTeamMember=>{:required=>["teamId", "clientId"], :optional=>[]},
|
97
|
+
:addTMVault=>{:required=>["tmVaultName"], :optional=>["isPublic"]},
|
98
|
+
:addTranslationTarget=>
|
99
|
+
{:required=>["documentId", "applyWorkflow", "targetLanguage"],
|
100
|
+
:optional=>[]},
|
101
|
+
:analyzeDocument=>{:required=>["documentId"], :optional=>[]},
|
102
|
+
:analyzeProject=>{:required=>["projectId", "documentId"], :optional=>[]},
|
103
|
+
:"applyPhaseTemplate (deprecated)"=>
|
104
|
+
{:required=>["translationTargetId", "phaseTemplateId"], :optional=>[]},
|
105
|
+
:applySegmentLabelTemplate=>
|
106
|
+
{:required=>["documentId", "segmentLabelTemplateName"], :optional=>[]},
|
107
|
+
:assignPhaseTranslator=>
|
108
|
+
{:required=>["phaseId", "translatorUserId"], :optional=>[]},
|
109
|
+
:assignProjectManager=>
|
110
|
+
{:required=>["projectId"], :optional=>["managerLoginName", "managerUserId"]},
|
111
|
+
:assignSelf=>{:required=>["phaseId"], :optional=>[]},
|
112
|
+
:"backgroundJobProgress (deprecated)"=>
|
113
|
+
{:required=>["queueId"], :optional=>[]},
|
114
|
+
:declineExternalInvite=>{:required=>["invite_id", "phase"], :optional=>[]},
|
115
|
+
:dismissPhaseTranslator=>
|
116
|
+
{:required=>["phaseId", "translatorUserId"], :optional=>[]},
|
117
|
+
:dismissProjectManager=>
|
118
|
+
{:required=>["projectId", "managerUserId"], :optional=>[]},
|
119
|
+
:documentSegments=>{:required=>["documentId"], :optional=>[]},
|
120
|
+
:downloadDocument=>
|
121
|
+
{:required=>["documentId", "targetLanguage"],
|
122
|
+
:optional=>["useSource", "useAttributions"]},
|
123
|
+
:downloadDocumentAsCSV=>
|
124
|
+
{:required=>["documentId", "targetLanguage"], :optional=>[]},
|
125
|
+
:downloadDocumentAsSkeleton=>{:required=>["documentId"], :optional=>[]},
|
126
|
+
:downloadDocumentAsTMX=>
|
127
|
+
{:required=>["documentId"], :optional=>["targetLanguage"]},
|
128
|
+
:downloadDocumentAsXliff=>
|
129
|
+
{:required=>["documentId"], :optional=>["targetLanguage"]},
|
130
|
+
:downloadDocumentContent=>
|
131
|
+
{:required=>["documentId", "targetLanguage"], :optional=>[]},
|
132
|
+
:downloadExport=>{:required=>["resourceType", "exportId"], :optional=>[]},
|
133
|
+
:"downloadGlossaryAsCSV (deprecated)"=>
|
134
|
+
{:required=>["glossaryId", "sourceLanguage"], :optional=>["targetLanguage"]},
|
135
|
+
:"downloadGlossaryAsTBX (deprecated)"=>
|
136
|
+
{:required=>["glossaryId", "sourceLanguage"], :optional=>["targetLanguage"]},
|
137
|
+
:"downloadTMVaultAsTMX (deprecated)"=>
|
138
|
+
{:required=>["tmVaultId", "sourceLanguage"], :optional=>["targetLanguage"]},
|
139
|
+
:"downloadTMVaultAsXliff (deprecated)"=>
|
140
|
+
{:required=>["tmVaultId", "sourceLanguage"], :optional=>["targetLanguage"]},
|
141
|
+
:editClientCommunityPreference=>{:required=>["key", "value"], :optional=>[]},
|
142
|
+
:editCompany=>{:required=>["companyId"], :optional=>["companyName"]},
|
143
|
+
:editContact=>{:required=>["contactId"], :optional=>["comment"]},
|
144
|
+
:editDocument=>
|
145
|
+
{:required=>["documentId"], :optional=>["documentName", "tmVaultId"]},
|
146
|
+
:editDocumentSetting=>
|
147
|
+
{:required=>["documentId", "type", "key", "value"], :optional=>[]},
|
148
|
+
:editGlossary=>{:required=>["glossaryId"], :optional=>["glossaryName"]},
|
149
|
+
:editLabel=>
|
150
|
+
{:required=>["id"],
|
151
|
+
:optional=>
|
152
|
+
["name",
|
153
|
+
"status",
|
154
|
+
"order",
|
155
|
+
"offset",
|
156
|
+
"move_to_label",
|
157
|
+
"show_percent_complete"]},
|
158
|
+
:editPhase=>
|
159
|
+
{:required=>["phaseId"],
|
160
|
+
:optional=>
|
161
|
+
["phaseName", "phaseDescription", "isCommunityAccess", "isSelfAssigned"]},
|
162
|
+
:"editPhaseTemplate (deprecated)"=>
|
163
|
+
{:required=>["phaseTemplateId"], :optional=>["phaseTemplateName"]},
|
164
|
+
:editPreference=>{:required=>["key", "value"], :optional=>[]},
|
165
|
+
:editProject=>
|
166
|
+
{:required=>["projectId"],
|
167
|
+
:optional=>["projectName", "projectDueDate", "companyId", "searchPublic"]},
|
168
|
+
:editProjectSetting=>
|
169
|
+
{:required=>["projectId", "type", "key", "value"], :optional=>[]},
|
170
|
+
:editSegmentLabelTemplate=>
|
171
|
+
{:required=>["segmentLabelTemplateName"], :optional=>[]},
|
172
|
+
:editTMVault=>
|
173
|
+
{:required=>["tmVaultId"], :optional=>["tmVaultName", "isPublic"]},
|
174
|
+
:editTranslationTarget=>{:required=>["translationTargetId"], :optional=>[]},
|
175
|
+
:exportResource=>
|
176
|
+
{:required=>
|
177
|
+
["resourceType",
|
178
|
+
"resourceId",
|
179
|
+
"format",
|
180
|
+
"targetLanguages",
|
181
|
+
"sourceLanguage"],
|
182
|
+
:optional=>[]},
|
183
|
+
:findLabel=>{:required=>["name", "limit"], :optional=>[]},
|
184
|
+
:findTM=>
|
185
|
+
{:required=>["tmVaultId", "sourceLang", "targetLang"],
|
186
|
+
:optional=>["searchText", "startDate", "endDate"]},
|
187
|
+
:flushDocumentProgress=>{:required=>["documentId"], :optional=>[]},
|
188
|
+
:getClientCommunityPreference=>{:required=>["key"], :optional=>[]},
|
189
|
+
:getCMSKey=>{:required=>[], :optional=>[]},
|
190
|
+
:getCommunityDictionary=>{:required=>["type"], :optional=>[]},
|
191
|
+
:getCommunityPreference=>{:required=>["key", "type"], :optional=>[]},
|
192
|
+
:getCompany=>{:required=>["companyId"], :optional=>[]},
|
193
|
+
:getContact=>{:required=>["contactId"], :optional=>[]},
|
194
|
+
:getDashboardLink=>{:required=>[], :optional=>[]},
|
195
|
+
:getDocument=>{:required=>["documentId"], :optional=>[]},
|
196
|
+
:getDocumentProgress=>{:required=>["documentId"], :optional=>[]},
|
197
|
+
:getDocumentSetting=>
|
198
|
+
{:required=>["documentId", "type", "key"], :optional=>[]},
|
199
|
+
:getExternalInvites=>{:required=>["invite_id"], :optional=>[]},
|
200
|
+
:getGlossary=>{:required=>["glossaryId"], :optional=>[]},
|
201
|
+
:getLabel=>{:required=>[], :optional=>["id", "name"]},
|
202
|
+
:getPhase=>{:required=>["phaseId"], :optional=>[]},
|
203
|
+
:"getPhaseTemplate (deprecated)"=>
|
204
|
+
{:required=>["phaseTemplateId"], :optional=>[]},
|
205
|
+
:getPreference=>{:required=>["key"], :optional=>[]},
|
206
|
+
:getPriorityJobWorkbenchLink=>{:required=>[], :optional=>[]},
|
207
|
+
:getProject=>{:required=>["projectId"], :optional=>[]},
|
208
|
+
:getProjectSetting=>{:required=>["projectId", "type", "key"], :optional=>[]},
|
209
|
+
:getSegmentLabelTemplate=>
|
210
|
+
{:required=>["segmentLabelTemplateName"], :optional=>[]},
|
211
|
+
:getTMVault=>{:required=>["tmVaultId"], :optional=>[]},
|
212
|
+
:getTranslationTarget=>{:required=>["translationTargetId"], :optional=>[]},
|
213
|
+
:getUsers=>{:required=>["search", "limit", "community"], :optional=>[]},
|
214
|
+
:getVaultLanguages=>{:required=>["tmVaultId"], :optional=>[]},
|
215
|
+
:getWorkbenchLink=>
|
216
|
+
{:required=>["documentId", "phaseId", "invite_id", "embedded"],
|
217
|
+
:optional=>["redirectURL"]},
|
218
|
+
:ignoreSegment=>{:required=>["segmentId", "documentId"], :optional=>[]},
|
219
|
+
:importCommunityDictionary=>
|
220
|
+
{:required=>["type", "file", "delimiter"], :optional=>[]},
|
221
|
+
:joinTeam=>{:required=>["teamId"], :optional=>[]},
|
222
|
+
:leaveTeam=>{:required=>["teamId"], :optional=>[]},
|
223
|
+
:listAssignedProjects=>{:required=>[], :optional=>[]},
|
224
|
+
:listCommunities=>{:required=>[], :optional=>[]},
|
225
|
+
:listCompanies=>{:required=>[], :optional=>[]},
|
226
|
+
:listContacts=>{:required=>[], :optional=>[]},
|
227
|
+
:"listDefaultPhaseTemplates (deprecated)"=>{:required=>[], :optional=>[]},
|
228
|
+
:listDocuments=>{:required=>["documentId"], :optional=>[]},
|
229
|
+
:listDocumentSegmentLabels=>{:required=>["documentId"], :optional=>[]},
|
230
|
+
:listDocumentSegments=>{:required=>["documentId"], :optional=>[]},
|
231
|
+
:listDocumentTranslationSegments=>
|
232
|
+
{:required=>["documentId", "targetLanguage"], :optional=>[]},
|
233
|
+
:listGlossaries=>{:required=>[], :optional=>[]},
|
234
|
+
:listJobs=>{:required=>[], :optional=>[]},
|
235
|
+
:listLabels=>{:required=>[], :optional=>[]},
|
236
|
+
:listLanguages=>{:required=>[], :optional=>["language"]},
|
237
|
+
:listLanguageSkills=>{:required=>[], :optional=>[]},
|
238
|
+
:listLeaderboardRange=>
|
239
|
+
{:required=>[], :optional=>["teamName", "startDate", "endDate"]},
|
240
|
+
:listLeaderboardResults=>
|
241
|
+
{:required=>[], :optional=>["teamName", "maxResults"]},
|
242
|
+
:listPhases=>{:required=>["translationTargetId"], :optional=>[]},
|
243
|
+
:"listPhaseTemplates (deprecated)"=>{:required=>[], :optional=>[]},
|
244
|
+
:listProjects=>{:required=>[], :optional=>[]},
|
245
|
+
:listSegmentLabelTemplates=>{:required=>[], :optional=>[]},
|
246
|
+
:listTeamMembers=>{:required=>["teamId"], :optional=>[]},
|
247
|
+
:listTeams=>{:required=>[], :optional=>[]},
|
248
|
+
:listTMDocuments=>{:required=>["tmVaultId"], :optional=>[]},
|
249
|
+
:listTMVaults=>{:required=>[], :optional=>[]},
|
250
|
+
:listTranslationTargets=>{:required=>["documentId"], :optional=>[]},
|
251
|
+
:listUserStats=>{:required=>[], :optional=>[]},
|
252
|
+
:listWorkflows=>{:required=>[], :optional=>[]},
|
253
|
+
:machineTranslateDocument=>
|
254
|
+
{:required=>["documentId", "engineId", "phaseId"], :optional=>[]},
|
255
|
+
:markPhaseComplete=>{:required=>["phaseId"], :optional=>[]},
|
256
|
+
:MTSegments=>{:required=>["documentId", "json"], :optional=>[]},
|
257
|
+
:pollClientReport=>{:required=>["report_name"], :optional=>[]},
|
258
|
+
:pollDocumentAnalysis=>{:required=>["documentId"], :optional=>[]},
|
259
|
+
:pollDocumentImport=>{:required=>["documentId"], :optional=>[]},
|
260
|
+
:pollGlossaryImport=>{:required=>["glossaryUploadId"], :optional=>[]},
|
261
|
+
:pollProjectAnalysis=>{:required=>["projectId"], :optional=>[]},
|
262
|
+
:pollTMVaultImport=>{:required=>["tmVaultUploadId"], :optional=>[]},
|
263
|
+
:prefillDocument=>
|
264
|
+
{:required=>
|
265
|
+
["phaseId",
|
266
|
+
"tmVaultId",
|
267
|
+
"tmVaultThreshold",
|
268
|
+
"lockTMVault",
|
269
|
+
"lockTerminology",
|
270
|
+
"overwrite",
|
271
|
+
"completePhase"],
|
272
|
+
:optional=>[]},
|
273
|
+
:regardSegment=>{:required=>["segmentId", "documentId"], :optional=>[]},
|
274
|
+
:removeClientCommunityPreference=>{:required=>["key"], :optional=>[]},
|
275
|
+
:removeCommunityDictionaryEntry=>
|
276
|
+
{:required=>["type", "entry"], :optional=>[]},
|
277
|
+
:removeCompany=>{:required=>["companyId"], :optional=>[]},
|
278
|
+
:removeContact=>{:required=>["contactId"], :optional=>[]},
|
279
|
+
:removeDocument=>{:required=>["documentId"], :optional=>[]},
|
280
|
+
:removeGlossary=>{:required=>["glossaryId"], :optional=>[]},
|
281
|
+
:removeLabel=>{:required=>["id"], :optional=>[]},
|
282
|
+
:removePhase=>{:required=>["phaseId"], :optional=>[]},
|
283
|
+
:removePhaseFromTemplate=>
|
284
|
+
{:required=>["phaseTemplateId", "phaseParameterSetId"], :optional=>[]},
|
285
|
+
:"removePhaseTemplate (deprecated)"=>
|
286
|
+
{:required=>["phaseTemplateId"], :optional=>[]},
|
287
|
+
:removePreference=>{:required=>["key"], :optional=>[]},
|
288
|
+
:removeProject=>{:required=>["projectId"], :optional=>[]},
|
289
|
+
:removeSegmentLabelFromTemplate=>
|
290
|
+
{:required=>["segmentLabelTemplateName", "segmentLabels"], :optional=>[]},
|
291
|
+
:removeSegmentLabelTemplate=>
|
292
|
+
{:required=>["segmentLabelTemplateName"], :optional=>[]},
|
293
|
+
:removeTeam=>{:required=>["teamId"], :optional=>[]},
|
294
|
+
:removeTeamLead=>{:required=>["teamId", "clientId"], :optional=>[]},
|
295
|
+
:removeTeamMember=>{:required=>["teamId", "clientId"], :optional=>[]},
|
296
|
+
:removeTM=>{:required=>["tmVaultId", "tid"], :optional=>[]},
|
297
|
+
:removeTMVault=>{:required=>["tmVaultId"], :optional=>[]},
|
298
|
+
:removeTranslationTarget=>{:required=>["translationTargetId"], :optional=>[]},
|
299
|
+
:removeUploadedTMFromVault=>{:required=>["id"], :optional=>[]},
|
300
|
+
:saveLabelTemplate=>{:required=>["name"], :optional=>["labels"]},
|
301
|
+
:saveSegment=>
|
302
|
+
{:required=>
|
303
|
+
["sourceText", "targetText", "targetLanguage", "documentId", "overwrite"],
|
304
|
+
:optional=>[]},
|
305
|
+
:searchGlossary=>
|
306
|
+
{:required=>["glossaryId", "text", "sourceLanguage", "targetLanguage"],
|
307
|
+
:optional=>["count"]},
|
308
|
+
:setCommunityConcurrentUsers=>
|
309
|
+
{:required=>["community", "users"], :optional=>[]},
|
310
|
+
:setProfileAttributes=>
|
311
|
+
{:required=>[],
|
312
|
+
:optional=>
|
313
|
+
["name",
|
314
|
+
"email",
|
315
|
+
"login_id",
|
316
|
+
"phone",
|
317
|
+
"company",
|
318
|
+
"native_language",
|
319
|
+
"location",
|
320
|
+
"notes",
|
321
|
+
"on_leaderboard",
|
322
|
+
"oldpword",
|
323
|
+
"newpword",
|
324
|
+
"source",
|
325
|
+
"old_source",
|
326
|
+
"target",
|
327
|
+
"old_target",
|
328
|
+
"experience",
|
329
|
+
"rate",
|
330
|
+
"rush_rate",
|
331
|
+
"currency",
|
332
|
+
"per",
|
333
|
+
"service_note",
|
334
|
+
"notifications_project_complete",
|
335
|
+
"notifications_assigned_document",
|
336
|
+
"notifications_available_community_document",
|
337
|
+
"notifications_phase_ready"]},
|
338
|
+
:translatorsForLanguage=>
|
339
|
+
{:required=>["sourceLang", "targetLang"], :optional=>[]},
|
340
|
+
:updateContentDocument=>
|
341
|
+
{:required=>["documentId", "content"],
|
342
|
+
:optional=>
|
343
|
+
["srxFileContents",
|
344
|
+
"itsFileContents",
|
345
|
+
"fprmFileContents",
|
346
|
+
"secondaryFprmFileContents"]},
|
347
|
+
:updateDocument=>{:required=>["documentId", "file"], :optional=>[]},
|
348
|
+
:updateTM=>{:required=>["tmVaultId", "tid", "translation"], :optional=>[]},
|
349
|
+
:uploadCSVToGlossary=>
|
350
|
+
{:required=>["glossaryId", "file"], :optional=>["delimiter"]},
|
351
|
+
:uploadTBXToGlossary=>{:required=>["glossaryId", "file"], :optional=>[]},
|
352
|
+
:uploadTMXToTMVault=>
|
353
|
+
{:required=>["tmVaultId", "file", "name"], :optional=>[]},
|
354
|
+
:uploadXliffToTMVault=>
|
355
|
+
{:required=>["tmVaultId", "file", "name"], :optional=>[]},
|
356
|
+
:uploadXLSToGlossary=>{:required=>["glossaryId", "file"], :optional=>[]},
|
357
|
+
:userState=>{:required=>["clientId"], :optional=>[]}}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'nokogiri'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
def format(h)
|
7
|
+
s = " {\n"
|
8
|
+
h.each do |k,v|
|
9
|
+
s << " #{k.to_s}: { required: #{v[:required].to_s}, optional: #{v[:optional].to_s}"
|
10
|
+
s << ", is_deprecated: true" if v[:is_deprecated]
|
11
|
+
s << "},\n"
|
12
|
+
end
|
13
|
+
s << " }\n"
|
14
|
+
end
|
15
|
+
|
16
|
+
html = Nokogiri::HTML(File.read('table.html'))
|
17
|
+
|
18
|
+
tds = html.css('td')
|
19
|
+
api_count = tds.count / 2
|
20
|
+
|
21
|
+
apis = {}
|
22
|
+
api_count.times do |i|
|
23
|
+
method_i = i*2
|
24
|
+
input_i = method_i + 1
|
25
|
+
method = tds[method_i].css('a').first.text
|
26
|
+
find_method = %r{(?<method>\w+)\s*(?<is_deprecated>(\(deprecated\))?)}
|
27
|
+
method = method.match(find_method)
|
28
|
+
is_deprecated = !(method[:is_deprecated].nil? || method[:is_deprecated].empty?)
|
29
|
+
method = method[:method]
|
30
|
+
required = []
|
31
|
+
optional = []
|
32
|
+
tds[input_i].css('code').each do |input|
|
33
|
+
if input.text.end_with?('*')
|
34
|
+
optional << input.text.chomp('*').to_sym
|
35
|
+
else
|
36
|
+
required << input.text.to_sym
|
37
|
+
end
|
38
|
+
end
|
39
|
+
apis[method.to_sym] = { required: required, optional: optional }
|
40
|
+
apis[method.to_sym][:is_deprecated] = true if is_deprecated
|
41
|
+
end
|
42
|
+
|
43
|
+
File.open('../lib/lingotek-client/api_schema.rb', 'w+') do |f|
|
44
|
+
f.puts 'module APISchema'
|
45
|
+
f.puts ' def schema'
|
46
|
+
f.puts "#{format(apis)}"
|
47
|
+
f.puts ' end'
|
48
|
+
f.puts 'end'
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lingotek-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Fernando Ribeiro
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: oauth
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.4.6
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.4.6
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rest-client
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.6.7
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.6.7
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: json
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.7.3
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.7.3
|
62
|
+
description: Client lib for lingotek apis
|
63
|
+
email:
|
64
|
+
- fribeiro@lingotek.com
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files:
|
68
|
+
- LICENSE
|
69
|
+
- README.md
|
70
|
+
files:
|
71
|
+
- lib/lingotek-client/version.rb
|
72
|
+
- lib/lingotek-client/api.rb
|
73
|
+
- lib/lingotek-client/schema.rb
|
74
|
+
- lib/lingotek-client/api_schema.rb
|
75
|
+
- lib/VERSION
|
76
|
+
- lib/lingotek-client.rb
|
77
|
+
- update_schema/update_schema
|
78
|
+
- update_schema/table.html
|
79
|
+
- update_schema/test
|
80
|
+
- VERSION
|
81
|
+
- LICENSE
|
82
|
+
- README.md
|
83
|
+
homepage:
|
84
|
+
licenses: []
|
85
|
+
post_install_message:
|
86
|
+
rdoc_options:
|
87
|
+
- --charset=UTF-8
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.3.6
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project:
|
104
|
+
rubygems_version: 1.8.24
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: Lib that allows to connect with lingotek apis
|
108
|
+
test_files: []
|
109
|
+
has_rdoc:
|