phrase 1.0.13 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +48 -9
  3. data/docs/Account.md +3 -1
  4. data/docs/AccountDetails.md +5 -1
  5. data/docs/AccountDetails1.md +3 -1
  6. data/docs/AccountSearchResult.md +29 -0
  7. data/docs/Branch.md +5 -1
  8. data/docs/Comment.md +3 -1
  9. data/docs/CurrentUser.md +31 -0
  10. data/docs/JobCreateParameters.md +2 -0
  11. data/docs/JobDetails.md +2 -0
  12. data/docs/JobDetails1.md +2 -0
  13. data/docs/JobLocale.md +5 -1
  14. data/docs/JobTemplate.md +29 -0
  15. data/docs/JobTemplateCreateParameters.md +21 -0
  16. data/docs/JobTemplateLocale.md +23 -0
  17. data/docs/JobTemplateLocaleUpdateParameters.md +23 -0
  18. data/docs/JobTemplateLocalesApi.md +347 -0
  19. data/docs/JobTemplateLocalesCreateParameters.md +23 -0
  20. data/docs/JobTemplatePreview.md +19 -0
  21. data/docs/JobTemplateUpdateParameters.md +21 -0
  22. data/docs/JobTemplateUserPreview.md +23 -0
  23. data/docs/JobTemplatesApi.md +337 -0
  24. data/docs/KeysApi.md +137 -9
  25. data/docs/KeysExcludeParameters.md +23 -0
  26. data/docs/KeysIncludeParameters.md +23 -0
  27. data/docs/KeysSearchParameters.md +1 -1
  28. data/docs/KeysTagParameters.md +1 -1
  29. data/docs/KeysUntagParameters.md +1 -1
  30. data/docs/LocalePreview1.md +23 -0
  31. data/docs/LocalesApi.md +73 -6
  32. data/docs/MemberSpaces.md +2 -2
  33. data/docs/MemberUpdateParameters.md +4 -2
  34. data/docs/Notification.md +41 -0
  35. data/docs/NotificationGroup.md +23 -0
  36. data/docs/NotificationGroupDetail.md +27 -0
  37. data/docs/NotificationGroupsApi.md +194 -0
  38. data/docs/NotificationsApi.md +194 -0
  39. data/docs/OrderCreateParameters.md +2 -0
  40. data/docs/Project.md +2 -0
  41. data/docs/ProjectCreateParameters.md +35 -1
  42. data/docs/ProjectDetails.md +2 -0
  43. data/docs/ProjectsApi.md +7 -1
  44. data/docs/ScreenshotCreateParameters.md +3 -1
  45. data/docs/ScreenshotMarkerCreateParameters.md +3 -1
  46. data/docs/ScreenshotMarkerUpdateParameters.md +3 -1
  47. data/docs/ScreenshotMarkersApi.md +9 -3
  48. data/docs/ScreenshotUpdateParameters.md +3 -1
  49. data/docs/ScreenshotsApi.md +8 -2
  50. data/docs/SearchApi.md +72 -0
  51. data/docs/SearchInAccountParameters.md +23 -0
  52. data/docs/Space1.md +25 -0
  53. data/docs/Subscription.md +19 -0
  54. data/docs/TranslationOrder.md +2 -0
  55. data/docs/TranslationsApi.md +25 -25
  56. data/docs/User.md +0 -2
  57. data/docs/UsersApi.md +2 -2
  58. data/lib/phrase.rb +24 -0
  59. data/lib/phrase/api/job_template_locales_api.rb +417 -0
  60. data/lib/phrase/api/job_templates_api.rb +387 -0
  61. data/lib/phrase/api/keys_api.rb +158 -10
  62. data/lib/phrase/api/locales_api.rb +76 -5
  63. data/lib/phrase/api/notification_groups_api.rb +202 -0
  64. data/lib/phrase/api/notifications_api.rb +202 -0
  65. data/lib/phrase/api/projects_api.rb +9 -0
  66. data/lib/phrase/api/screenshot_markers_api.rb +9 -0
  67. data/lib/phrase/api/screenshots_api.rb +9 -0
  68. data/lib/phrase/api/search_api.rb +84 -0
  69. data/lib/phrase/api/translations_api.rb +35 -35
  70. data/lib/phrase/api/users_api.rb +3 -3
  71. data/lib/phrase/models/account.rb +13 -4
  72. data/lib/phrase/models/account_details.rb +22 -4
  73. data/lib/phrase/models/account_details1.rb +10 -1
  74. data/lib/phrase/models/account_search_result.rb +250 -0
  75. data/lib/phrase/models/branch.rb +19 -1
  76. data/lib/phrase/models/comment.rb +15 -4
  77. data/lib/phrase/models/current_user.rb +257 -0
  78. data/lib/phrase/models/job_create_parameters.rb +11 -1
  79. data/lib/phrase/models/job_details.rb +10 -1
  80. data/lib/phrase/models/job_details1.rb +10 -1
  81. data/lib/phrase/models/job_locale.rb +22 -4
  82. data/lib/phrase/models/job_template.rb +248 -0
  83. data/lib/phrase/models/job_template_create_parameters.rb +220 -0
  84. data/lib/phrase/models/job_template_locale.rb +223 -0
  85. data/lib/phrase/models/job_template_locale_update_parameters.rb +234 -0
  86. data/lib/phrase/models/job_template_locales_create_parameters.rb +234 -0
  87. data/lib/phrase/models/job_template_preview.rb +203 -0
  88. data/lib/phrase/models/job_template_update_parameters.rb +220 -0
  89. data/lib/phrase/models/job_template_user_preview.rb +221 -0
  90. data/lib/phrase/models/keys_exclude_parameters.rb +225 -0
  91. data/lib/phrase/models/keys_include_parameters.rb +225 -0
  92. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  93. data/lib/phrase/models/keys_tag_parameters.rb +1 -1
  94. data/lib/phrase/models/keys_untag_parameters.rb +1 -1
  95. data/lib/phrase/models/locale_preview1.rb +221 -0
  96. data/lib/phrase/models/member_spaces.rb +2 -2
  97. data/lib/phrase/models/member_update_parameters.rb +12 -2
  98. data/lib/phrase/models/notification.rb +302 -0
  99. data/lib/phrase/models/notification_group.rb +221 -0
  100. data/lib/phrase/models/notification_group_detail.rb +239 -0
  101. data/lib/phrase/models/order_create_parameters.rb +11 -1
  102. data/lib/phrase/models/project.rb +10 -1
  103. data/lib/phrase/models/project_create_parameters.rb +174 -4
  104. data/lib/phrase/models/project_details.rb +10 -1
  105. data/lib/phrase/models/screenshot_create_parameters.rb +11 -1
  106. data/lib/phrase/models/screenshot_marker_create_parameters.rb +11 -1
  107. data/lib/phrase/models/screenshot_marker_update_parameters.rb +11 -1
  108. data/lib/phrase/models/screenshot_update_parameters.rb +11 -1
  109. data/lib/phrase/models/search_in_account_parameters.rb +225 -0
  110. data/lib/phrase/models/space1.rb +230 -0
  111. data/lib/phrase/models/subscription.rb +203 -0
  112. data/lib/phrase/models/translation_order.rb +10 -1
  113. data/lib/phrase/models/user.rb +1 -10
  114. data/lib/phrase/version.rb +1 -1
  115. data/spec/api/job_template_locales_api_spec.rb +103 -0
  116. data/spec/api/job_templates_api_spec.rb +98 -0
  117. data/spec/api/keys_api_spec.rb +32 -4
  118. data/spec/api/locales_api_spec.rb +17 -2
  119. data/spec/api/notification_groups_api_spec.rb +62 -0
  120. data/spec/api/notifications_api_spec.rb +62 -0
  121. data/spec/api/projects_api_spec.rb +3 -0
  122. data/spec/api/screenshot_markers_api_spec.rb +3 -0
  123. data/spec/api/screenshots_api_spec.rb +3 -0
  124. data/spec/api/search_api_spec.rb +37 -0
  125. data/spec/api/translations_api_spec.rb +10 -10
  126. data/spec/api/users_api_spec.rb +1 -1
  127. data/spec/models/account_details1_spec.rb +6 -0
  128. data/spec/models/account_details_spec.rb +12 -0
  129. data/spec/models/account_search_result_spec.rb +65 -0
  130. data/spec/models/account_spec.rb +6 -0
  131. data/spec/models/branch_spec.rb +12 -0
  132. data/spec/models/comment_spec.rb +6 -0
  133. data/spec/models/current_user_spec.rb +71 -0
  134. data/spec/models/job_create_parameters_spec.rb +6 -0
  135. data/spec/models/job_details1_spec.rb +6 -0
  136. data/spec/models/job_details_spec.rb +6 -0
  137. data/spec/models/job_locale_spec.rb +12 -0
  138. data/spec/models/job_template_create_parameters_spec.rb +41 -0
  139. data/spec/models/job_template_locale_spec.rb +47 -0
  140. data/spec/models/job_template_locale_update_parameters_spec.rb +47 -0
  141. data/spec/models/job_template_locales_create_parameters_spec.rb +47 -0
  142. data/spec/models/job_template_preview_spec.rb +35 -0
  143. data/spec/models/job_template_spec.rb +65 -0
  144. data/spec/models/job_template_update_parameters_spec.rb +41 -0
  145. data/spec/models/job_template_user_preview_spec.rb +47 -0
  146. data/spec/models/keys_exclude_parameters_spec.rb +47 -0
  147. data/spec/models/keys_include_parameters_spec.rb +47 -0
  148. data/spec/models/locale_preview1_spec.rb +47 -0
  149. data/spec/models/member_update_parameters_spec.rb +6 -0
  150. data/spec/models/notification_group_detail_spec.rb +59 -0
  151. data/spec/models/notification_group_spec.rb +47 -0
  152. data/spec/models/notification_spec.rb +101 -0
  153. data/spec/models/order_create_parameters_spec.rb +6 -0
  154. data/spec/models/project_create_parameters_spec.rb +102 -0
  155. data/spec/models/project_details_spec.rb +6 -0
  156. data/spec/models/project_spec.rb +6 -0
  157. data/spec/models/screenshot_create_parameters_spec.rb +6 -0
  158. data/spec/models/screenshot_marker_create_parameters_spec.rb +6 -0
  159. data/spec/models/screenshot_marker_update_parameters_spec.rb +6 -0
  160. data/spec/models/screenshot_update_parameters_spec.rb +6 -0
  161. data/spec/models/search_in_account_parameters_spec.rb +47 -0
  162. data/spec/models/space1_spec.rb +53 -0
  163. data/spec/models/subscription_spec.rb +35 -0
  164. data/spec/models/translation_order_spec.rb +6 -0
  165. data/spec/models/user_spec.rb +0 -6
  166. metadata +263 -167
