Class: Weblate::Component

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

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Component

Initializes the object

Parameters:

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

    Model attributes in the form of hash



363
364
365
366
367
368
369
370
371
372
373
374
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
512
513
514
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
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
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
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
# File 'lib/weblate/models/component.rb', line 363

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Weblate::Component` 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::Component`. 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?(:'name')
    self.name = attributes[:'name']
  else
    self.name = nil
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'links_url')
    self.links_url = attributes[:'links_url']
  else
    self.links_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?(:'task_url')
    self.task_url = attributes[:'task_url']
  else
    self.task_url = nil
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'addons')
    if (value = attributes[:'addons']).is_a?(Array)
      self.addons = value
    end
  else
    self.addons = nil
  end

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

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

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

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

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

Instance Attribute Details

#add_messageObject

You can use template language for various info, please consult the documentation for more details.



120
121
122
# File 'lib/weblate/models/component.rb', line 120

def add_message
  @add_message
end

#addon_messageObject

You can use template language for various info, please consult the documentation for more details.



129
130
131
# File 'lib/weblate/models/component.rb', line 129

def addon_message
  @addon_message
end

#addonsObject

Returns the value of attribute addons.



171
172
173
# File 'lib/weblate/models/component.rb', line 171

def addons
  @addons
end

#agreementObject

User agreement which needs to be approved before a user can translate this component.



67
68
69
# File 'lib/weblate/models/component.rb', line 67

def agreement
  @agreement
end

#allow_translation_propagationObject

Whether translation updates in other components will cause automatic translation in this one



135
136
137
# File 'lib/weblate/models/component.rb', line 135

def allow_translation_propagation
  @allow_translation_propagation
end

#auto_lock_errorObject

Whether the component should be locked on repository errors.



156
157
158
# File 'lib/weblate/models/component.rb', line 156

def auto_lock_error
  @auto_lock_error
end

#branchObject

Returns the value of attribute branch.



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

def branch
  @branch
end

#categoryObject

Returns the value of attribute category.



179
180
181
# File 'lib/weblate/models/component.rb', line 179

def category
  @category
end

#changes_list_urlObject

Returns the value of attribute changes_list_url.



83
84
85
# File 'lib/weblate/models/component.rb', line 83

def changes_list_url
  @changes_list_url
end

#check_flagsObject

Additional comma-separated flags to influence Weblate behavior.



97
98
99
# File 'lib/weblate/models/component.rb', line 97

def check_flags
  @check_flags
end

#commit_messageObject

You can use template language for various info, please consult the documentation for more details.



117
118
119
# File 'lib/weblate/models/component.rb', line 117

def commit_message
  @commit_message
end

#commit_pending_ageObject

Time in hours after which any pending changes will be committed to the VCS.



153
154
155
# File 'lib/weblate/models/component.rb', line 153

def commit_pending_age
  @commit_pending_age
end

#credits_urlObject

Returns the value of attribute credits_url.



87
88
89
# File 'lib/weblate/models/component.rb', line 87

def credits_url
  @credits_url
end

#delete_messageObject

You can use template language for various info, please consult the documentation for more details.



123
124
125
# File 'lib/weblate/models/component.rb', line 123

def delete_message
  @delete_message
end

#disable_autoshareObject

Returns the value of attribute disable_autoshare.



177
178
179
# File 'lib/weblate/models/component.rb', line 177

def disable_autoshare
  @disable_autoshare
end

#docfileObject

Returns the value of attribute docfile.



169
170
171
# File 'lib/weblate/models/component.rb', line 169

def docfile
  @docfile
end

#edit_templateObject

Whether users will be able to edit the base file for monolingual translations.



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

def edit_template
  @edit_template
end

#enable_suggestionsObject

Whether to allow translation suggestions at all.



141
142
143
# File 'lib/weblate/models/component.rb', line 141

def enable_suggestions
  @enable_suggestions
end

#enforced_checksObject

Returns the value of attribute enforced_checks.



102
103
104
# File 'lib/weblate/models/component.rb', line 102

def enforced_checks
  @enforced_checks
end

#file_formatObject

Returns the value of attribute file_format.



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

def file_format
  @file_format
end

#filemaskObject

