phrase 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -3
  3. data/docs/AccountsApi.md +8 -2
  4. data/docs/AuthorizationsApi.md +20 -5
  5. data/docs/BitbucketSyncApi.md +12 -3
  6. data/docs/BlacklistedKeysApi.md +20 -5
  7. data/docs/BranchesApi.md +28 -7
  8. data/docs/CommentsApi.md +32 -8
  9. data/docs/DistributionsApi.md +20 -5
  10. data/docs/DocumentsApi.md +8 -2
  11. data/docs/FormatsApi.md +4 -1
  12. data/docs/GitHubSyncApi.md +8 -2
  13. data/docs/GitLabSyncApi.md +28 -7
  14. data/docs/GlossariesApi.md +20 -5
  15. data/docs/GlossaryTermTranslationsApi.md +12 -3
  16. data/docs/GlossaryTermsApi.md +20 -5
  17. data/docs/ICUApi.md +73 -0
  18. data/docs/Icu.md +17 -0
  19. data/docs/IcuSkeletonParameters.md +21 -0
  20. data/docs/InvitationsApi.md +28 -7
  21. data/docs/JobLocaleCompleteReviewParameters.md +17 -0
  22. data/docs/JobLocaleUpdateParameters.md +3 -1
  23. data/docs/JobLocalesApi.md +99 -7
  24. data/docs/JobLocalesCreateParameters.md +4 -2
  25. data/docs/JobTemplateLocalesApi.md +20 -5
  26. data/docs/JobTemplatesApi.md +20 -5
  27. data/docs/JobsApi.md +44 -11
  28. data/docs/KeysApi.md +44 -11
  29. data/docs/LocalesApi.md +28 -7
  30. data/docs/Member.md +6 -0
  31. data/docs/MembersApi.md +20 -5
  32. data/docs/NotificationGroupsApi.md +12 -3
  33. data/docs/NotificationsApi.md +12 -3
  34. data/docs/OrdersApi.md +20 -5
  35. data/docs/Project.md +2 -0
  36. data/docs/ProjectDetails.md +2 -0
  37. data/docs/ProjectsApi.md +20 -5
  38. data/docs/ReleasesApi.md +24 -6
  39. data/docs/ScreenshotMarkersApi.md +20 -5
  40. data/docs/ScreenshotsApi.md +20 -5
  41. data/docs/SearchApi.md +4 -1
  42. data/docs/SpacesApi.md +32 -8
  43. data/docs/StyleGuidesApi.md +20 -5
  44. data/docs/TagsApi.md +16 -4
  45. data/docs/Team1.md +23 -0
  46. data/docs/TeamsApi.md +44 -11
  47. data/docs/TranslationsApi.md +68 -17
  48. data/docs/UploadsApi.md +12 -3
  49. data/docs/UserPreview.md +3 -1
  50. data/docs/UsersApi.md +4 -1
  51. data/docs/VariablesApi.md +20 -5
  52. data/docs/VersionsHistoryApi.md +8 -2
  53. data/docs/WebhooksApi.md +24 -6
  54. data/lib/phrase/api/accounts_api.rb +2 -2
  55. data/lib/phrase/api/authorizations_api.rb +5 -5
  56. data/lib/phrase/api/bitbucket_sync_api.rb +3 -3
  57. data/lib/phrase/api/blacklisted_keys_api.rb +5 -5
  58. data/lib/phrase/api/branches_api.rb +7 -7
  59. data/lib/phrase/api/comments_api.rb +8 -8
  60. data/lib/phrase/api/distributions_api.rb +5 -5
  61. data/lib/phrase/api/documents_api.rb +2 -2
  62. data/lib/phrase/api/formats_api.rb +1 -1
  63. data/lib/phrase/api/git_hub_sync_api.rb +2 -2
  64. data/lib/phrase/api/git_lab_sync_api.rb +7 -7
  65. data/lib/phrase/api/glossaries_api.rb +5 -5
  66. data/lib/phrase/api/glossary_term_translations_api.rb +3 -3
  67. data/lib/phrase/api/glossary_terms_api.rb +5 -5
  68. data/lib/phrase/api/icu_api.rb +78 -0
  69. data/lib/phrase/api/invitations_api.rb +7 -7
  70. data/lib/phrase/api/job_locales_api.rb +93 -7
  71. data/lib/phrase/api/job_template_locales_api.rb +5 -5
  72. data/lib/phrase/api/job_templates_api.rb +5 -5
  73. data/lib/phrase/api/jobs_api.rb +11 -11
  74. data/lib/phrase/api/keys_api.rb +11 -11
  75. data/lib/phrase/api/locales_api.rb +7 -7
  76. data/lib/phrase/api/members_api.rb +5 -5
  77. data/lib/phrase/api/notification_groups_api.rb +3 -3
  78. data/lib/phrase/api/notifications_api.rb +3 -3
  79. data/lib/phrase/api/orders_api.rb +5 -5
  80. data/lib/phrase/api/projects_api.rb +5 -5
  81. data/lib/phrase/api/releases_api.rb +6 -6
  82. data/lib/phrase/api/screenshot_markers_api.rb +5 -5
  83. data/lib/phrase/api/screenshots_api.rb +5 -5
  84. data/lib/phrase/api/search_api.rb +1 -1
  85. data/lib/phrase/api/spaces_api.rb +8 -8
  86. data/lib/phrase/api/style_guides_api.rb +5 -5
  87. data/lib/phrase/api/tags_api.rb +4 -4
  88. data/lib/phrase/api/teams_api.rb +11 -11
  89. data/lib/phrase/api/translations_api.rb +17 -17
  90. data/lib/phrase/api/uploads_api.rb +3 -3
  91. data/lib/phrase/api/users_api.rb +1 -1
  92. data/lib/phrase/api/variables_api.rb +5 -5
  93. data/lib/phrase/api/versions_history_api.rb +2 -2
  94. data/lib/phrase/api/webhooks_api.rb +6 -6
  95. data/lib/phrase/configuration.rb +8 -0
  96. data/lib/phrase/models/icu.rb +195 -0
  97. data/lib/phrase/models/icu_skeleton_parameters.rb +217 -0
  98. data/lib/phrase/models/job_locale_complete_review_parameters.rb +195 -0
  99. data/lib/phrase/models/job_locale_update_parameters.rb +16 -4
  100. data/lib/phrase/models/job_locales_create_parameters.rb +17 -5
  101. data/lib/phrase/models/member.rb +30 -1
  102. data/lib/phrase/models/project.rb +10 -1
  103. data/lib/phrase/models/project_details.rb +10 -1
  104. data/lib/phrase/models/team1.rb +221 -0
  105. data/lib/phrase/models/user_preview.rb +13 -4
  106. data/lib/phrase/response.rb +1 -1
  107. data/lib/phrase/version.rb +1 -1
  108. data/lib/phrase.rb +5 -0
  109. data/phrase.gemspec +2 -2
  110. data/spec/api/icu_api_spec.rb +36 -0
  111. data/spec/api/job_locales_api_spec.rb +16 -0
  112. data/spec/models/icu_skeleton_parameters_spec.rb +41 -0
  113. data/spec/models/icu_spec.rb +29 -0
  114. data/spec/models/job_locale_complete_review_parameters_spec.rb +29 -0
  115. data/spec/models/job_locale_update_parameters_spec.rb +6 -0
  116. data/spec/models/job_locales_create_parameters_spec.rb +6 -0
  117. data/spec/models/member_spec.rb +18 -0
  118. data/spec/models/project_details_spec.rb +6 -0
  119. data/spec/models/project_spec.rb +6 -0
  120. data/spec/models/team1_spec.rb +47 -0
  121. data/spec/models/user_preview_spec.rb +6 -0
  122. metadata +218 -198
