Class: Weblate::Translation

Inherits:
Object
  • Object
show all
Defined in:
lib/weblate/models/translation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Translation

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/weblate/models/translation.rb', line 171

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Weblate::Translation` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Weblate::Translation`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'language')
    self.language = attributes[:'language']
  else
    self.language = nil
  end

  if attributes.key?(:'component')
    self.component = attributes[:'component']
  else
    self.component = nil
  end

  if attributes.key?(:'language_code')
    self.language_code = attributes[:'language_code']
  end

  if attributes.key?(:'id')
    self.id = attributes[:'id']
  else
    self.id = nil
  end

  if attributes.key?(:'filename')
    self.filename = attributes[:'filename']
  else
    self.filename = nil
  end

  if attributes.key?(:'revision')
    self.revision = attributes[:'revision']
  end

  if attributes.key?(:'web_url')
    self.web_url = attributes[:'web_url']
  else
    self.web_url = nil
  end

  if attributes.key?(:'share_url')
    self.share_url = attributes[:'share_url']
  else
    self.share_url = nil
  end

  if attributes.key?(:'translate_url')
    self.translate_url = attributes[:'translate_url']
  else
    self.translate_url = nil
  end

  if attributes.key?(:'url')
    self.url = attributes[:'url']
  else
    self.url = nil
  end

  if attributes.key?(:'is_template')
    self.is_template = attributes[:'is_template']
  else
    self.is_template = nil
  end

  if attributes.key?(:'is_source')
    self.is_source = attributes[:'is_source']
  else
    self.is_source = nil
  end

  if attributes.key?(:'total')
    self.total = attributes[:'total']
  else
    self.total = nil
  end

  if attributes.key?(:'total_words')
    self.total_words = attributes[:'total_words']
  else
    self.total_words = nil
  end

  if attributes.key?(:'translated')
    self.translated = attributes[:'translated']
  else
    self.translated = nil
  end

  if attributes.key?(:'translated_words')
    self.translated_words = attributes[:'translated_words']
  else
    self.translated_words = nil
  end

  if attributes.key?(:'translated_percent')
    self.translated_percent = attributes[:'translated_percent']
  else
    self.translated_percent = nil
  end

  if attributes.key?(:'fuzzy')
    self.fuzzy = attributes[:'fuzzy']
  else
    self.fuzzy = nil
  end

  if attributes.key?(:'fuzzy_words')
    self.fuzzy_words = attributes[:'fuzzy_words']
  else
    self.fuzzy_words = nil
  end

  if attributes.key?(:'fuzzy_percent')
    self.fuzzy_percent = attributes[:'fuzzy_percent']
  else
    self.fuzzy_percent = nil
  end

  if attributes.key?(:'failing_checks')
    self.failing_checks = attributes[:'failing_checks']
  else
    self.failing_checks = nil
  end

  if attributes.key?(:'failing_checks_words')
    self.failing_checks_words = attributes[:'failing_checks_words']
  else
    self.failing_checks_words = nil
  end

  if attributes.key?(:'failing_checks_percent')
    self.failing_checks_percent = attributes[:'failing_checks_percent']
  else
    self.failing_checks_percent = nil
  end

  if attributes.key?(:'have_suggestion')
    self.have_suggestion = attributes[:'have_suggestion']
  else
    self.have_suggestion = nil
  end

  if attributes.key?(:'have_comment')
    self.have_comment = attributes[:'have_comment']
  else
    self.have_comment = nil
  end

  if attributes.key?(:'last_change')
    self.last_change = attributes[:'last_change']
  else
    self.last_change = nil
  end

  if attributes.key?(:'last_author')
    self.last_author = attributes[:'last_author']
  else
    self.last_author = nil
  end

  if attributes.key?(:'repository_url')
    self.repository_url = attributes[:'repository_url']
  else
    self.repository_url = nil
  end

  if attributes.key?(:'file_url')
    self.file_url = attributes[:'file_url']
  else
    self.file_url = nil
  end

  if attributes.key?(:'statistics_url')
    self.statistics_url = attributes[:'statistics_url']
  else
    self.statistics_url = nil
  end

  if attributes.key?(:'changes_list_url')
    self.changes_list_url = attributes[:'changes_list_url']
  else
    self.changes_list_url = nil
  end

  if attributes.key?(:'units_list_url')
    self.units_list_url = attributes[:'units_list_url']
  else
    self.units_list_url = nil
  end
