phrase 1.0.13 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -2,6 +2,9 @@ require 'date'
2
2
 
3
3
  module Phrase
4
4
  class ScreenshotMarkerUpdateParameters
5
+ # specify the branch to use
6
+ attr_accessor :branch
7
+
5
8
  # Specify the Key ID which should be highlighted on the specified screenshot. The Key must belong to the project.
6
9
  attr_accessor :key_id
7
10
 
@@ -11,6 +14,7 @@ module Phrase
11
14
  # Attribute mapping from ruby-style variable name to JSON key.
12
15
  def self.attribute_map
13
16
  {
17
+ :'branch' => :'branch',
14
18
  :'key_id' => :'key_id',
15
19
  :'presentation' => :'presentation'
16
20
  }
@@ -19,6 +23,7 @@ module Phrase
19
23
  # Attribute type mapping.
20
24
  def self.openapi_types
21
25
  {
26
+ :'branch' => :'String',
22
27
  :'key_id' => :'String',
23
28
  :'presentation' => :'String'
24
29
  }
@@ -45,6 +50,10 @@ module Phrase
45
50
  h[k.to_sym] = v
46
51
  }
47
52
 
53
+ if attributes.key?(:'branch')
54
+ self.branch = attributes[:'branch']
55
+ end
56
+
48
57
  if attributes.key?(:'key_id')
49
58
  self.key_id = attributes[:'key_id']
50
59
  end
@@ -72,6 +81,7 @@ module Phrase
72
81
  def ==(o)
73
82
  return true if self.equal?(o)
74
83
  self.class == o.class &&
84
+ branch == o.branch &&
75
85
  key_id == o.key_id &&
76
86
  presentation == o.presentation
77
87
  end
@@ -85,7 +95,7 @@ module Phrase
85
95
  # Calculates hash code according to all attributes.
86
96
  # @return [Integer] Hash code
87
97
  def hash
88
- [key_id, presentation].hash
98
+ [branch, key_id, presentation].hash
89
99
  end
90
100
 
91
101
  # Builds the object from hash
@@ -2,6 +2,9 @@ require 'date'
2
2
 
3
3
  module Phrase
4
4
  class ScreenshotUpdateParameters
5
+ # specify the branch to use
6
+ attr_accessor :branch
7
+
5
8
  # Name of the screenshot
6
9
  attr_accessor :name
7
10
 
@@ -14,6 +17,7 @@ module Phrase
14
17
  # Attribute mapping from ruby-style variable name to JSON key.
15
18
  def self.attribute_map
