weblate 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/COPYING +674 -0
- data/Gemfile +8 -0
- data/README.md +334 -0
- data/Rakefile +49 -0
- data/bin/console +11 -0
- data/bin/setup +8 -0
- data/bin/smoketest +14 -0
- data/bin/smoketest~ +0 -0
- data/docs/ActionEnum.md +15 -0
- data/docs/Addon.md +28 -0
- data/docs/AddonsApi.md +366 -0
- data/docs/AutoComponentList.md +20 -0
- data/docs/BasicUser.md +22 -0
- data/docs/BlankEnum.md +15 -0
- data/docs/CategoriesApi.md +520 -0
- data/docs/Category.md +30 -0
- data/docs/Change.md +42 -0
- data/docs/ChangesApi.md +163 -0
- data/docs/ColorEnum.md +15 -0
- data/docs/Component.md +146 -0
- data/docs/ComponentLanguageCodeStyle.md +49 -0
- data/docs/ComponentList.md +30 -0
- data/docs/ComponentListsApi.md +667 -0
- data/docs/ComponentsApi.md +1653 -0
- data/docs/ConflictsEnum.md +15 -0
- data/docs/DirectionEnum.md +15 -0
- data/docs/FileFormatEnum.md +15 -0
- data/docs/FrequencyEnum.md +15 -0
- data/docs/FuzzyEnum.md +15 -0
- data/docs/Group.md +40 -0
- data/docs/GroupsApi.md +1257 -0
- data/docs/Language.md +36 -0
- data/docs/LanguageCodeStyleEnum.md +15 -0
- data/docs/LanguagePlural.md +26 -0
- data/docs/LanguageSelectionEnum.md +15 -0
- data/docs/LanguagesApi.md +520 -0
- data/docs/LicenseEnum.md +15 -0
- data/docs/LockRequest.md +18 -0
- data/docs/Memory.md +34 -0
- data/docs/MemoryApi.md +448 -0
- data/docs/MergeStyleEnum.md +15 -0
- data/docs/MethodEnum.md +15 -0
- data/docs/Metrics.md +42 -0
- data/docs/MetricsApi.md +81 -0
- data/docs/NewLangEnum.md +15 -0
- data/docs/Notification.md +28 -0
- data/docs/NotificationEnum.md +15 -0
- data/docs/OperationEnum.md +15 -0
- data/docs/PaginatedAddonList.md +24 -0
- data/docs/PaginatedBasicUserList.md +24 -0
- data/docs/PaginatedCategoryList.md +24 -0
- data/docs/PaginatedChangeList.md +24 -0
- data/docs/PaginatedComponentList.md +24 -0
- data/docs/PaginatedComponentListList.md +24 -0
- data/docs/PaginatedGroupList.md +24 -0
- data/docs/PaginatedLanguageList.md +24 -0
- data/docs/PaginatedMemoryList.md +24 -0
- data/docs/PaginatedNotificationList.md +24 -0
- data/docs/PaginatedProjectList.md +24 -0
- data/docs/PaginatedRoleList.md +24 -0
- data/docs/PaginatedScreenshotList.md +24 -0
- data/docs/PaginatedTranslationList.md +24 -0
- data/docs/PaginatedUnitList.md +24 -0
- data/docs/PatchedAddon.md +28 -0
- data/docs/PatchedBasicUser.md +22 -0
- data/docs/PatchedCategory.md +30 -0
- data/docs/PatchedComponent.md +146 -0
- data/docs/PatchedComponentList.md +30 -0
- data/docs/PatchedGroup.md +40 -0
- data/docs/PatchedLanguage.md +36 -0
- data/docs/PatchedMemory.md +34 -0
- data/docs/PatchedNotification.md +28 -0
- data/docs/PatchedProject.md +58 -0
- data/docs/PatchedRole.md +24 -0
- data/docs/PatchedScreenshot.md +30 -0
- data/docs/PatchedUnitWrite.md +26 -0
- data/docs/PriorityEnum.md +15 -0
- data/docs/Project.md +58 -0
- data/docs/ProjectSelectionEnum.md +15 -0
- data/docs/ProjectsApi.md +1392 -0
- data/docs/RepoRequest.md +18 -0
- data/docs/Role.md +24 -0
- data/docs/RolesApi.md +448 -0
- data/docs/ScopeEnum.md +15 -0
- data/docs/Screenshot.md +30 -0
- data/docs/ScreenshotFile.md +18 -0
- data/docs/ScreenshotsApi.md +815 -0
- data/docs/SearchApi.md +75 -0
- data/docs/SourceEnum.md +15 -0
- data/docs/StateEnum.md +15 -0
- data/docs/TasksApi.md +145 -0
- data/docs/TextDirection.md +49 -0
- data/docs/Translation.md +80 -0
- data/docs/TranslationsApi.md +1028 -0
- data/docs/Unit.md +76 -0
- data/docs/UnitFlatLabels.md +24 -0
- data/docs/UnitLabels.md +24 -0
- data/docs/UnitWrite.md +26 -0
- data/docs/UnitsApi.md +376 -0
- data/docs/UploadRequest.md +28 -0
- data/docs/UploadRequestConflicts.md +49 -0
- data/docs/UploadRequestFuzzy.md +49 -0
- data/docs/UsersApi.md +1130 -0
- data/docs/VcsEnum.md +15 -0
- data/git_push.sh +57 -0
- data/lib/weblate/api/addons_api.rb +353 -0
- data/lib/weblate/api/categories_api.rb +495 -0
- data/lib/weblate/api/changes_api.rb +165 -0
- data/lib/weblate/api/component_lists_api.rb +642 -0
- data/lib/weblate/api/components_api.rb +1775 -0
- data/lib/weblate/api/groups_api.rb +1261 -0
- data/lib/weblate/api/languages_api.rb +495 -0
- data/lib/weblate/api/memory_api.rb +429 -0
- data/lib/weblate/api/metrics_api.rb +84 -0
- data/lib/weblate/api/projects_api.rb +1331 -0
- data/lib/weblate/api/roles_api.rb +429 -0
- data/lib/weblate/api/screenshots_api.rb +803 -0
- data/lib/weblate/api/search_api.rb +75 -0
- data/lib/weblate/api/tasks_api.rb +146 -0
- data/lib/weblate/api/translations_api.rb +1232 -0
- data/lib/weblate/api/units_api.rb +363 -0
- data/lib/weblate/api/users_api.rb +1104 -0
- data/lib/weblate/api_client.rb +437 -0
- data/lib/weblate/api_error.rb +58 -0
- data/lib/weblate/configuration.rb +392 -0
- data/lib/weblate/models/action_enum.rb +108 -0
- data/lib/weblate/models/addon.rb +314 -0
- data/lib/weblate/models/auto_component_list.rb +263 -0
- data/lib/weblate/models/basic_user.rb +292 -0
- data/lib/weblate/models/blank_enum.rb +39 -0
- data/lib/weblate/models/category.rb +361 -0
- data/lib/weblate/models/change.rb +408 -0
- data/lib/weblate/models/color_enum.rb +54 -0
- data/lib/weblate/models/component.rb +1377 -0
- data/lib/weblate/models/component_language_code_style.rb +106 -0
- data/lib/weblate/models/component_list.rb +366 -0
- data/lib/weblate/models/conflicts_enum.rb +41 -0
- data/lib/weblate/models/direction_enum.rb +40 -0
- data/lib/weblate/models/file_format_enum.rb +101 -0
- data/lib/weblate/models/frequency_enum.rb +43 -0
- data/lib/weblate/models/fuzzy_enum.rb +40 -0
- data/lib/weblate/models/group.rb +421 -0
- data/lib/weblate/models/language.rb +417 -0
- data/lib/weblate/models/language_code_style_enum.rb +51 -0
- data/lib/weblate/models/language_plural.rb +314 -0
- data/lib/weblate/models/language_selection_enum.rb +40 -0
- data/lib/weblate/models/license_enum.rb +677 -0
- data/lib/weblate/models/lock_request.rb +221 -0
- data/lib/weblate/models/memory.rb +329 -0
- data/lib/weblate/models/merge_style_enum.rb +41 -0
- data/lib/weblate/models/method_enum.rb +45 -0
- data/lib/weblate/models/metrics.rb +415 -0
- data/lib/weblate/models/new_lang_enum.rb +42 -0
- data/lib/weblate/models/notification.rb +323 -0
- data/lib/weblate/models/notification_enum.rb +60 -0
- data/lib/weblate/models/operation_enum.rb +43 -0
- data/lib/weblate/models/paginated_addon_list.rb +259 -0
- data/lib/weblate/models/paginated_basic_user_list.rb +259 -0
- data/lib/weblate/models/paginated_category_list.rb +259 -0
- data/lib/weblate/models/paginated_change_list.rb +259 -0
- data/lib/weblate/models/paginated_component_list.rb +259 -0
- data/lib/weblate/models/paginated_component_list_list.rb +259 -0
- data/lib/weblate/models/paginated_group_list.rb +259 -0
- data/lib/weblate/models/paginated_language_list.rb +259 -0
- data/lib/weblate/models/paginated_memory_list.rb +259 -0
- data/lib/weblate/models/paginated_notification_list.rb +259 -0
- data/lib/weblate/models/paginated_project_list.rb +259 -0
- data/lib/weblate/models/paginated_role_list.rb +259 -0
- data/lib/weblate/models/paginated_screenshot_list.rb +259 -0
- data/lib/weblate/models/paginated_translation_list.rb +259 -0
- data/lib/weblate/models/paginated_unit_list.rb +259 -0
- data/lib/weblate/models/patched_addon.rb +279 -0
- data/lib/weblate/models/patched_basic_user.rb +271 -0
- data/lib/weblate/models/patched_category.rb +319 -0
- data/lib/weblate/models/patched_component.rb +1242 -0
- data/lib/weblate/models/patched_component_list.rb +324 -0
- data/lib/weblate/models/patched_group.rb +365 -0
- data/lib/weblate/models/patched_language.rb +375 -0
- data/lib/weblate/models/patched_memory.rb +287 -0
- data/lib/weblate/models/patched_notification.rb +281 -0
- data/lib/weblate/models/patched_project.rb +472 -0
- data/lib/weblate/models/patched_role.rb +262 -0
- data/lib/weblate/models/patched_screenshot.rb +309 -0
- data/lib/weblate/models/patched_unit_write.rb +279 -0
- data/lib/weblate/models/priority_enum.rb +43 -0
- data/lib/weblate/models/project.rb +563 -0
- data/lib/weblate/models/project_selection_enum.rb +43 -0
- data/lib/weblate/models/repo_request.rb +243 -0
- data/lib/weblate/models/role.rb +290 -0
- data/lib/weblate/models/scope_enum.rb +43 -0
- data/lib/weblate/models/screenshot.rb +351 -0
- data/lib/weblate/models/screenshot_file.rb +221 -0
- data/lib/weblate/models/source_enum.rb +45 -0
- data/lib/weblate/models/state_enum.rb +43 -0
- data/lib/weblate/models/text_direction.rb +105 -0
- data/lib/weblate/models/translation.rb +760 -0
- data/lib/weblate/models/unit.rb +757 -0
- data/lib/weblate/models/unit_flat_labels.rb +315 -0
- data/lib/weblate/models/unit_labels.rb +315 -0
- data/lib/weblate/models/unit_write.rb +293 -0
- data/lib/weblate/models/upload_request.rb +307 -0
- data/lib/weblate/models/upload_request_conflicts.rb +105 -0
- data/lib/weblate/models/upload_request_fuzzy.rb +105 -0
- data/lib/weblate/models/vcs_enum.rb +46 -0
- data/lib/weblate/version.rb +15 -0
- data/lib/weblate.rb +135 -0
- data/manifest.scm +6 -0
- data/schema.patched.yaml +10113 -0
- data/schema.yaml +10116 -0
- data/sig/weblate.rbs +4 -0
- data/spec/api/addons_api_spec.rb +88 -0
- data/spec/api/categories_api_spec.rb +115 -0
- data/spec/api/changes_api_spec.rb +62 -0
- data/spec/api/component_lists_api_spec.rb +139 -0
- data/spec/api/components_api_spec.rb +307 -0
- data/spec/api/groups_api_spec.rb +236 -0
- data/spec/api/languages_api_spec.rb +115 -0
- data/spec/api/memory_api_spec.rb +104 -0
- data/spec/api/metrics_api_spec.rb +46 -0
- data/spec/api/projects_api_spec.rb +251 -0
- data/spec/api/roles_api_spec.rb +104 -0
- data/spec/api/screenshots_api_spec.rb +163 -0
- data/spec/api/search_api_spec.rb +45 -0
- data/spec/api/tasks_api_spec.rb +55 -0
- data/spec/api/translations_api_spec.rb +218 -0
- data/spec/api/units_api_spec.rb +93 -0
- data/spec/api/users_api_spec.rb +218 -0
- data/spec/models/action_enum_spec.rb +30 -0
- data/spec/models/addon_spec.rb +66 -0
- data/spec/models/auto_component_list_spec.rb +42 -0
- data/spec/models/basic_user_spec.rb +48 -0
- data/spec/models/blank_enum_spec.rb +30 -0
- data/spec/models/category_spec.rb +72 -0
- data/spec/models/change_spec.rb +108 -0
- data/spec/models/color_enum_spec.rb +30 -0
- data/spec/models/component_language_code_style_spec.rb +32 -0
- data/spec/models/component_list_spec.rb +72 -0
- data/spec/models/component_spec.rb +420 -0
- data/spec/models/conflicts_enum_spec.rb +30 -0
- data/spec/models/direction_enum_spec.rb +30 -0
- data/spec/models/file_format_enum_spec.rb +30 -0
- data/spec/models/frequency_enum_spec.rb +30 -0
- data/spec/models/fuzzy_enum_spec.rb +30 -0
- data/spec/models/group_spec.rb +102 -0
- data/spec/models/language_code_style_enum_spec.rb +30 -0
- data/spec/models/language_plural_spec.rb +60 -0
- data/spec/models/language_selection_enum_spec.rb +30 -0
- data/spec/models/language_spec.rb +90 -0
- data/spec/models/license_enum_spec.rb +30 -0
- data/spec/models/lock_request_spec.rb +36 -0
- data/spec/models/memory_spec.rb +84 -0
- data/spec/models/merge_style_enum_spec.rb +30 -0
- data/spec/models/method_enum_spec.rb +30 -0
- data/spec/models/metrics_spec.rb +108 -0
- data/spec/models/new_lang_enum_spec.rb +30 -0
- data/spec/models/notification_enum_spec.rb +30 -0
- data/spec/models/notification_spec.rb +66 -0
- data/spec/models/operation_enum_spec.rb +30 -0
- data/spec/models/paginated_addon_list_spec.rb +54 -0
- data/spec/models/paginated_basic_user_list_spec.rb +54 -0
- data/spec/models/paginated_category_list_spec.rb +54 -0
- data/spec/models/paginated_change_list_spec.rb +54 -0
- data/spec/models/paginated_component_list_list_spec.rb +54 -0
- data/spec/models/paginated_component_list_spec.rb +54 -0
- data/spec/models/paginated_group_list_spec.rb +54 -0
- data/spec/models/paginated_language_list_spec.rb +54 -0
- data/spec/models/paginated_memory_list_spec.rb +54 -0
- data/spec/models/paginated_notification_list_spec.rb +54 -0
- data/spec/models/paginated_project_list_spec.rb +54 -0
- data/spec/models/paginated_role_list_spec.rb +54 -0
- data/spec/models/paginated_screenshot_list_spec.rb +54 -0
- data/spec/models/paginated_translation_list_spec.rb +54 -0
- data/spec/models/paginated_unit_list_spec.rb +54 -0
- data/spec/models/patched_addon_spec.rb +66 -0
- data/spec/models/patched_basic_user_spec.rb +48 -0
- data/spec/models/patched_category_spec.rb +72 -0
- data/spec/models/patched_component_list_spec.rb +72 -0
- data/spec/models/patched_component_spec.rb +420 -0
- data/spec/models/patched_group_spec.rb +102 -0
- data/spec/models/patched_language_spec.rb +90 -0
- data/spec/models/patched_memory_spec.rb +84 -0
- data/spec/models/patched_notification_spec.rb +66 -0
- data/spec/models/patched_project_spec.rb +156 -0
- data/spec/models/patched_role_spec.rb +54 -0
- data/spec/models/patched_screenshot_spec.rb +72 -0
- data/spec/models/patched_unit_write_spec.rb +60 -0
- data/spec/models/priority_enum_spec.rb +30 -0
- data/spec/models/project_selection_enum_spec.rb +30 -0
- data/spec/models/project_spec.rb +156 -0
- data/spec/models/repo_request_spec.rb +36 -0
- data/spec/models/role_spec.rb +54 -0
- data/spec/models/scope_enum_spec.rb +30 -0
- data/spec/models/screenshot_file_spec.rb +36 -0
- data/spec/models/screenshot_spec.rb +72 -0
- data/spec/models/source_enum_spec.rb +30 -0
- data/spec/models/state_enum_spec.rb +30 -0
- data/spec/models/text_direction_spec.rb +32 -0
- data/spec/models/translation_spec.rb +222 -0
- data/spec/models/unit_flat_labels_spec.rb +54 -0
- data/spec/models/unit_labels_spec.rb +54 -0
- data/spec/models/unit_spec.rb +210 -0
- data/spec/models/unit_write_spec.rb +60 -0
- data/spec/models/upload_request_conflicts_spec.rb +32 -0
- data/spec/models/upload_request_fuzzy_spec.rb +32 -0
- data/spec/models/upload_request_spec.rb +66 -0
- data/spec/models/vcs_enum_spec.rb +30 -0
- data/spec/spec_helper.rb +111 -0
- data/weblate.gemspec +47 -0
- metadata +526 -0
@@ -0,0 +1,757 @@
|
|
1
|
+
=begin
|
2
|
+
#Weblate's REST API
|
3
|
+
|
4
|
+
# The API is accessible on the ``/api/`` URL and it is based on [Django REST framework](https://www.django-rest-framework.org/). The OpenAPI specification is available as feature preview, feedback welcome!
|
5
|
+
|
6
|
+
The version of the OpenAPI document:
|
7
|
+
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
Generator version: 7.9.0
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Weblate
|
17
|
+
class Unit
|
18
|
+
attr_accessor :translation
|
19
|
+
|
20
|
+
attr_accessor :source
|
21
|
+
|
22
|
+
attr_accessor :previous_source
|
23
|
+
|
24
|
+
attr_accessor :target
|
25
|
+
|
26
|
+
attr_accessor :id_hash
|
27
|
+
|
28
|
+
attr_accessor :content_hash
|
29
|
+
|
30
|
+
attr_accessor :location
|
31
|
+
|
32
|
+
attr_accessor :context
|
33
|
+
|
34
|
+
attr_accessor :note
|
35
|
+
|
36
|
+
attr_accessor :flags
|
37
|
+
|
38
|
+
attr_accessor :labels
|
39
|
+
|
40
|
+
attr_accessor :state
|
41
|
+
|
42
|
+
attr_accessor :fuzzy
|
43
|
+
|
44
|
+
attr_accessor :translated
|
45
|
+
|
46
|
+
attr_accessor :approved
|
47
|
+
|
48
|
+
attr_accessor :position
|
49
|
+
|
50
|
+
attr_accessor :has_suggestion
|
51
|
+
|
52
|
+
attr_accessor :has_comment
|
53
|
+
|
54
|
+
attr_accessor :has_failing_check
|
55
|
+
|
56
|
+
attr_accessor :num_words
|
57
|
+
|
58
|
+
attr_accessor :source_unit
|
59
|
+
|
60
|
+
attr_accessor :priority
|
61
|
+
|
62
|
+
attr_accessor :id
|
63
|
+
|
64
|
+
attr_accessor :web_url
|
65
|
+
|
66
|
+
attr_accessor :url
|
67
|
+
|
68
|
+
# Additional explanation to clarify meaning or usage of the string.
|
69
|
+
attr_accessor :explanation
|
70
|
+
|
71
|
+
# Additional comma-separated flags to influence Weblate behavior.
|
72
|
+
attr_accessor :extra_flags
|
73
|
+
|
74
|
+
attr_accessor :pending
|
75
|
+
|
76
|
+
attr_accessor :timestamp
|
77
|
+
|
78
|
+
attr_accessor :last_updated
|
79
|
+
|
80
|
+
class EnumAttributeValidator
|
81
|
+
attr_reader :datatype
|
82
|
+
attr_reader :allowable_values
|
83
|
+
|
84
|
+
def initialize(datatype, allowable_values)
|
85
|
+
@allowable_values = allowable_values.map do |value|
|
86
|
+
case datatype.to_s
|
87
|
+
when /Integer/i
|
88
|
+
value.to_i
|
89
|
+
when /Float/i
|
90
|
+
value.to_f
|
91
|
+
else
|
92
|
+
value
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
def valid?(value)
|
98
|
+
!value || allowable_values.include?(value)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
103
|
+
def self.attribute_map
|
104
|
+
{
|
105
|
+
:'translation' => :'translation',
|
106
|
+
:'source' => :'source',
|
107
|
+
:'previous_source' => :'previous_source',
|
108
|
+
:'target' => :'target',
|
109
|
+
:'id_hash' => :'id_hash',
|
110
|
+
:'content_hash' => :'content_hash',
|
111
|
+
:'location' => :'location',
|
112
|
+
:'context' => :'context',
|
113
|
+
:'note' => :'note',
|
114
|
+
:'flags' => :'flags',
|
115
|
+
:'labels' => :'labels',
|
116
|
+
:'state' => :'state',
|
117
|
+
:'fuzzy' => :'fuzzy',
|
118
|
+
:'translated' => :'translated',
|
119
|
+
:'approved' => :'approved',
|
120
|
+
:'position' => :'position',
|
121
|
+
:'has_suggestion' => :'has_suggestion',
|
122
|
+
:'has_comment' => :'has_comment',
|
123
|
+
:'has_failing_check' => :'has_failing_check',
|
124
|
+
:'num_words' => :'num_words',
|
125
|
+
:'source_unit' => :'source_unit',
|
126
|
+
:'priority' => :'priority',
|
127
|
+
:'id' => :'id',
|
128
|
+
:'web_url' => :'web_url',
|
129
|
+
:'url' => :'url',
|
130
|
+
:'explanation' => :'explanation',
|
131
|
+
:'extra_flags' => :'extra_flags',
|
132
|
+
:'pending' => :'pending',
|
133
|
+
:'timestamp' => :'timestamp',
|
134
|
+
:'last_updated' => :'last_updated'
|
135
|
+
}
|
136
|
+
end
|
137
|
+
|
138
|
+
# Returns all the JSON keys this model knows about
|
139
|
+
def self.acceptable_attributes
|
140
|
+
attribute_map.values
|
141
|
+
end
|
142
|
+
|
143
|
+
# Attribute type mapping.
|
144
|
+
def self.openapi_types
|
145
|
+
{
|
146
|
+
:'translation' => :'String',
|
147
|
+
:'source' => :'Array<String>',
|
148
|
+
:'previous_source' => :'String',
|
149
|
+
:'target' => :'Array<String>',
|
150
|
+
:'id_hash' => :'Integer',
|
151
|
+
:'content_hash' => :'Integer',
|
152
|
+
:'location' => :'String',
|
153
|
+
:'context' => :'String',
|
154
|
+
:'note' => :'String',
|
155
|
+
:'flags' => :'String',
|
156
|
+
:'labels' => :'Array<UnitLabels>',
|
157
|
+
:'state' => :'StateEnum',
|
158
|
+
:'fuzzy' => :'Boolean',
|
159
|
+
:'translated' => :'Boolean',
|
160
|
+
:'approved' => :'Boolean',
|
161
|
+
:'position' => :'Integer',
|
162
|
+
:'has_suggestion' => :'Boolean',
|
163
|
+
:'has_comment' => :'Boolean',
|
164
|
+
:'has_failing_check' => :'Boolean',
|
165
|
+
:'num_words' => :'Integer',
|
166
|
+
:'source_unit' => :'String',
|
167
|
+
:'priority' => :'Integer',
|
168
|
+
:'id' => :'Integer',
|
169
|
+
:'web_url' => :'String',
|
170
|
+
:'url' => :'String',
|
171
|
+
:'explanation' => :'String',
|
172
|
+
:'extra_flags' => :'String',
|
173
|
+
:'pending' => :'Boolean',
|
174
|
+
:'timestamp' => :'Time',
|
175
|
+
:'last_updated' => :'Time'
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
179
|
+
# List of attributes with nullable: true
|
180
|
+
def self.openapi_nullable
|
181
|
+
Set.new([
|
182
|
+
])
|
183
|
+
end
|
184
|
+
|
185
|
+
# Initializes the object
|
186
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
187
|
+
def initialize(attributes = {})
|
188
|
+
if (!attributes.is_a?(Hash))
|
189
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Weblate::Unit` initialize method"
|
190
|
+
end
|
191
|
+
|
192
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
193
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
194
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
195
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Weblate::Unit`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
196
|
+
end
|
197
|
+
h[k.to_sym] = v
|
198
|
+
}
|
199
|
+
|
200
|
+
if attributes.key?(:'translation')
|
201
|
+
self.translation = attributes[:'translation']
|
202
|
+
else
|
203
|
+
self.translation = nil
|
204
|
+
end
|
205
|
+
|
206
|
+
if attributes.key?(:'source')
|
207
|
+
if (value = attributes[:'source']).is_a?(Array)
|
208
|
+
self.source = value
|
209
|
+
end
|
210
|
+
else
|
211
|
+
self.source = nil
|
212
|
+
end
|
213
|
+
|
214
|
+
if attributes.key?(:'previous_source')
|
215
|
+
self.previous_source = attributes[:'previous_source']
|
216
|
+
end
|
217
|
+
|
218
|
+
if attributes.key?(:'target')
|
219
|
+
if (value = attributes[:'target']).is_a?(Array)
|
220
|
+
self.target = value
|
221
|
+
end
|
222
|
+
else
|
223
|
+
self.target = nil
|
224
|
+
end
|
225
|
+
|
226
|
+
if attributes.key?(:'id_hash')
|
227
|
+
self.id_hash = attributes[:'id_hash']
|
228
|
+
else
|
229
|
+
self.id_hash = nil
|
230
|
+
end
|
231
|
+
|
232
|
+
if attributes.key?(:'content_hash')
|
233
|
+
self.content_hash = attributes[:'content_hash']
|
234
|
+
else
|
235
|
+
self.content_hash = nil
|
236
|
+
end
|
237
|
+
|
238
|
+
if attributes.key?(:'location')
|
239
|
+
self.location = attributes[:'location']
|
240
|
+
end
|
241
|
+
|
242
|
+
if attributes.key?(:'context')
|
243
|
+
self.context = attributes[:'context']
|
244
|
+
end
|
245
|
+
|
246
|
+
if attributes.key?(:'note')
|
247
|
+
self.note = attributes[:'note']
|
248
|
+
end
|
249
|
+
|
250
|
+
if attributes.key?(:'flags')
|
251
|
+
self.flags = attributes[:'flags']
|
252
|
+
end
|
253
|
+
|
254
|
+
if attributes.key?(:'labels')
|
255
|
+
if (value = attributes[:'labels']).is_a?(Array)
|
256
|
+
self.labels = value
|
257
|
+
end
|
258
|
+
else
|
259
|
+
self.labels = nil
|
260
|
+
end
|
261
|
+
|
262
|
+
if attributes.key?(:'state')
|
263
|
+
self.state = attributes[:'state']
|
264
|
+
end
|
265
|
+
|
266
|
+
if attributes.key?(:'fuzzy')
|
267
|
+
self.fuzzy = attributes[:'fuzzy']
|
268
|
+
else
|
269
|
+
self.fuzzy = nil
|
270
|
+
end
|
271
|
+
|
272
|
+
if attributes.key?(:'translated')
|
273
|
+
self.translated = attributes[:'translated']
|
274
|
+
else
|
275
|
+
self.translated = nil
|
276
|
+
end
|
277
|
+
|
278
|
+
if attributes.key?(:'approved')
|
279
|
+
self.approved = attributes[:'approved']
|
280
|
+
else
|
281
|
+
self.approved = nil
|
282
|
+
end
|
283
|
+
|
284
|
+
if attributes.key?(:'position')
|
285
|
+
self.position = attributes[:'position']
|
286
|
+
else
|
287
|
+
self.position = nil
|
288
|
+
end
|
289
|
+
|
290
|
+
if attributes.key?(:'has_suggestion')
|
291
|
+
self.has_suggestion = attributes[:'has_suggestion']
|
292
|
+
else
|
293
|
+
self.has_suggestion = nil
|
294
|
+
end
|
295
|
+
|
296
|
+
if attributes.key?(:'has_comment')
|
297
|
+
self.has_comment = attributes[:'has_comment']
|
298
|
+
else
|
299
|
+
self.has_comment = nil
|
300
|
+
end
|
301
|
+
|
302
|
+
if attributes.key?(:'has_failing_check')
|
303
|
+
self.has_failing_check = attributes[:'has_failing_check']
|
304
|
+
else
|
305
|
+
self.has_failing_check = nil
|
306
|
+
end
|
307
|
+
|
308
|
+
if attributes.key?(:'num_words')
|
309
|
+
self.num_words = attributes[:'num_words']
|
310
|
+
end
|
311
|
+
|
312
|
+
if attributes.key?(:'source_unit')
|
313
|
+
self.source_unit = attributes[:'source_unit']
|
314
|
+
else
|
315
|
+
self.source_unit = nil
|
316
|
+
end
|
317
|
+
|
318
|
+
if attributes.key?(:'priority')
|
319
|
+
self.priority = attributes[:'priority']
|
320
|
+
end
|
321
|
+
|
322
|
+
if attributes.key?(:'id')
|
323
|
+
self.id = attributes[:'id']
|
324
|
+
else
|
325
|
+
self.id = nil
|
326
|
+
end
|
327
|
+
|
328
|
+
if attributes.key?(:'web_url')
|
329
|
+
self.web_url = attributes[:'web_url']
|
330
|
+
else
|
331
|
+
self.web_url = nil
|
332
|
+
end
|
333
|
+
|
334
|
+
if attributes.key?(:'url')
|
335
|
+
self.url = attributes[:'url']
|
336
|
+
else
|
337
|
+
self.url = nil
|
338
|
+
end
|
339
|
+
|
340
|
+
if attributes.key?(:'explanation')
|
341
|
+
self.explanation = attributes[:'explanation']
|
342
|
+
end
|
343
|
+
|
344
|
+
if attributes.key?(:'extra_flags')
|
345
|
+
self.extra_flags = attributes[:'extra_flags']
|
346
|
+
end
|
347
|
+
|
348
|
+
if attributes.key?(:'pending')
|
349
|
+
self.pending = attributes[:'pending']
|
350
|
+
else
|
351
|
+
self.pending = nil
|
352
|
+
end
|
353
|
+
|
354
|
+
if attributes.key?(:'timestamp')
|
355
|
+
self.timestamp = attributes[:'timestamp']
|
356
|
+
else
|
357
|
+
self.timestamp = nil
|
358
|
+
end
|
359
|
+
|
360
|
+
if attributes.key?(:'last_updated')
|
361
|
+
self.last_updated = attributes[:'last_updated']
|
362
|
+
else
|
363
|
+
self.last_updated = nil
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
368
|
+
# @return Array for valid properties with the reasons
|
369
|
+
def list_invalid_properties
|
370
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
371
|
+
invalid_properties = Array.new
|
372
|
+
if @translation.nil?
|
373
|
+
invalid_properties.push('invalid value for "translation", translation cannot be nil.')
|
374
|
+
end
|
375
|
+
|
376
|
+
if @source.nil?
|
377
|
+
invalid_properties.push('invalid value for "source", source cannot be nil.')
|
378
|
+
end
|
379
|
+
|
380
|
+
if @target.nil?
|
381
|
+
invalid_properties.push('invalid value for "target", target cannot be nil.')
|
382
|
+
end
|
383
|
+
|
384
|
+
if @id_hash.nil?
|
385
|
+
invalid_properties.push('invalid value for "id_hash", id_hash cannot be nil.')
|
386
|
+
end
|
387
|
+
|
388
|
+
if @id_hash > 9223372036854775807
|
389
|
+
invalid_properties.push('invalid value for "id_hash", must be smaller than or equal to 9223372036854775807.')
|
390
|
+
end
|
391
|
+
|
392
|
+
if @id_hash < -9223372036854775808
|
393
|
+
invalid_properties.push('invalid value for "id_hash", must be greater than or equal to -9223372036854775808.')
|
394
|
+
end
|
395
|
+
|
396
|
+
if @content_hash.nil?
|
397
|
+
invalid_properties.push('invalid value for "content_hash", content_hash cannot be nil.')
|
398
|
+
end
|
399
|
+
|
400
|
+
if @labels.nil?
|
401
|
+
invalid_properties.push('invalid value for "labels", labels cannot be nil.')
|
402
|
+
end
|
403
|
+
|
404
|
+
if @fuzzy.nil?
|
405
|
+
invalid_properties.push('invalid value for "fuzzy", fuzzy cannot be nil.')
|
406
|
+
end
|
407
|
+
|
408
|
+
if @translated.nil?
|
409
|
+
invalid_properties.push('invalid value for "translated", translated cannot be nil.')
|
410
|
+
end
|
411
|
+
|
412
|
+
if @approved.nil?
|
413
|
+
invalid_properties.push('invalid value for "approved", approved cannot be nil.')
|
414
|
+
end
|
415
|
+
|
416
|
+
if @position.nil?
|
417
|
+
invalid_properties.push('invalid value for "position", position cannot be nil.')
|
418
|
+
end
|
419
|
+
|
420
|
+
if @position > 2147483647
|
421
|
+
invalid_properties.push('invalid value for "position", must be smaller than or equal to 2147483647.')
|
422
|
+
end
|
423
|
+
|
424
|
+
if @position < -2147483648
|
425
|
+
invalid_properties.push('invalid value for "position", must be greater than or equal to -2147483648.')
|
426
|
+
end
|
427
|
+
|
428
|
+
if @has_suggestion.nil?
|
429
|
+
invalid_properties.push('invalid value for "has_suggestion", has_suggestion cannot be nil.')
|
430
|
+
end
|
431
|
+
|
432
|
+
if @has_comment.nil?
|
433
|
+
invalid_properties.push('invalid value for "has_comment", has_comment cannot be nil.')
|
434
|
+
end
|
435
|
+
|
436
|
+
if @has_failing_check.nil?
|
437
|
+
invalid_properties.push('invalid value for "has_failing_check", has_failing_check cannot be nil.')
|
438
|
+
end
|
439
|
+
|
440
|
+
if !@num_words.nil? && @num_words > 2147483647
|
441
|
+
invalid_properties.push('invalid value for "num_words", must be smaller than or equal to 2147483647.')
|
442
|
+
end
|
443
|
+
|
444
|
+
if !@num_words.nil? && @num_words < -2147483648
|
445
|
+
invalid_properties.push('invalid value for "num_words", must be greater than or equal to -2147483648.')
|
446
|
+
end
|
447
|
+
|
448
|
+
if @source_unit.nil?
|
449
|
+
invalid_properties.push('invalid value for "source_unit", source_unit cannot be nil.')
|
450
|
+
end
|
451
|
+
|
452
|
+
if !@priority.nil? && @priority > 2147483647
|
453
|
+
invalid_properties.push('invalid value for "priority", must be smaller than or equal to 2147483647.')
|
454
|
+
end
|
455
|
+
|
456
|
+
if !@priority.nil? && @priority < -2147483648
|
457
|
+
invalid_properties.push('invalid value for "priority", must be greater than or equal to -2147483648.')
|
458
|
+
end
|
459
|
+
|
460
|
+
if @id.nil?
|
461
|
+
invalid_properties.push('invalid value for "id", id cannot be nil.')
|
462
|
+
end
|
463
|
+
|
464
|
+
if @web_url.nil?
|
465
|
+
invalid_properties.push('invalid value for "web_url", web_url cannot be nil.')
|
466
|
+
end
|
467
|
+
|
468
|
+
if @url.nil?
|
469
|
+
invalid_properties.push('invalid value for "url", url cannot be nil.')
|
470
|
+
end
|
471
|
+
|
472
|
+
if @pending.nil?
|
473
|
+
invalid_properties.push('invalid value for "pending", pending cannot be nil.')
|
474
|
+
end
|
475
|
+
|
476
|
+
if @timestamp.nil?
|
477
|
+
invalid_properties.push('invalid value for "timestamp", timestamp cannot be nil.')
|
478
|
+
end
|
479
|
+
|
480
|
+
if @last_updated.nil?
|
481
|
+
invalid_properties.push('invalid value for "last_updated", last_updated cannot be nil.')
|
482
|
+
end
|
483
|
+
|
484
|
+
invalid_properties
|
485
|
+
end
|
486
|
+
|
487
|
+
# Check to see if the all the properties in the model are valid
|
488
|
+
# @return true if the model is valid
|
489
|
+
def valid?
|
490
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
491
|
+
return false if @translation.nil?
|
492
|
+
return false if @source.nil?
|
493
|
+
return false if @target.nil?
|
494
|
+
return false if @id_hash.nil?
|
495
|
+
return false if @id_hash > 9223372036854775807
|
496
|
+
return false if @id_hash < -9223372036854775808
|
497
|
+
return false if @content_hash.nil?
|
498
|
+
return false if @labels.nil?
|
499
|
+
return false if @fuzzy.nil?
|
500
|
+
return false if @translated.nil?
|
501
|
+
return false if @approved.nil?
|
502
|
+
return false if @position.nil?
|
503
|
+
return false if @position > 2147483647
|
504
|
+
return false if @position < -2147483648
|
505
|
+
return false if @has_suggestion.nil?
|
506
|
+
return false if @has_comment.nil?
|
507
|
+
return false if @has_failing_check.nil?
|
508
|
+
return false if !@num_words.nil? && @num_words > 2147483647
|
509
|
+
return false if !@num_words.nil? && @num_words < -2147483648
|
510
|
+
return false if @source_unit.nil?
|
511
|
+
return false if !@priority.nil? && @priority > 2147483647
|
512
|
+
return false if !@priority.nil? && @priority < -2147483648
|
513
|
+
return false if @id.nil?
|
514
|
+
return false if @web_url.nil?
|
515
|
+
return false if @url.nil?
|
516
|
+
return false if @pending.nil?
|
517
|
+
return false if @timestamp.nil?
|
518
|
+
return false if @last_updated.nil?
|
519
|
+
true
|
520
|
+
end
|
521
|
+
|
522
|
+
# Custom attribute writer method with validation
|
523
|
+
# @param [Object] id_hash Value to be assigned
|
524
|
+
def id_hash=(id_hash)
|
525
|
+
if id_hash.nil?
|
526
|
+
fail ArgumentError, 'id_hash cannot be nil'
|
527
|
+
end
|
528
|
+
|
529
|
+
if id_hash > 9223372036854775807
|
530
|
+
fail ArgumentError, 'invalid value for "id_hash", must be smaller than or equal to 9223372036854775807.'
|
531
|
+
end
|
532
|
+
|
533
|
+
if id_hash < -9223372036854775808
|
534
|
+
fail ArgumentError, 'invalid value for "id_hash", must be greater than or equal to -9223372036854775808.'
|
535
|
+
end
|
536
|
+
|
537
|
+
@id_hash = id_hash
|
538
|
+
end
|
539
|
+
|
540
|
+
# Custom attribute writer method with validation
|
541
|
+
# @param [Object] position Value to be assigned
|
542
|
+
def position=(position)
|
543
|
+
if position.nil?
|
544
|
+
fail ArgumentError, 'position cannot be nil'
|
545
|
+
end
|
546
|
+
|
547
|
+
if position > 2147483647
|
548
|
+
fail ArgumentError, 'invalid value for "position", must be smaller than or equal to 2147483647.'
|
549
|
+
end
|
550
|
+
|
551
|
+
if position < -2147483648
|
552
|
+
fail ArgumentError, 'invalid value for "position", must be greater than or equal to -2147483648.'
|
553
|
+
end
|
554
|
+
|
555
|
+
@position = position
|
556
|
+
end
|
557
|
+
|
558
|
+
# Custom attribute writer method with validation
|
559
|
+
# @param [Object] num_words Value to be assigned
|
560
|
+
def num_words=(num_words)
|
561
|
+
if num_words.nil?
|
562
|
+
fail ArgumentError, 'num_words cannot be nil'
|
563
|
+
end
|
564
|
+
|
565
|
+
if num_words > 2147483647
|
566
|
+
fail ArgumentError, 'invalid value for "num_words", must be smaller than or equal to 2147483647.'
|
567
|
+
end
|
568
|
+
|
569
|
+
if num_words < -2147483648
|
570
|
+
fail ArgumentError, 'invalid value for "num_words", must be greater than or equal to -2147483648.'
|
571
|
+
end
|
572
|
+
|
573
|
+
@num_words = num_words
|
574
|
+
end
|
575
|
+
|
576
|
+
# Custom attribute writer method with validation
|
577
|
+
# @param [Object] priority Value to be assigned
|
578
|
+
def priority=(priority)
|
579
|
+
if priority.nil?
|
580
|
+
fail ArgumentError, 'priority cannot be nil'
|
581
|
+
end
|
582
|
+
|
583
|
+
if priority > 2147483647
|
584
|
+
fail ArgumentError, 'invalid value for "priority", must be smaller than or equal to 2147483647.'
|
585
|
+
end
|
586
|
+
|
587
|
+
if priority < -2147483648
|
588
|
+
fail ArgumentError, 'invalid value for "priority", must be greater than or equal to -2147483648.'
|
589
|
+
end
|
590
|
+
|
591
|
+
@priority = priority
|
592
|
+
end
|
593
|
+
|
594
|
+
# Checks equality by comparing each attribute.
|
595
|
+
# @param [Object] Object to be compared
|
596
|
+
def ==(o)
|
597
|
+
return true if self.equal?(o)
|
598
|
+
self.class == o.class &&
|
599
|
+
translation == o.translation &&
|
600
|
+
source == o.source &&
|
601
|
+
previous_source == o.previous_source &&
|
602
|
+
target == o.target &&
|
603
|
+
id_hash == o.id_hash &&
|
604
|
+
content_hash == o.content_hash &&
|
605
|
+
location == o.location &&
|
606
|
+
context == o.context &&
|
607
|
+
note == o.note &&
|
608
|
+
flags == o.flags &&
|
609
|
+
labels == o.labels &&
|
610
|
+
state == o.state &&
|
611
|
+
fuzzy == o.fuzzy &&
|
612
|
+
translated == o.translated &&
|
613
|
+
approved == o.approved &&
|
614
|
+
position == o.position &&
|
615
|
+
has_suggestion == o.has_suggestion &&
|
616
|
+
has_comment == o.has_comment &&
|
617
|
+
has_failing_check == o.has_failing_check &&
|
618
|
+
num_words == o.num_words &&
|
619
|
+
source_unit == o.source_unit &&
|
620
|
+
priority == o.priority &&
|
621
|
+
id == o.id &&
|
622
|
+
web_url == o.web_url &&
|
623
|
+
url == o.url &&
|
624
|
+
explanation == o.explanation &&
|
625
|
+
extra_flags == o.extra_flags &&
|
626
|
+
pending == o.pending &&
|
627
|
+
timestamp == o.timestamp &&
|
628
|
+
last_updated == o.last_updated
|
629
|
+
end
|
630
|
+
|
631
|
+
# @see the `==` method
|
632
|
+
# @param [Object] Object to be compared
|
633
|
+
def eql?(o)
|
634
|
+
self == o
|
635
|
+
end
|
636
|
+
|
637
|
+
# Calculates hash code according to all attributes.
|
638
|
+
# @return [Integer] Hash code
|
639
|
+
def hash
|
640
|
+
[translation, source, previous_source, target, id_hash, content_hash, location, context, note, flags, labels, state, fuzzy, translated, approved, position, has_suggestion, has_comment, has_failing_check, num_words, source_unit, priority, id, web_url, url, explanation, extra_flags, pending, timestamp, last_updated].hash
|
641
|
+
end
|
642
|
+
|
643
|
+
# Builds the object from hash
|
644
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
645
|
+
# @return [Object] Returns the model itself
|
646
|
+
def self.build_from_hash(attributes)
|
647
|
+
return nil unless attributes.is_a?(Hash)
|
648
|
+
attributes = attributes.transform_keys(&:to_sym)
|
649
|
+
transformed_hash = {}
|
650
|
+
openapi_types.each_pair do |key, type|
|
651
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
652
|
+
transformed_hash["#{key}"] = nil
|
653
|
+
elsif type =~ /\AArray<(.*)>/i
|
654
|
+
# check to ensure the input is an array given that the attribute
|
655
|
+
# is documented as an array but the input is not
|
656
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
657
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
658
|
+
end
|
659
|
+
elsif !attributes[attribute_map[key]].nil?
|
660
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
661
|
+
end
|
662
|
+
end
|
663
|
+
new(transformed_hash)
|
664
|
+
end
|
665
|
+
|
666
|
+
# Deserializes the data based on type
|
667
|
+
# @param string type Data type
|
668
|
+
# @param string value Value to be deserialized
|
669
|
+
# @return [Object] Deserialized data
|
670
|
+
def self._deserialize(type, value)
|
671
|
+
case type.to_sym
|
672
|
+
when :Time
|
673
|
+
Time.parse(value)
|
674
|
+
when :Date
|
675
|
+
Date.parse(value)
|
676
|
+
when :String
|
677
|
+
value.to_s
|
678
|
+
when :Integer
|
679
|
+
value.to_i
|
680
|
+
when :Float
|
681
|
+
value.to_f
|
682
|
+
when :Boolean
|
683
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
684
|
+
true
|
685
|
+
else
|
686
|
+
false
|
687
|
+
end
|
688
|
+
when :Object
|
689
|
+
# generic object (usually a Hash), return directly
|
690
|
+
value
|
691
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
692
|
+
inner_type = Regexp.last_match[:inner_type]
|
693
|
+
value.map { |v| _deserialize(inner_type, v) }
|
694
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
695
|
+
k_type = Regexp.last_match[:k_type]
|
696
|
+
v_type = Regexp.last_match[:v_type]
|
697
|
+
{}.tap do |hash|
|
698
|
+
value.each do |k, v|
|
699
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
700
|
+
end
|
701
|
+
end
|
702
|
+
else # model
|
703
|
+
# models (e.g. Pet) or oneOf
|
704
|
+
klass = Weblate.const_get(type)
|
705
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
706
|
+
end
|
707
|
+
end
|
708
|
+
|
709
|
+
# Returns the string representation of the object
|
710
|
+
# @return [String] String presentation of the object
|
711
|
+
def to_s
|
712
|
+
to_hash.to_s
|
713
|
+
end
|
714
|
+
|
715
|
+
# to_body is an alias to to_hash (backward compatibility)
|
716
|
+
# @return [Hash] Returns the object in the form of hash
|
717
|
+
def to_body
|
718
|
+
to_hash
|
719
|
+
end
|
720
|
+
|
721
|
+
# Returns the object in the form of hash
|
722
|
+
# @return [Hash] Returns the object in the form of hash
|
723
|
+
def to_hash
|
724
|
+
hash = {}
|
725
|
+
self.class.attribute_map.each_pair do |attr, param|
|
726
|
+
value = self.send(attr)
|
727
|
+
if value.nil?
|
728
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
729
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
730
|
+
end
|
731
|
+
|
732
|
+
hash[param] = _to_hash(value)
|
733
|
+
end
|
734
|
+
hash
|
735
|
+
end
|
736
|
+
|
737
|
+
# Outputs non-array value in the form of hash
|
738
|
+
# For object, use to_hash. Otherwise, just return the value
|
739
|
+
# @param [Object] value Any valid value
|
740
|
+
# @return [Hash] Returns the value in the form of hash
|
741
|
+
def _to_hash(value)
|
742
|
+
if value.is_a?(Array)
|
743
|
+
value.compact.map { |v| _to_hash(v) }
|
744
|
+
elsif value.is_a?(Hash)
|
745
|
+
{}.tap do |hash|
|
746
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
747
|
+
end
|
748
|
+
elsif value.respond_to? :to_hash
|
749
|
+
value.to_hash
|
750
|
+
else
|
751
|
+
value
|
752
|
+
end
|
753
|
+
end
|
754
|
+
|
755
|
+
end
|
756
|
+
|
757
|
+
end
|