Path of files to translate relative to repository root, use * instead of language code, for example: po/*.po or locale/*/LC_MESSAGES/django.po.



43
44
45
# File 'lib/weblate/models/component.rb', line 43

def filemask
  @filemask
end

#git_exportObject

URL of repository where users can fetch changes from Weblate



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

def git_export
  @git_export
end

#glossary_colorObject

Returns the value of attribute glossary_color.



175
176
177
# File 'lib/weblate/models/component.rb', line 175

def glossary_color
  @glossary_color
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#intermediateObject

Filename of intermediate translation file. In most cases this is a translation file provided by developers and is used when creating actual source strings.



55
56
57
# File 'lib/weblate/models/component.rb', line 55

def intermediate
  @intermediate
end

#is_glossaryObject

Returns the value of attribute is_glossary.



173
174
175
# File 'lib/weblate/models/component.rb', line 173

def is_glossary
  @is_glossary
end

#key_filterObject

Regular expression used to filter keys. This is only available for monolingual formats.



162
163
164
# File 'lib/weblate/models/component.rb', line 162

def key_filter
  @key_filter
end

#language_code_styleObject

Returns the value of attribute language_code_style.



92
93
94
# File 'lib/weblate/models/component.rb', line 92

def language_code_style
  @language_code_style
end

#language_regexObject

Regular expression used to filter translation files when scanning for file mask.



159
160
161
# File 'lib/weblate/models/component.rb', line 159

def language_regex
  @language_regex
end

#licenseObject

Returns the value of attribute license.



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

def license
  @license
end

#license_urlObject

Returns the value of attribute license_url.



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

def license_url
  @license_url
end

#linked_componentObject

Returns the value of attribute linked_component.



181
182
183
# File 'lib/weblate/models/component.rb', line 181

def linked_component
  @linked_component
end

Returns the value of attribute links_url.



81
82
83
# File 'lib/weblate/models/component.rb', line 81

def links_url
  @links_url
end

#lock_urlObject

Returns the value of attribute lock_url.



79
80
81
# File 'lib/weblate/models/component.rb', line 79

def lock_url
  @lock_url
end

#manage_unitsObject

Enables adding and removing strings straight from Weblate. If your strings are extracted from the source code or managed externally you probably want to keep it disabled.



138
139
140
# File 'lib/weblate/models/component.rb', line 138

def manage_units
  @manage_units
end

#merge_messageObject

You can use template language for various info, please consult the documentation for more details.



126
127
128
# File 'lib/weblate/models/component.rb', line 126

def merge_message
  @merge_message
end

#merge_styleObject

Define whether Weblate should merge the upstream repository or rebase changes onto it. * ‘merge` - Merge * `rebase` - Rebase * `merge_noff` - Merge without fast-forward



114
115
116
# File 'lib/weblate/models/component.rb', line 114

def merge_style
  @merge_style
end

#nameObject

Display name



19
20
21
# File 'lib/weblate/models/component.rb', line 19

def name
  @name
end

#new_baseObject

Filename of file used for creating new translations. For gettext choose .pot file.



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

def new_base
  @new_base
end

#new_langObject

How to handle requests for creating new translations. * ‘contact` - Contact maintainers * `url` - Point to translation instructions URL * `add` - Create new language file * `none` - Disable adding new translations



90
91
92
# File 'lib/weblate/models/component.rb', line 90

def new_lang
  @new_lang
end

#priorityObject