end

Instance Attribute Details

#changes_list_urlObject

Returns the value of attribute changes_list_url.



78
79
80
# File 'lib/weblate/models/translation.rb', line 78

def changes_list_url
  @changes_list_url
end

#componentObject

Returns the value of attribute component.



20
21
22
# File 'lib/weblate/models/translation.rb', line 20

def component
  @component
end

#failing_checksObject

Returns the value of attribute failing_checks.



58
59
60
# File 'lib/weblate/models/translation.rb', line 58

def failing_checks
  @failing_checks
end

#failing_checks_percentObject

Returns the value of attribute failing_checks_percent.



62
63
64
# File 'lib/weblate/models/translation.rb', line 62

def failing_checks_percent
  @failing_checks_percent
end

#failing_checks_wordsObject

Returns the value of attribute failing_checks_words.



60
61
62
# File 'lib/weblate/models/translation.rb', line 60

def failing_checks_words
  @failing_checks_words
end

#file_urlObject

Returns the value of attribute file_url.



74
75
76
# File 'lib/weblate/models/translation.rb', line 74

def file_url
  @file_url
end

#filenameObject

Returns the value of attribute filename.



26
27
28
# File 'lib/weblate/models/translation.rb', line 26

def filename
  @filename
end

#fuzzyObject

Returns the value of attribute fuzzy.



52
53
54
# File 'lib/weblate/models/translation.rb', line 52

def fuzzy
  @fuzzy
end

#fuzzy_percentObject

Returns the value of attribute fuzzy_percent.



56
57
58
# File 'lib/weblate/models/translation.rb', line 56

def fuzzy_percent
  @fuzzy_percent
end

#fuzzy_wordsObject

Returns the value of attribute fuzzy_words.



54
55
56
# File 'lib/weblate/models/translation.rb', line 54

def fuzzy_words
  @fuzzy_words
end

#have_commentObject

Returns the value of attribute have_comment.



66
67
68
# File 'lib/weblate/models/translation.rb', line 66

def have_comment
  @have_comment
end

#have_suggestionObject

Returns the value of attribute have_suggestion.



64
65
66
# File 'lib/weblate/models/translation.rb', line 64

def have_suggestion
  @have_suggestion
end

#idObject

Returns the value of attribute id.



24
25
26
# File 'lib/weblate/models/translation.rb', line 24

def id
  @id
end

#is_sourceObject

Returns the value of attribute is_source.



40
41
42
# File 'lib/weblate/models/translation.rb', line 40

def is_source
  @is_source
end

#is_templateObject

Returns the value of attribute is_template.



38
39
40
# File 'lib/weblate/models/translation.rb', line 38

def is_template
  @is_template
end

#languageObject

Returns the value of attribute language.



18
19
20
# File 'lib/weblate/models/translation.rb', line 18

def language
  @language
end

#language_codeObject

Returns the value of attribute language_code.



22
23
24
# File 'lib/weblate/models/translation.rb', line 22

def language_code
  @language_code
end

#last_authorObject

Returns the value of attribute last_author.



70
71
72
# File 'lib/weblate/models/translation.rb', line 70

def last_author
  @last_author
end

#last_changeObject

Returns the value of attribute last_change.



68
69
70
# File 'lib/weblate/models/translation.rb', line 68

def last_change
  @last_change
end

#repository_urlObject

Returns the value of attribute repository_url.



72
73
74
# File 'lib/weblate/models/translation.rb', line 72

def repository_url
  @repository_url
end

#revisionObject

Returns the value of attribute revision.



28
29
30
# File 'lib/weblate/models/translation.rb', line 28

def revision
  @revision
end

#share_urlObject

Returns the value of attribute share_url.



32
33
34
# File 'lib/weblate/models/translation.rb', line 32

def share_url
  @share_url
end

#statistics_urlObject