@@ -0,0 +1,221 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class NotificationGroup
5
+ attr_accessor :id
6
+
7
+ attr_accessor :event_name
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ # Attribute mapping from ruby-style variable name to JSON key.
14
+ def self.attribute_map
15
+ {
16
+ :'id' => :'id',
17
+ :'event_name' => :'event_name',
18
+ :'created_at' => :'created_at',
19
+ :'updated_at' => :'updated_at'
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.openapi_types
25
+ {
26
+ :'id' => :'String',
27
+ :'event_name' => :'String',
28
+ :'created_at' => :'DateTime',
29
+ :'updated_at' => :'DateTime'
30
+ }
31
+ end
32
+
33
+ # List of attributes with nullable: true
34
+ def self.openapi_nullable
35
+ Set.new([
36
+ ])
37
+ end
38
+
39
+ # Initializes the object
40
+ # @param [Hash] attributes Model attributes in the form of hash
41
+ def initialize(attributes = {})
42
+ if (!attributes.is_a?(Hash))
43
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::NotificationGroup` initialize method"
44
+ end
45
+
46
+ # check to see if the attribute exists and convert string to symbol for hash key
47
+ attributes = attributes.each_with_object({}) { |(k, v), h|
48
+ if (!self.class.attribute_map.key?(k.to_sym))
49
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::NotificationGroup`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
+ end
51
+ h[k.to_sym] = v
52
+ }
53
+
54
+ if attributes.key?(:'id')
55
+ self.id = attributes[:'id']
56
+ end
57
+
58
+ if attributes.key?(:'event_name')
59
+ self.event_name = attributes[:'event_name']
60
+ end
61
+
62
+ if attributes.key?(:'created_at')
63
+ self.created_at = attributes[:'created_at']
64
+ end
65
+
66
+ if attributes.key?(:'updated_at')
67
+ self.updated_at = attributes[:'updated_at']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ invalid_properties
76
+ end
77
+
78
+ # Check to see if the all the properties in the model are valid
79
+ # @return true if the model is valid
80
+ def valid?
81
+ true
82
+ end
83
+
84
+ # Checks equality by comparing each attribute.
85
+ # @param [Object] Object to be compared
86
+ def ==(o)
87
+ return true if self.equal?(o)
88
+ self.class == o.class &&
89
+ id == o.id &&
90
+ event_name == o.event_name &&
91
+ created_at == o.created_at &&
92
+ updated_at == o.updated_at
93
+ end
94
+
95
+ # @see the `==` method
96
+ # @param [Object] Object to be compared
97
+ def eql?(o)
98
+ self == o
99
+ end
100
+
101
+ # Calculates hash code according to all attributes.
102
+ # @return [Integer] Hash code
103
+ def hash
104
+ [id, event_name, created_at, updated_at].hash
105
+ end
106
+
107
+ # Builds the object from hash
108
+ # @param [Hash] attributes Model attributes in the form of hash
109
+ # @return [Object] Returns the model itself
110
+ def self.build_from_hash(attributes)
111
+ new.build_from_hash(attributes)
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def build_from_hash(attributes)
118
+ return nil unless attributes.is_a?(Hash)
119
+ self.class.openapi_types.each_pair do |key, type|
120
+ if type =~ /\AArray<(.*)>/i
121
+ # check to ensure the input is an array given that the attribute
122
+ # is documented as an array but the input is not
123
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
124
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
125
+ end
126
+ elsif !attributes[self.class.attribute_map[key]].nil?
127
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
128
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
129
+ end
130
+
131
+ self
132
+ end
133
+
134
+ # Deserializes the data based on type
135
+ # @param string type Data type
136
+ # @param string value Value to be deserialized
137
+ # @return [Object] Deserialized data
138
+ def _deserialize(type, value)
139
+ case type.to_sym
140
+ when :DateTime
141
+ DateTime.parse(value)
142
+ when :Date
143
+ Date.parse(value)
144
+ when :String
145
+ value.to_s
146
+ when :Integer
147
+ value.to_i
148
+ when :Float
149
+ value.to_f
150
+ when :Boolean
151
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
152
+ true
153
+ else
154
+ false
155
+ end
156
+ when :Object
157
+ # generic object (usually a Hash), return directly
158
+ value
159
+ when /\AArray<(?<inner_type>.+)>\z/
160
+ inner_type = Regexp.last_match[:inner_type]
161
+ value.map { |v| _deserialize(inner_type, v) }
162
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
163
+ k_type = Regexp.last_match[:k_type]
164
+ v_type = Regexp.last_match[:v_type]
165
+ {}.tap do |hash|
166
+ value.each do |k, v|
167
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
168
+ end
169
+ end
170
+ else # model
171
+ Phrase.const_get(type).build_from_hash(value)
172
+ end
173
+ end
174
+
175
+ # Returns the string representation of the object
176
+ # @return [String] String presentation of the object
177
+ def to_s
178
+ to_hash.to_s
179
+ end
180
+
181
+ # to_body is an alias to to_hash (backward compatibility)
182
+ # @return [Hash] Returns the object in the form of hash
183
+ def to_body
184
+ to_hash
185
+ end
186
+
187
+ # Returns the object in the form of hash
188
+ # @return [Hash] Returns the object in the form of hash
189
+ def to_hash
190
+ hash = {}
191
+ self.class.attribute_map.each_pair do |attr, param|
192
+ value = self.send(attr)
193
+ if value.nil?
194
+ is_nullable = self.class.openapi_nullable.include?(attr)
195
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
196
+ end
197
+
198
+ hash[param] = _to_hash(value)
199
+ end
200
+ hash
201
+ end
202
+
203
+ # Outputs non-array value in the form of hash
204
+ # For object, use to_hash. Otherwise, just return the value
205
+ # @param [Object] value Any valid value
206
+ # @return [Hash] Returns the value in the form of hash
207
+ def _to_hash(value)
208
+ if value.is_a?(Array)
209
+ value.compact.map { |v| _to_hash(v) }
210
+ elsif value.is_a?(Hash)
211
+ {}.tap do |hash|
212
+ value.each { |k, v| hash[k] = _to_hash(v) }
213
+ end
214
+ elsif value.respond_to? :to_hash
215
+ value.to_hash
216
+ else
217
+ value
218
+ end
219
+ end
220
+ end
221
+ end
@@ -0,0 +1,239 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class NotificationGroupDetail
5
+ attr_accessor :id
6
+
7
+ attr_accessor :event_name
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ attr_accessor :notifications_count
14
+
15
+ attr_accessor :latest_notification
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'id' => :'id',
21
+ :'event_name' => :'event_name',
22
+ :'created_at' => :'created_at',
23
+ :'updated_at' => :'updated_at',
24
+ :'notifications_count' => :'notifications_count',
25
+ :'latest_notification' => :'latest_notification'
26
+ }
27
+ end
28
+
29
+ # Attribute type mapping.
30
+ def self.openapi_types
31
+ {
32
+ :'id' => :'String',
33
+ :'event_name' => :'String',
34
+ :'created_at' => :'DateTime',
35
+ :'updated_at' => :'DateTime',
36
+ :'notifications_count' => :'Integer',
37
+ :'latest_notification' => :'Object'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::NotificationGroupDetail` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::NotificationGroupDetail`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'id')
63
+ self.id = attributes[:'id']
64
+ end
65
+
66
+ if attributes.key?(:'event_name')
67
+ self.event_name = attributes[:'event_name']
68
+ end
69
+
70
+ if attributes.key?(:'created_at')
71
+ self.created_at = attributes[:'created_at']
72
+ end
73
+
74
+ if attributes.key?(:'updated_at')
75
+ self.updated_at = attributes[:'updated_at']
76
+ end
77
+
78
+ if attributes.key?(:'notifications_count')
79
+ self.notifications_count = attributes[:'notifications_count']
80
+ end
81
+
82
+ if attributes.key?(:'latest_notification')
83
+ self.latest_notification = attributes[:'latest_notification']
84
+ end
85
+ end
86
+
87
+ # Show invalid properties with the reasons. Usually used together with valid?
88
+ # @return Array for valid properties with the reasons
89
+ def list_invalid_properties
90
+ invalid_properties = Array.new
91
+ invalid_properties
92
+ end
93
+
94
+ # Check to see if the all the properties in the model are valid
95
+ # @return true if the model is valid
96
+ def valid?
97
+ true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ id == o.id &&
106
+ event_name == o.event_name &&
107
+ created_at == o.created_at &&
108
+ updated_at == o.updated_at &&
109
+ notifications_count == o.notifications_count &&
110
+ latest_notification == o.latest_notification
111
+ end
112
+
113
+ # @see the `==` method
114
+ # @param [Object] Object to be compared
115
+ def eql?(o)
116
+ self == o
117
+ end
118
+
119
+ # Calculates hash code according to all attributes.
120
+ # @return [Integer] Hash code
121
+ def hash
122
+ [id, event_name, created_at, updated_at, notifications_count, latest_notification].hash
123
+ end
124
+
125
+ # Builds the object from hash
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ # @return [Object] Returns the model itself
128
+ def self.build_from_hash(attributes)
129
+ new.build_from_hash(attributes)
130
+ end
131
+
132
+ # Builds the object from hash
133
+ # @param [Hash] attributes Model attributes in the form of hash
134
+ # @return [Object] Returns the model itself
135
+ def build_from_hash(attributes)
136
+ return nil unless attributes.is_a?(Hash)
137
+ self.class.openapi_types.each_pair do |key, type|
138
+ if type =~ /\AArray<(.*)>/i
139
+ # check to ensure the input is an array given that the attribute
140
+ # is documented as an array but the input is not
141
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
142
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
143
+ end
144
+ elsif !attributes[self.class.attribute_map[key]].nil?
145
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
146
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
147
+ end
148
+
149
+ self
150
+ end
151
+
152
+ # Deserializes the data based on type
153
+ # @param string type Data type
154
+ # @param string value Value to be deserialized
155
+ # @return [Object] Deserialized data
156
+ def _deserialize(type, value)
157
+ case type.to_sym
158
+ when :DateTime
159
+ DateTime.parse(value)
160
+ when :Date
161
+ Date.parse(value)
162
+ when :String
163
+ value.to_s
164
+ when :Integer
165
+ value.to_i
166
+ when :Float
167
+ value.to_f
168
+ when :Boolean
169
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
170
+ true
171
+ else
172
+ false
173
+ end
174
+ when :Object
175
+ # generic object (usually a Hash), return directly
176
+ value
177
+ when /\AArray<(?<inner_type>.+)>\z/
178
+ inner_type = Regexp.last_match[:inner_type]
179
+ value.map { |v| _deserialize(inner_type, v) }
180
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
181
+ k_type = Regexp.last_match[:k_type]
182
+ v_type = Regexp.last_match[:v_type]
183
+ {}.tap do |hash|
184
+ value.each do |k, v|
185
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
186
+ end
187
+ end
188
+ else # model
189
+ Phrase.const_get(type).build_from_hash(value)
190
+ end
191
+ end
192
+
193
+ # Returns the string representation of the object
194
+ # @return [String] String presentation of the object
195
+ def to_s
196
+ to_hash.to_s
197
+ end
198
+
199
+ # to_body is an alias to to_hash (backward compatibility)
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_body
202
+ to_hash
203
+ end
204
+
205
+ # Returns the object in the form of hash
206
+ # @return [Hash] Returns the object in the form of hash
207
+ def to_hash
208
+ hash = {}
209
+ self.class.attribute_map.each_pair do |attr, param|
210
+ value = self.send(attr)
211
+ if value.nil?
212
+ is_nullable = self.class.openapi_nullable.include?(attr)
213
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214
+ end
215
+
216
+ hash[param] = _to_hash(value)
217
+ end
218
+ hash
219
+ end
220
+
221
+ # Outputs non-array value in the form of hash
222
+ # For object, use to_hash. Otherwise, just return the value
223
+ # @param [Object] value Any valid value
224
+ # @return [Hash] Returns the value in the form of hash
225
+ def _to_hash(value)
226
+ if value.is_a?(Array)
227
+ value.compact.map { |v| _to_hash(v) }
228
+ elsif value.is_a?(Hash)
229
+ {}.tap do |hash|
230
+ value.each { |k, v| hash[k] = _to_hash(v) }
231
+ end
232
+ elsif value.respond_to? :to_hash
233
+ value.to_hash
234
+ else
235
+ value
236
+ end
237
+ end
238
+ end
239
+ end