Components with higher priority are offered first to translators. * ‘60` - Very high * `80` - High * `100` - Medium * `120` - Low * `140` - Very low



100
101
102
# File 'lib/weblate/models/component.rb', line 100

def priority
  @priority
end

#projectObject

Returns the value of attribute project.



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

def project
  @project
end

#pull_messageObject

You can use template language for various info, please consult the documentation for more details.



132
133
134
# File 'lib/weblate/models/component.rb', line 132

def pull_message
  @pull_message
end

#pushObject

Returns the value of attribute push.



94
95
96
# File 'lib/weblate/models/component.rb', line 94

def push
  @push
end

#push_branchObject

Returns the value of attribute push_branch.



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

def push_branch
  @push_branch
end

#push_on_commitObject

Whether the repository should be pushed upstream on every commit.



150
151
152
# File 'lib/weblate/models/component.rb', line 150

def push_on_commit
  @push_on_commit
end

#repoObject

Returns the value of attribute repo.



33
34
35
# File 'lib/weblate/models/component.rb', line 33

def repo
  @repo
end

#report_source_bugsObject

E-mail address for reports on errors in source strings. Leave empty for no e-mails.



111
112
113
# File 'lib/weblate/models/component.rb', line 111

def report_source_bugs
  @report_source_bugs
end

#repository_urlObject

Returns the value of attribute repository_url.



73
74
75
# File 'lib/weblate/models/component.rb', line 73

def repository_url
  @repository_url
end

#repowebObject

Link to repository browser, use {branch} for branch, {filename} and {line} as filename and line placeholders. You might want to strip leading directory by using {filename|parentdir}.



108
109
110
# File 'lib/weblate/models/component.rb', line 108

def repoweb
  @repoweb
end

#restrictedObject

Restrict access to the component to only those explicitly given permission.



105
106
107
# File 'lib/weblate/models/component.rb', line 105

def restricted
  @restricted
end

#screenshot_filemaskObject

Path of screenshots relative to repository root, for example: docs/screenshots/*.png.



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

def screenshot_filemask
  @screenshot_filemask
end

#slugObject

Name used in URLs and filenames.



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

def slug
  @slug
end

#source_languageObject

Returns the value of attribute source_language.



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

def source_language
  @source_language
end

#statistics_urlObject

Returns the value of attribute statistics_url.



77
78
79
# File 'lib/weblate/models/component.rb', line 77

def statistics_url
  @statistics_url
end

#suggestion_autoacceptObject

Automatically accept suggestions with this number of votes, use 0 to turn it off.



147
148
149
# File 'lib/weblate/models/component.rb', line 147

def suggestion_autoaccept
  @suggestion_autoaccept
end

#suggestion_votingObject

Users can only vote for suggestions and can’t make direct translations.



144
145
146
# File 'lib/weblate/models/component.rb', line 144

def suggestion_voting
  @suggestion_voting
end

#task_urlObject

Returns the value of attribute task_url.



85
86
87
# File 'lib/weblate/models/component.rb', line 85

def task_url
  @task_url
end

#templateObject

Filename of translation base file, containing all strings and their source for monolingual translations.



49
50
51
# File 'lib/weblate/models/component.rb', line 49

def template
  @template
end

#translations_urlObject

Returns the value of attribute translations_url.



75
76
77
# File 'lib/weblate/models/component.rb', line 75

def translations_url
  @translations_url
end

#urlObject

Returns the value of attribute url.



71
72
73
# File 'lib/weblate/models/component.rb', line 71

def url
  @url
end

#variant_regexObject

Regular expression used to determine variants of a string.



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

def variant_regex
  @variant_regex
end

#vcsObject

Version control system to use to access your repository containing translations. You can also choose additional integration with third party providers to submit merge requests. * ‘gerrit` - Gerrit * `git` - Git * `git-force-push` - Git with force push * `github` - GitHub pull request * `gitlab` - GitLab merge request * `local` - No remote repository * `mercurial` - Mercurial * `subversion` - Subversion



31
32
33
# File 'lib/weblate/models/component.rb', line 31

def vcs
  @vcs
end

#web_urlObject

Returns the value of attribute web_url.



69
70
71
# File 'lib/weblate/models/component.rb', line 69

def web_url
  @web_url
end

#zipfileObject

Returns the value of attribute zipfile.



167
168
169
# File 'lib/weblate/models/component.rb', line 167

def zipfile
  @zipfile
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



1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
# File 'lib/weblate/models/component.rb', line 1290

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



277
278
279
# File 'lib/weblate/models/component.rb', line 277

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

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



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
# File 'lib/weblate/models/component.rb', line 206