Returns the value of attribute statistics_url.



76
77
78
# File 'lib/weblate/models/translation.rb', line 76

def statistics_url
  @statistics_url
end

#totalObject

Returns the value of attribute total.



42
43
44
# File 'lib/weblate/models/translation.rb', line 42

def total
  @total
end

#total_wordsObject

Returns the value of attribute total_words.



44
45
46
# File 'lib/weblate/models/translation.rb', line 44

def total_words
  @total_words
end

#translate_urlObject

Returns the value of attribute translate_url.



34
35
36
# File 'lib/weblate/models/translation.rb', line 34

def translate_url
  @translate_url
end

#translatedObject

Returns the value of attribute translated.



46
47
48
# File 'lib/weblate/models/translation.rb', line 46

def translated
  @translated
end

#translated_percentObject

Returns the value of attribute translated_percent.



50
51
52
# File 'lib/weblate/models/translation.rb', line 50

def translated_percent
  @translated_percent
end

#translated_wordsObject

Returns the value of attribute translated_words.



48
49
50
# File 'lib/weblate/models/translation.rb', line 48

def translated_words
  @translated_words
end

#units_list_urlObject

Returns the value of attribute units_list_url.



80
81
82
# File 'lib/weblate/models/translation.rb', line 80

def units_list_url
  @units_list_url
end

#urlObject

Returns the value of attribute url.



36
37
38
# File 'lib/weblate/models/translation.rb', line 36

def url
  @url
end

#web_urlObject

Returns the value of attribute web_url.



30
31
32
# File 'lib/weblate/models/translation.rb', line 30

def web_url
  @web_url
end

Class Method Details

._deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
# File 'lib/weblate/models/translation.rb', line 673

def self._deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = Weblate.const_get(type)
    klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



121
122
123
# File 'lib/weblate/models/translation.rb', line 121

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/weblate/models/translation.rb', line 83