@@ -69,7 +69,7 @@ module Phrase
69
69
  return_type = opts[:return_type] || 'TranslationVersionWithUser'
70
70
 
71
71
  # auth_names
72
- auth_names = opts[:auth_names] || ['Basic', 'Token']
72
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
73
73
 
74
74
  new_options = opts.merge(
75
75
  :header_params => header_params,
@@ -150,7 +150,7 @@ module Phrase
150
150
  return_type = opts[:return_type] || 'Array<TranslationVersion>'
151
151
 
152
152
  # auth_names
153
- auth_names = opts[:auth_names] || ['Basic', 'Token']
153
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
154
154
 
155
155
  new_options = opts.merge(
156
156
  :header_params => header_params,
@@ -62,7 +62,7 @@ module Phrase
62
62
  return_type = opts[:return_type] || 'Webhook'
63
63
 
64
64
  # auth_names
65
- auth_names = opts[:auth_names] || ['Basic', 'Token']
65
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
66
66
 
67
67
  new_options = opts.merge(
68
68
  :header_params => header_params,
@@ -132,7 +132,7 @@ module Phrase
132
132
  return_type = opts[:return_type]
133
133
 
134
134
  # auth_names
135
- auth_names = opts[:auth_names] || ['Basic', 'Token']
135
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
136
136
 
137
137
  new_options = opts.merge(
138
138
  :header_params => header_params,
@@ -204,7 +204,7 @@ module Phrase
204
204
  return_type = opts[:return_type] || 'Webhook'
205
205
 
206
206
  # auth_names
207
- auth_names = opts[:auth_names] || ['Basic', 'Token']
207
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
208
208
 
209
209
  new_options = opts.merge(
210
210
  :header_params => header_params,
@@ -274,7 +274,7 @@ module Phrase
274
274
  return_type = opts[:return_type]
275
275
 
276
276
  # auth_names
277
- auth_names = opts[:auth_names] || ['Basic', 'Token']
277
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
278
278
 
279
279
  new_options = opts.merge(
280
280
  :header_params => header_params,
@@ -354,7 +354,7 @@ module Phrase
354
354
  return_type = opts[:return_type] || 'Webhook'
355
355
 
356
356
  # auth_names
357
- auth_names = opts[:auth_names] || ['Basic', 'Token']
357
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
358
358
 
359
359
  new_options = opts.merge(
360
360
  :header_params => header_params,
@@ -426,7 +426,7 @@ module Phrase
426
426
  return_type = opts[:return_type] || 'Array<Webhook>'
427
427
 
428
428
  # auth_names
429
- auth_names = opts[:auth_names] || ['Basic', 'Token']
429
+ auth_names = opts[:auth_names] || ['Basic', 'Token', 'bearerAuth']
430
430
 
431
431
  new_options = opts.merge(
432
432
  :header_params => header_params,
@@ -195,6 +195,14 @@ module Phrase
195
195
  key: 'Authorization',
196
196
  value: api_key_with_prefix('Authorization')
197
197
  },
198
+ 'bearerAuth' =>
199
+ {
200
+ type: 'bearer',
201
+ in: 'header',
202
+ format: 'JWT',
203
+ key: 'Authorization',
204
+ value: "Bearer #{access_token}"
205
+ },
198
206
  }
199
207
  end
200
208
 
@@ -0,0 +1,195 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class Icu
5
+ # Object keys are dynamic and based on requested locale codes, see example.
6
+ attr_accessor :locale_code
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+ :'locale_code' => :'locale_code'
12
+ }
13
+ end
14
+
15
+ # Attribute type mapping.
16
+ def self.openapi_types
17
+ {
18
+ :'locale_code' => :'String'
19
+ }
20
+ end
21
+
22
+ # List of attributes with nullable: true
23
+ def self.openapi_nullable
24
+ Set.new([
25
+ ])
26
+ end
27
+
28
+ # Initializes the object
29
+ # @param [Hash] attributes Model attributes in the form of hash
30
+ def initialize(attributes = {})
31
+ if (!attributes.is_a?(Hash))
32
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::Icu` initialize method"
33
+ end
34
+
35
+ # check to see if the attribute exists and convert string to symbol for hash key
36
+ attributes = attributes.each_with_object({}) { |(k, v), h|
37
+ if (!self.class.attribute_map.key?(k.to_sym))
38
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::Icu`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
39
+ end
40
+ h[k.to_sym] = v
41
+ }
42
+
43
+ if attributes.key?(:'locale_code')
44
+ self.locale_code = attributes[:'locale_code']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ locale_code == o.locale_code
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Integer] Hash code
77
+ def hash
78
+ [locale_code].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def self.build_from_hash(attributes)
85
+ new.build_from_hash(attributes)
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :Boolean
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ Phrase.const_get(type).build_from_hash(value)
146
+ end
147
+ end
148
+
149
+ # Returns the string representation of the object
150
+ # @return [String] String presentation of the object
151
+ def to_s
152
+ to_hash.to_s
153
+ end
154
+
155
+ # to_body is an alias to to_hash (backward compatibility)
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_body
158
+ to_hash
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ if value.nil?
168
+ is_nullable = self.class.openapi_nullable.include?(attr)
169
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
170
+ end
171
+
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,217 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class IcuSkeletonParameters
5
+ # Source content
6
+ attr_accessor :content
7
+
8
+ # Locale codes
9
+ attr_accessor :locale_codes
10
+
11
+ # Indicates whether the zero form should be included or excluded in the returned skeletons
12
+ attr_accessor :zero_form_enabled
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
15
+ def self.attribute_map
16
+ {
17
+ :'content' => :'content',
18
+ :'locale_codes' => :'locale_codes',
19
+ :'zero_form_enabled' => :'zero_form_enabled'
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.openapi_types
25
+ {
26
+ :'content' => :'String',
27
+ :'locale_codes' => :'Array<String>',
28
+ :'zero_form_enabled' => :'Boolean'
29
+ }
30
+ end
31
+
32
+ # List of attributes with nullable: true
33
+ def self.openapi_nullable
34
+ Set.new([
35
+ ])
36
+ end
37
+
38
+ # Initializes the object
39
+ # @param [Hash] attributes Model attributes in the form of hash
40
+ def initialize(attributes = {})
41
+ if (!attributes.is_a?(Hash))
42
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::IcuSkeletonParameters` initialize method"
43
+ end
44
+
45
+ # check to see if the attribute exists and convert string to symbol for hash key
46
+ attributes = attributes.each_with_object({}) { |(k, v), h|
47
+ if (!self.class.attribute_map.key?(k.to_sym))
48
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::IcuSkeletonParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
49
+ end
50
+ h[k.to_sym] = v
51
+ }
52
+
53
+ if attributes.key?(:'content')
54
+ self.content = attributes[:'content']
55
+ end
56
+
57
+ if attributes.key?(:'locale_codes')
58
+ if (value = attributes[:'locale_codes']).is_a?(Array)
59
+ self.locale_codes = value
60
+ end
61
+ end
62
+
63
+ if attributes.key?(:'zero_form_enabled')
64
+ self.zero_form_enabled = attributes[:'zero_form_enabled']
65
+ end
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properties with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ content == o.content &&
87
+ locale_codes == o.locale_codes &&
88
+ zero_form_enabled == o.zero_form_enabled
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Integer] Hash code
99
+ def hash
100
+ [content, locale_codes, zero_form_enabled].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def self.build_from_hash(attributes)
107
+ new.build_from_hash(attributes)
108
+ end
109
+
110
+ # Builds the object from hash
111
+ # @param [Hash] attributes Model attributes in the form of hash
112
+ # @return [Object] Returns the model itself
113
+ def build_from_hash(attributes)
114
+ return nil unless attributes.is_a?(Hash)
115
+ self.class.openapi_types.each_pair do |key, type|
116
+ if type =~ /\AArray<(.*)>/i
117
+ # check to ensure the input is an array given that the attribute
118
+ # is documented as an array but the input is not
119
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
120
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
121
+ end
122
+ elsif !attributes[self.class.attribute_map[key]].nil?
123
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
124
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
125
+ end
126
+
127
+ self
128
+ end
129
+
130
+ # Deserializes the data based on type
131
+ # @param string type Data type
132
+ # @param string value Value to be deserialized
133
+ # @return [Object] Deserialized data
134
+ def _deserialize(type, value)
135
+ case type.to_sym
136
+ when :DateTime
137
+ DateTime.parse(value)
138
+ when :Date
139
+ Date.parse(value)
140
+ when :String
141
+ value.to_s
142
+ when :Integer
143
+ value.to_i
144
+ when :Float
145
+ value.to_f
146
+ when :Boolean
147
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
148
+ true
149
+ else
150
+ false
151
+ end
152
+ when :Object
153
+ # generic object (usually a Hash), return directly
154
+ value
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ Phrase.const_get(type).build_from_hash(value)
168
+ end
169
+ end
170
+
171
+ # Returns the string representation of the object
172
+ # @return [String] String presentation of the object
173
+ def to_s
174
+ to_hash.to_s
175
+ end
176
+
177
+ # to_body is an alias to to_hash (backward compatibility)
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_body
180
+ to_hash
181
+ end
182
+
183
+ # Returns the object in the form of hash
184
+ # @return [Hash] Returns the object in the form of hash
185
+ def to_hash
186
+ hash = {}
187
+ self.class.attribute_map.each_pair do |attr, param|
188
+ value = self.send(attr)
189
+ if value.nil?
190
+ is_nullable = self.class.openapi_nullable.include?(attr)
191
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
192
+ end
193
+
194
+ hash[param] = _to_hash(value)
195
+ end
196
+ hash
197
+ end
198
+
199
+ # Outputs non-array value in the form of hash
200
+ # For object, use to_hash. Otherwise, just return the value
201
+ # @param [Object] value Any valid value
202
+ # @return [Hash] Returns the value in the form of hash
203
+ def _to_hash(value)
204
+ if value.is_a?(Array)
205
+ value.compact.map { |v| _to_hash(v) }
206
+ elsif value.is_a?(Hash)
207
+ {}.tap do |hash|
208
+ value.each { |k, v| hash[k] = _to_hash(v) }
209
+ end
210
+ elsif value.respond_to? :to_hash
211
+ value.to_hash
212
+ else
213
+ value
214
+ end
215
+ end
216
+ end
217
+ end
@@ -0,0 +1,195 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobLocaleCompleteReviewParameters
5
+ # specify the branch to use
6
+ attr_accessor :branch
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+ :'branch' => :'branch'
12
+ }
13
+ end
14
+
15
+ # Attribute type mapping.
16
+ def self.openapi_types
17
+ {
18
+ :'branch' => :'String'
19
+ }
20
+ end
21
+
22
+ # List of attributes with nullable: true
23
+ def self.openapi_nullable
24
+ Set.new([
25
+ ])
26
+ end
27
+
28
+ # Initializes the object
29
+ # @param [Hash] attributes Model attributes in the form of hash
30
+ def initialize(attributes = {})
31
+ if (!attributes.is_a?(Hash))
32
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobLocaleCompleteReviewParameters` initialize method"
33
+ end
34
+
35
+ # check to see if the attribute exists and convert string to symbol for hash key
36
+ attributes = attributes.each_with_object({}) { |(k, v), h|
37
+ if (!self.class.attribute_map.key?(k.to_sym))
38
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobLocaleCompleteReviewParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
39
+ end
40
+ h[k.to_sym] = v
41
+ }
42
+
43
+ if attributes.key?(:'branch')
44
+ self.branch = attributes[:'branch']
45
+ end
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properties with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ branch == o.branch
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Integer] Hash code
77
+ def hash
78
+ [branch].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def self.build_from_hash(attributes)
85
+ new.build_from_hash(attributes)
86
+ end
87
+
88
+ # Builds the object from hash
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ # @return [Object] Returns the model itself
91
+ def build_from_hash(attributes)
92
+ return nil unless attributes.is_a?(Hash)
93
+ self.class.openapi_types.each_pair do |key, type|
94
+ if type =~ /\AArray<(.*)>/i
95
+ # check to ensure the input is an array given that the attribute
96
+ # is documented as an array but the input is not
97
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
98
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
99
+ end
100
+ elsif !attributes[self.class.attribute_map[key]].nil?
101
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
102
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
103
+ end
104
+
105
+ self
106
+ end
107
+
108
+ # Deserializes the data based on type
109
+ # @param string type Data type
110
+ # @param string value Value to be deserialized
111
+ # @return [Object] Deserialized data
112
+ def _deserialize(type, value)
113
+ case type.to_sym
114
+ when :DateTime
115
+ DateTime.parse(value)
116
+ when :Date
117
+ Date.parse(value)
118
+ when :String
119
+ value.to_s
120
+ when :Integer
121
+ value.to_i
122
+ when :Float
123
+ value.to_f
124
+ when :Boolean
125
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
126
+ true
127
+ else
128
+ false
129
+ end
130
+ when :Object
131
+ # generic object (usually a Hash), return directly
132
+ value
133
+ when /\AArray<(?<inner_type>.+)>\z/
134
+ inner_type = Regexp.last_match[:inner_type]
135
+ value.map { |v| _deserialize(inner_type, v) }
136
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
137
+ k_type = Regexp.last_match[:k_type]
138
+ v_type = Regexp.last_match[:v_type]
139
+ {}.tap do |hash|
140
+ value.each do |k, v|
141
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
142
+ end
143
+ end
144
+ else # model
145
+ Phrase.const_get(type).build_from_hash(value)
146
+ end
147
+ end
148
+
149
+ # Returns the string representation of the object
150
+ # @return [String] String presentation of the object
151
+ def to_s
152
+ to_hash.to_s
153
+ end
154
+
155
+ # to_body is an alias to to_hash (backward compatibility)
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_body
158
+ to_hash
159
+ end
160
+
161
+ # Returns the object in the form of hash
162
+ # @return [Hash] Returns the object in the form of hash
163
+ def to_hash
164
+ hash = {}
165
+ self.class.attribute_map.each_pair do |attr, param|
166
+ value = self.send(attr)
167
+ if value.nil?
168
+ is_nullable = self.class.openapi_nullable.include?(attr)
169
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
170
+ end
171
+
172
+ hash[param] = _to_hash(value)
173
+ end
174
+ hash
175
+ end
176
+
177
+ # Outputs non-array value in the form of hash
178
+ # For object, use to_hash. Otherwise, just return the value
179
+ # @param [Object] value Any valid value
180
+ # @return [Hash] Returns the value in the form of hash
181
+ def _to_hash(value)
182
+ if value.is_a?(Array)
183
+ value.compact.map { |v| _to_hash(v) }
184
+ elsif value.is_a?(Hash)
185
+ {}.tap do |hash|
186
+ value.each { |k, v| hash[k] = _to_hash(v) }
187
+ end
188
+ elsif value.respond_to? :to_hash
189
+ value.to_hash
190
+ else
191
+ value
192
+ end
193
+ end
194
+ end
195
+ end