def self.attribute_map
  {
    :'name' => :'name',
    :'slug' => :'slug',
    :'id' => :'id',
    :'source_language' => :'source_language',
    :'project' => :'project',
    :'vcs' => :'vcs',
    :'repo' => :'repo',
    :'git_export' => :'git_export',
    :'branch' => :'branch',
    :'push_branch' => :'push_branch',
    :'filemask' => :'filemask',
    :'screenshot_filemask' => :'screenshot_filemask',
    :'template' => :'template',
    :'edit_template' => :'edit_template',
    :'intermediate' => :'intermediate',
    :'new_base' => :'new_base',
    :'file_format' => :'file_format',
    :'license' => :'license',
    :'license_url' => :'license_url',
    :'agreement' => :'agreement',
    :'web_url' => :'web_url',
    :'url' => :'url',
    :'repository_url' => :'repository_url',
    :'translations_url' => :'translations_url',
    :'statistics_url' => :'statistics_url',
    :'lock_url' => :'lock_url',
    :'links_url' => :'links_url',
    :'changes_list_url' => :'changes_list_url',
    :'task_url' => :'task_url',
    :'credits_url' => :'credits_url',
    :'new_lang' => :'new_lang',
    :'language_code_style' => :'language_code_style',
    :'push' => :'push',
    :'check_flags' => :'check_flags',
    :'priority' => :'priority',
    :'enforced_checks' => :'enforced_checks',
    :'restricted' => :'restricted',
    :'repoweb' => :'repoweb',
    :'report_source_bugs' => :'report_source_bugs',
    :'merge_style' => :'merge_style',
    :'commit_message' => :'commit_message',
    :'add_message' => :'add_message',
    :'delete_message' => :'delete_message',
    :'merge_message' => :'merge_message',
    :'addon_message' => :'addon_message',
    :'pull_message' => :'pull_message',
    :'allow_translation_propagation' => :'allow_translation_propagation',
    :'manage_units' => :'manage_units',
    :'enable_suggestions' => :'enable_suggestions',
    :'suggestion_voting' => :'suggestion_voting',
    :'suggestion_autoaccept' => :'suggestion_autoaccept',
    :'push_on_commit' => :'push_on_commit',
    :'commit_pending_age' => :'commit_pending_age',
    :'auto_lock_error' => :'auto_lock_error',
    :'language_regex' => :'language_regex',
    :'key_filter' => :'key_filter',
    :'variant_regex' => :'variant_regex',
    :'zipfile' => :'zipfile',
    :'docfile' => :'docfile',
    :'addons' => :'addons',
    :'is_glossary' => :'is_glossary',
    :'glossary_color' => :'glossary_color',
    :'disable_autoshare' => :'disable_autoshare',
    :'category' => :'category',
    :'linked_component' => :'linked_component'
  }
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



1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
# File 'lib/weblate/models/component.rb', line 1266

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



353
354
355
356
357
358
359
# File 'lib/weblate/models/component.rb', line 353