def self.attribute_map
  {
    :'language' => :'language',
    :'component' => :'component',
    :'language_code' => :'language_code',
    :'id' => :'id',
    :'filename' => :'filename',
    :'revision' => :'revision',
    :'web_url' => :'web_url',
    :'share_url' => :'share_url',
    :'translate_url' => :'translate_url',
    :'url' => :'url',
    :'is_template' => :'is_template',
    :'is_source' => :'is_source',
    :'total' => :'total',
    :'total_words' => :'total_words',
    :'translated' => :'translated',
    :'translated_words' => :'translated_words',
    :'translated_percent' => :'translated_percent',
    :'fuzzy' => :'fuzzy',
    :'fuzzy_words' => :'fuzzy_words',
    :'fuzzy_percent' => :'fuzzy_percent',
    :'failing_checks' => :'failing_checks',
    :'failing_checks_words' => :'failing_checks_words',
    :'failing_checks_percent' => :'failing_checks_percent',
    :'have_suggestion' => :'have_suggestion',
    :'have_comment' => :'have_comment',
    :'last_change' => :'last_change',
    :'last_author' => :'last_author',
    :'repository_url' => :'repository_url',
    :'file_url' => :'file_url',
    :'statistics_url' => :'statistics_url',
    :'changes_list_url' => :'changes_list_url',
    :'units_list_url' => :'units_list_url'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/weblate/models/translation.rb', line 649

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullableObject

List of attributes with nullable: true



164
165
166
167
# File 'lib/weblate/models/translation.rb', line 164

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/weblate/models/translation.rb', line 126

def self.openapi_types
  {
    :'language' => :'Language',
    :'component' => :'Component',
    :'language_code' => :'String',
    :'id' => :'Integer',
    :'filename' => :'String',
    :'revision' => :'String',
    :'web_url' => :'String',
    :'share_url' => :'String',
    :'translate_url' => :'String',
    :'url' => :'String',
    :'is_template' => :'Boolean',
    :'is_source' => :'Boolean',
    :'total' => :'Integer',
    :'total_words' => :'Integer',
    :'translated' => :'Integer',
    :'translated_words' => :'Integer',
    :'translated_percent' => :'Float',
    :'fuzzy' => :'Integer',
    :'fuzzy_words' => :'Integer',
    :'fuzzy_percent' => :'Float',
    :'failing_checks' => :'Integer',
    :'failing_checks_words' => :'Integer',
    :'failing_checks_percent' => :'Float',
    :'have_suggestion' => :'Integer',
    :'have_comment' => :'Integer',
    :'last_change' => :'Time',
    :'last_author' => :'String',
    :'repository_url' => :'String',
    :'file_url' => :'String',
    :'statistics_url' => :'String',
    :'changes_list_url' => :'String',
    :'units_list_url' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
# File 'lib/weblate/models/translation.rb', line 597

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      language == o.language &&
      component == o.component &&
      language_code == o.language_code &&
      id == o.id &&
      filename == o.filename &&
      revision == o.revision &&
      web_url == o.web_url &&
      share_url == o.share_url &&
      translate_url == o.translate_url &&
      url == o.url &&
      is_template == o.is_template &&
      is_source == o.is_source &&
      total == o.total &&
      total_words == o.total_words &&
      translated == o.translated &&
      translated_words == o.translated_words &&
      translated_percent == o.translated_percent &&
      fuzzy == o.fuzzy &&
      fuzzy_words == o.fuzzy_words &&
      fuzzy_percent == o.fuzzy_percent &&
      failing_checks == o.failing_checks &&
      failing_checks_words == o.failing_checks_words &&
      failing_checks_percent == o.failing_checks_percent &&
      have_suggestion == o.have_suggestion &&
      have_comment == o.have_comment &&
      last_change == o.last_change &&
      last_author == o.last_author &&
      repository_url == o.repository_url &&
      file_url == o.file_url &&
      statistics_url == o.statistics_url &&
      changes_list_url == o.changes_list_url &&
      units_list_url == o.units_list_url
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



744
745
746
747
748
749
750
751
752
753
754
755
756
# File 'lib/weblate/models/translation.rb', line 744

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


636
637
638
# File 'lib/weblate/models/translation.rb', line 636

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



642
643
644
# File 'lib/weblate/models/translation.rb', line 642

def hash
  [language, component, language_code, id, filename, revision, web_url, share_url, translate_url, url, is_template, is_source, total, total_words, translated, translated_words, translated_percent, fuzzy, fuzzy_words, fuzzy_percent, failing_checks, failing_checks_words, failing_checks_percent, have_suggestion, have_comment, last_change, last_author, repository_url, file_url, statistics_url, changes_list_url, units_list_url].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
# File 'lib/weblate/models/translation.rb', line 375

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @language.nil?
    invalid_properties.push('invalid value for "language", language cannot be nil.')
  end

  if @component.nil?
    invalid_properties.push('invalid value for "component", component cannot be nil.')
  end

  if !@language_code.nil? && @language_code.to_s.length > 50
    invalid_properties.push('invalid value for "language_code", the character length must be smaller than or equal to 50.')
  end

  if @id.nil?
    invalid_properties.push('invalid value for "id", id cannot be nil.')
  end

  if @filename.nil?
    invalid_properties.push('invalid value for "filename", filename cannot be nil.')
  end

  if @filename.to_s.length > 400
    invalid_properties.push('invalid value for "filename", the character length must be smaller than or equal to 400.')
  end

  if !@revision.nil? && @revision.to_s.length > 200
    invalid_properties.push('invalid value for "revision", the character length must be smaller than or equal to 200.')
  end

  if @web_url.nil?
    invalid_properties.push('invalid value for "web_url", web_url cannot be nil.')
  end

  if @share_url.nil?
    invalid_properties.push('invalid value for "share_url", share_url cannot be nil.')
  end

  if @translate_url.nil?
    invalid_properties.push('invalid value for "translate_url", translate_url cannot be nil.')
  end

  if @url.nil?
    invalid_properties.push('invalid value for "url", url cannot be nil.')
  end

  if @is_template.nil?
    invalid_properties.push('invalid value for "is_template", is_template cannot be nil.')
  end

  if @is_source.nil?
    invalid_properties.push('invalid value for "is_source", is_source cannot be nil.')
  end

  if @total.nil?
    invalid_properties.push('invalid value for "total", total cannot be nil.')
  end

  if @total_words.nil?
    invalid_properties.push('invalid value for "total_words", total_words cannot be nil.')
  end

  if @translated.nil?
    invalid_properties.push('invalid value for "translated", translated cannot be nil.')
  end

  if @translated_words.nil?
    invalid_properties.push('invalid value for "translated_words", translated_words cannot be nil.')
  end

  if @translated_percent.nil?
    invalid_properties.push('invalid value for "translated_percent", translated_percent cannot be nil.')
  end

  if @fuzzy.nil?
    invalid_properties.push('invalid value for "fuzzy", fuzzy cannot be nil.')
  end

  if @fuzzy_words.nil?
    invalid_properties.push('invalid value for "fuzzy_words", fuzzy_words cannot be nil.')
  end

  if @fuzzy_percent.nil?
    invalid_properties.push('invalid value for "fuzzy_percent", fuzzy_percent cannot be nil.')
  end

  if @failing_checks.nil?
    invalid_properties.push('invalid value for "failing_checks", failing_checks cannot be nil.')
  end

  if @failing_checks_words.nil?
    invalid_properties.push('invalid value for "failing_checks_words", failing_checks_words cannot be nil.')
  end

  if @failing_checks_percent.nil?
    invalid_properties.push('invalid value for "failing_checks_percent", failing_checks_percent cannot be nil.')
  end

  if @have_suggestion.nil?
    invalid_properties.push('invalid value for "have_suggestion", have_suggestion cannot be nil.')
  end

  if @have_comment.nil?
    invalid_properties.push('invalid value for "have_comment", have_comment cannot be nil.')
  end

  if @last_change.nil?
    invalid_properties.push('invalid value for "last_change", last_change cannot be nil.')
  end

  if @last_author.nil?
    invalid_properties.push('invalid value for "last_author", last_author cannot be nil.')
  end

  if @repository_url.nil?
    invalid_properties.push('invalid value for "repository_url", repository_url cannot be nil.')
  end

  if @file_url.nil?
    invalid_properties.push('invalid value for "file_url", file_url cannot be nil.')
  end

  if @statistics_url.nil?
    invalid_properties.push('invalid value for "statistics_url", statistics_url cannot be nil.')
  end

  if @changes_list_url.nil?
    invalid_properties.push('invalid value for "changes_list_url", changes_list_url cannot be nil.')
  end

  if @units_list_url.nil?
    invalid_properties.push('invalid value for "units_list_url", units_list_url cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



720
721
722
# File 'lib/weblate/models/translation.rb', line 720

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



726
727
728
729
730
731
732
733
734
735
736
737
738
# File 'lib/weblate/models/translation.rb', line 726

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



714
715
716
# File 'lib/weblate/models/translation.rb', line 714

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
# File 'lib/weblate/models/translation.rb', line 515

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @language.nil?
  return false if @component.nil?
  return false if !@language_code.nil? && @language_code.to_s.length > 50
  return false if @id.nil?
  return false if @filename.nil?
  return false if @filename.to_s.length > 400
  return false if !@revision.nil? && @revision.to_s.length > 200
  return false if @web_url.nil?
  return false if @share_url.nil?
  return false if @translate_url.nil?
  return false if @url.nil?
  return false if @is_template.nil?
  return false if @is_source.nil?
  return false if @total.nil?
  return false if @total_words.nil?
  return false if @translated.nil?
  return false if @translated_words.nil?
  return false if @translated_percent.nil?
  return false if @fuzzy.nil?
  return false if @fuzzy_words.nil?
  return false if @fuzzy_percent.nil?
  return false if @failing_checks.nil?
  return false if @failing_checks_words.nil?
  return false if @failing_checks_percent.nil?
  return false if @have_suggestion.nil?
  return false if @have_comment.nil?
  return false if @last_change.nil?
  return false if @last_author.nil?
  return false if @repository_url.nil?
  return false if @file_url.nil?
  return false if @statistics_url.nil?
  return false if @changes_list_url.nil?
  return false if @units_list_url.nil?
  true
end