16
19
  {
20
+ :'branch' => :'branch',
17
21
  :'name' => :'name',
18
22
  :'description' => :'description',
19
23
  :'filename' => :'filename'
@@ -23,6 +27,7 @@ module Phrase
23
27
  # Attribute type mapping.
24
28
  def self.openapi_types
25
29
  {
30
+ :'branch' => :'String',
26
31
  :'name' => :'String',
27
32
  :'description' => :'String',
28
33
  :'filename' => :'File'
@@ -50,6 +55,10 @@ module Phrase
50
55
  h[k.to_sym] = v
51
56
  }
52
57
 
58
+ if attributes.key?(:'branch')
59
+ self.branch = attributes[:'branch']
60
+ end
61
+
53
62
  if attributes.key?(:'name')
54
63
  self.name = attributes[:'name']
55
64
  end
@@ -81,6 +90,7 @@ module Phrase
81
90
  def ==(o)
82
91
  return true if self.equal?(o)
83
92
  self.class == o.class &&
93
+ branch == o.branch &&
84
94
  name == o.name &&
85
95
  description == o.description &&
86
96
  filename == o.filename
@@ -95,7 +105,7 @@ module Phrase
95
105
  # Calculates hash code according to all attributes.
96
106
  # @return [Integer] Hash code
97
107
  def hash
98
- [name, description, filename].hash
108
+ [branch, name, description, filename].hash
99
109
  end
100
110
 
101
111
  # Builds the object from hash
@@ -0,0 +1,225 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class SearchInAccountParameters
5
+ # Search query
6
+ attr_accessor :query
7
+
8
+ # Locale code
9
+ attr_accessor :locale_code
10
+
11
+ # Page
12
+ attr_accessor :page
13
+
14
+ # Number of results per page
15
+ attr_accessor :per_page
16
+
17
+ # Attribute mapping from ruby-style variable name to JSON key.
18
+ def self.attribute_map
19
+ {
20
+ :'query' => :'query',
21
+ :'locale_code' => :'locale_code',
22
+ :'page' => :'page',
23
+ :'per_page' => :'per_page'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.openapi_types
29
+ {
30
+ :'query' => :'String',
31
+ :'locale_code' => :'String',
32
+ :'page' => :'Integer',
33
+ :'per_page' => :'Integer'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::SearchInAccountParameters` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::SearchInAccountParameters`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'query')
59
+ self.query = attributes[:'query']
60
+ end
61
+
62
+ if attributes.key?(:'locale_code')
63
+ self.locale_code = attributes[:'locale_code']
64
+ end
65
+
66
+ if attributes.key?(:'page')
67
+ self.page = attributes[:'page']
68
+ end
69
+
70
+ if attributes.key?(:'per_page')
71
+ self.per_page = attributes[:'per_page']
72
+ end
73
+ end
74
+
75
+ # Show invalid properties with the reasons. Usually used together with valid?
76
+ # @return Array for valid properties with the reasons
77
+ def list_invalid_properties
78
+ invalid_properties = Array.new
79
+ invalid_properties
80
+ end
81
+
82
+ # Check to see if the all the properties in the model are valid
83
+ # @return true if the model is valid
84
+ def valid?
85
+ true
86
+ end
87
+
88
+ # Checks equality by comparing each attribute.
89
+ # @param [Object] Object to be compared
90
+ def ==(o)
91
+ return true if self.equal?(o)
92
+ self.class == o.class &&
93
+ query == o.query &&
94
+ locale_code == o.locale_code &&
95
+ page == o.page &&
96
+ per_page == o.per_page
97
+ end
98
+
99
+ # @see the `==` method
100
+ # @param [Object] Object to be compared
101
+ def eql?(o)
102
+ self == o
103
+ end
104
+
105
+ # Calculates hash code according to all attributes.
106
+ # @return [Integer] Hash code
107
+ def hash
108
+ [query, locale_code, page, per_page].hash
109
+ end
110
+
111
+ # Builds the object from hash
112
+ # @param [Hash] attributes Model attributes in the form of hash
113
+ # @return [Object] Returns the model itself
114
+ def self.build_from_hash(attributes)
115
+ new.build_from_hash(attributes)
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.openapi_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :Boolean
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ Phrase.const_get(type).build_from_hash(value)
176
+ end
177
+ end
178
+
179
+ # Returns the string representation of the object
180
+ # @return [String] String presentation of the object
181
+ def to_s
182
+ to_hash.to_s
183
+ end
184
+
185
+ # to_body is an alias to to_hash (backward compatibility)
186
+ # @return [Hash] Returns the object in the form of hash
187
+ def to_body
188
+ to_hash
189
+ end
190
+
191
+ # Returns the object in the form of hash
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_hash
194
+ hash = {}
195
+ self.class.attribute_map.each_pair do |attr, param|
196
+ value = self.send(attr)
197
+ if value.nil?
198
+ is_nullable = self.class.openapi_nullable.include?(attr)
199
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
200
+ end
201
+
202
+ hash[param] = _to_hash(value)
203
+ end
204
+ hash
205
+ end
206
+
207
+ # Outputs non-array value in the form of hash
208
+ # For object, use to_hash. Otherwise, just return the value
209
+ # @param [Object] value Any valid value
210
+ # @return [Hash] Returns the value in the form of hash
211
+ def _to_hash(value)
212
+ if value.is_a?(Array)
213
+ value.compact.map { |v| _to_hash(v) }
214
+ elsif value.is_a?(Hash)
215
+ {}.tap do |hash|
216
+ value.each { |k, v| hash[k] = _to_hash(v) }
217
+ end
218
+ elsif value.respond_to? :to_hash
219
+ value.to_hash
220
+ else
221
+ value
222
+ end
223
+ end
224
+ end
225
+ end
@@ -0,0 +1,230 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class Space1
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :created_at
10
+
11
+ attr_accessor :updated_at
12
+
13
+ attr_accessor :projects_count
14
+
15
+ # Attribute mapping from ruby-style variable name to JSON key.
16
+ def self.attribute_map
17
+ {
18
+ :'id' => :'id',
19
+ :'name' => :'name',
20
+ :'created_at' => :'created_at',
21
+ :'updated_at' => :'updated_at',
22
+ :'projects_count' => :'projects_count'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.openapi_types
28
+ {
29
+ :'id' => :'String',
30
+ :'name' => :'String',
31
+ :'created_at' => :'DateTime',
32
+ :'updated_at' => :'DateTime',
33
+ :'projects_count' => :'Integer'
34
+ }
35
+ end
36
+
37
+ # List of attributes with nullable: true
38
+ def self.openapi_nullable
39
+ Set.new([
40
+ ])
41
+ end
42
+
43
+ # Initializes the object
44
+ # @param [Hash] attributes Model attributes in the form of hash
45
+ def initialize(attributes = {})
46
+ if (!attributes.is_a?(Hash))
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::Space1` initialize method"
48
+ end
49
+
50
+ # check to see if the attribute exists and convert string to symbol for hash key
51
+ attributes = attributes.each_with_object({}) { |(k, v), h|
52
+ if (!self.class.attribute_map.key?(k.to_sym))
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::Space1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
54
+ end
55
+ h[k.to_sym] = v
56
+ }
57
+
58
+ if attributes.key?(:'id')
59
+ self.id = attributes[:'id']
60
+ end
61
+
62
+ if attributes.key?(:'name')
63
+ self.name = attributes[:'name']
64
+ end
65
+
66
+ if attributes.key?(:'created_at')
67
+ self.created_at = attributes[:'created_at']
68
+ end
69
+
70
+ if attributes.key?(:'updated_at')
71
+ self.updated_at = attributes[:'updated_at']
72
+ end
73
+
74
+ if attributes.key?(:'projects_count')
75
+ self.projects_count = attributes[:'projects_count']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ id == o.id &&
98
+ name == o.name &&
99
+ created_at == o.created_at &&
100
+ updated_at == o.updated_at &&
101
+ projects_count == o.projects_count
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [id, name, created_at, updated_at, projects_count].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.openapi_types.each_pair do |key, type|
129
+ if type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :DateTime
150
+ DateTime.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :Boolean
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ Phrase.const_get(type).build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ if value.nil?
203
+ is_nullable = self.class.openapi_nullable.include?(attr)
204
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
205
+ end
206
+
207
+ hash[param] = _to_hash(value)
208
+ end
209
+ hash
210
+ end
211
+
212
+ # Outputs non-array value in the form of hash
213
+ # For object, use to_hash. Otherwise, just return the value
214
+ # @param [Object] value Any valid value
215
+ # @return [Hash] Returns the value in the form of hash
216
+ def _to_hash(value)
217
+ if value.is_a?(Array)
218
+ value.compact.map { |v| _to_hash(v) }
219
+ elsif value.is_a?(Hash)
220
+ {}.tap do |hash|
221
+ value.each { |k, v| hash[k] = _to_hash(v) }
222
+ end
223
+ elsif value.respond_to? :to_hash
224
+ value.to_hash
225
+ else
226
+ value
227
+ end
228
+ end
229
+ end
230
+ end