def self.openapi_nullable
  Set.new([
    :'task_url',
    :'enforced_checks',
    :'category',
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/weblate/models/component.rb', line 282

def self.openapi_types
  {
    :'name' => :'String',
    :'slug' => :'String',
    :'id' => :'Integer',
    :'source_language' => :'Language',
    :'project' => :'Project',
    :'vcs' => :'VcsEnum',
    :'repo' => :'String',
    :'git_export' => :'String',
    :'branch' => :'String',
    :'push_branch' => :'String',
    :'filemask' => :'String',
    :'screenshot_filemask' => :'String',
    :'template' => :'String',
    :'edit_template' => :'Boolean',
    :'intermediate' => :'String',
    :'new_base' => :'String',
    :'file_format' => :'FileFormatEnum',
    :'license' => :'LicenseEnum',
    :'license_url' => :'String',
    :'agreement' => :'String',
    :'web_url' => :'String',
    :'url' => :'String',
    :'repository_url' => :'String',
    :'translations_url' => :'String',
    :'statistics_url' => :'String',
    :'lock_url' => :'String',
    :'links_url' => :'String',
    :'changes_list_url' => :'String',
    :'task_url' => :'String',
    :'credits_url' => :'String',
    :'new_lang' => :'NewLangEnum',
    :'language_code_style' => :'ComponentLanguageCodeStyle',
    :'push' => :'String',
    :'check_flags' => :'String',
    :'priority' => :'PriorityEnum',
    :'enforced_checks' => :'Object',
    :'restricted' => :'Boolean',
    :'repoweb' => :'String',
    :'report_source_bugs' => :'String',
    :'merge_style' => :'MergeStyleEnum',
    :'commit_message' => :'String',
    :'add_message' => :'String',
    :'delete_message' => :'String',
    :'merge_message' => :'String',
    :'addon_message' => :'String',
    :'pull_message' => :'String',
    :'allow_translation_propagation' => :'Boolean',
    :'manage_units' => :'Boolean',
    :'enable_suggestions' => :'Boolean',
    :'suggestion_voting' => :'Boolean',
    :'suggestion_autoaccept' => :'Integer',
    :'push_on_commit' => :'Boolean',
    :'commit_pending_age' => :'Integer',
    :'auto_lock_error' => :'Boolean',
    :'language_regex' => :'String',
    :'key_filter' => :'String',
    :'variant_regex' => :'String',
    :'zipfile' => :'String',
    :'docfile' => :'String',
    :'addons' => :'Array<String>',
    :'is_glossary' => :'Boolean',
    :'glossary_color' => :'ColorEnum',
    :'disable_autoshare' => :'Boolean',
    :'category' => :'String',
    :'linked_component' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
# File 'lib/weblate/models/component.rb', line 1181

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      name == o.name &&
      slug == o.slug &&
      id == o.id &&
      source_language == o.source_language &&
      project == o.project &&
      vcs == o.vcs &&
      repo == o.repo &&
      git_export == o.git_export &&
      branch == o.branch &&
      push_branch == o.push_branch &&
      filemask == o.filemask &&
      screenshot_filemask == o.screenshot_filemask &&
      template == o.template &&
      edit_template == o.edit_template &&
      intermediate == o.intermediate &&
      new_base == o.new_base &&
      file_format == o.file_format &&
      license == o.license &&
      license_url == o.license_url &&
      agreement == o.agreement &&
      web_url == o.web_url &&
      url == o.url &&
      repository_url == o.repository_url &&
      translations_url == o.translations_url &&
      statistics_url == o.statistics_url &&
      lock_url == o.lock_url &&
      links_url == o.links_url &&
      changes_list_url == o.changes_list_url &&
      task_url == o.task_url &&
      credits_url == o.credits_url &&
      new_lang == o.new_lang &&
      language_code_style == o.language_code_style &&
      push == o.push &&
      check_flags == o.check_flags &&
      priority == o.priority &&
      enforced_checks == o.enforced_checks &&
      restricted == o.restricted &&
      repoweb == o.repoweb &&
      report_source_bugs == o.report_source_bugs &&
      merge_style == o.merge_style &&
      commit_message == o.commit_message &&
      add_message == o.add_message &&
      delete_message == o.delete_message &&
      merge_message == o.merge_message &&
      addon_message == o.addon_message &&
      pull_message == o.pull_message &&
      allow_translation_propagation == o.allow_translation_propagation &&
      manage_units == o.manage_units &&
      enable_suggestions == o.enable_suggestions &&
      suggestion_voting == o.suggestion_voting &&
      suggestion_autoaccept == o.suggestion_autoaccept &&
      push_on_commit == o.push_on_commit &&
      commit_pending_age == o.commit_pending_age &&
      auto_lock_error == o.auto_lock_error &&
      language_regex == o.language_regex &&
      key_filter == o.key_filter &&
      variant_regex == o.variant_regex &&
      zipfile == o.zipfile &&
      docfile == o.docfile &&
      addons == o.addons &&
      is_glossary == o.is_glossary &&
      glossary_color == o.glossary_color &&
      disable_autoshare == o.disable_autoshare &&
      category == o.category &&
      linked_component == o.linked_component
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



1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
# File 'lib/weblate/models/component.rb', line 1361

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


1253
1254
1255
# File 'lib/weblate/models/component.rb', line 1253

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



1259
1260
1261
# File 'lib/weblate/models/component.rb', line 1259

def hash
  [name, slug, id, source_language, project, vcs, repo, git_export, branch, push_branch, filemask, screenshot_filemask, template, edit_template, intermediate, new_base, file_format, license, license_url, agreement, web_url, url, repository_url, translations_url, statistics_url, lock_url, links_url, changes_list_url, task_url, credits_url, new_lang, language_code_style, push, check_flags, priority, enforced_checks, restricted, repoweb, report_source_bugs, merge_style, commit_message, add_message, delete_message, merge_message, addon_message, pull_message, allow_translation_propagation, manage_units, enable_suggestions, suggestion_voting, suggestion_autoaccept, push_on_commit, commit_pending_age, auto_lock_error, language_regex, key_filter, variant_regex, zipfile, docfile, addons, is_glossary, glossary_color, disable_autoshare, category, linked_component].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
# File 'lib/weblate/models/component.rb', line 681

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

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

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

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

  pattern = Regexp.new(/^[-a-zA-Z0-9_]+$/)
  if @slug !~ pattern
    invalid_properties.push("invalid value for \"slug\", must conform to the pattern #{pattern}.")
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  if @links_url.nil?
    invalid_properties.push('invalid value for "links_url", links_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 @credits_url.nil?
    invalid_properties.push('invalid value for "credits_url", credits_url cannot be nil.')
  end

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

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

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

  if !@suggestion_autoaccept.nil? && @suggestion_autoaccept > 32767
    invalid_properties.push('invalid value for "suggestion_autoaccept", must be smaller than or equal to 32767.')
  end

  if !@suggestion_autoaccept.nil? && @suggestion_autoaccept < 0
    invalid_properties.push('invalid value for "suggestion_autoaccept", must be greater than or equal to 0.')
  end

  if !@commit_pending_age.nil? && @commit_pending_age > 2160
    invalid_properties.push('invalid value for "commit_pending_age", must be smaller than or equal to 2160.')
  end

  if !@commit_pending_age.nil? && @commit_pending_age < -32768
    invalid_properties.push('invalid value for "commit_pending_age", must be greater than or equal to -32768.')
  end

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

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

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

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

  if @linked_component.nil?
    invalid_properties.push('invalid value for "linked_component", linked_component 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



1337
1338
1339
# File 'lib/weblate/models/component.rb', line 1337

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



1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
# File 'lib/weblate/models/component.rb', line 1343

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



1331
1332
1333
# File 'lib/weblate/models/component.rb', line 1331

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



854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
# File 'lib/weblate/models/component.rb', line 854

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @name.nil?
  return false if @name.to_s.length > 100
  return false if @slug.nil?
  return false if @slug.to_s.length > 100
  return false if @slug !~ Regexp.new(/^[-a-zA-Z0-9_]+$/)
  return false if @id.nil?
  return false if @project.nil?
  return false if @repo.nil?
  return false if @repo.to_s.length > 300
  return false if !@git_export.nil? && @git_export.to_s.length > 220
  return false if !@branch.nil? && @branch.to_s.length > 200
  return false if !@push_branch.nil? && @push_branch.to_s.length > 200
  return false if @filemask.nil?
  return false if @filemask.to_s.length > 400
  return false if !@screenshot_filemask.nil? && @screenshot_filemask.to_s.length > 400
  return false if !@template.nil? && @template.to_s.length > 400
  return false if !@intermediate.nil? && @intermediate.to_s.length > 400
  return false if !@new_base.nil? && @new_base.to_s.length > 400
  return false if @file_format.nil?
  return false if @license_url.nil?
  return false if @web_url.nil?
  return false if @url.nil?
  return false if @repository_url.nil?
  return false if @translations_url.nil?
  return false if @statistics_url.nil?
  return false if @lock_url.nil?
  return false if @links_url.nil?
  return false if @changes_list_url.nil?
  return false if @credits_url.nil?
  return false if !@push.nil? && @push.to_s.length > 300
  return false if !@repoweb.nil? && @repoweb.to_s.length > 200
  return false if !@report_source_bugs.nil? && @report_source_bugs.to_s.length > 190
  return false if !@suggestion_autoaccept.nil? && @suggestion_autoaccept > 32767
  return false if !@suggestion_autoaccept.nil? && @suggestion_autoaccept < 0
  return false if !@commit_pending_age.nil? && @commit_pending_age > 2160
  return false if !@commit_pending_age.nil? && @commit_pending_age < -32768
  return false if !@language_regex.nil? && @language_regex.to_s.length > 500
  return false if !@key_filter.nil? && @key_filter.to_s.length > 500
  return false if !@variant_regex.nil? && @variant_regex.to_s.length > 190
  return false if @addons.nil?
  return false if @linked_component.nil?
  true
end