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