phrase 2.8.3 → 2.8.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -1
  3. data/README.md +15 -12
  4. data/docs/BitbucketSyncApi.md +2 -2
  5. data/docs/BranchesApi.md +3 -3
  6. data/docs/GitHubSyncApi.md +2 -2
  7. data/docs/GitLabSyncApi.md +2 -2
  8. data/docs/JobCommentsApi.md +6 -6
  9. data/docs/JobLocale.md +3 -1
  10. data/docs/JobLocaleUpdateParameters.md +5 -1
  11. data/docs/JobLocalesCreateParameters.md +6 -2
  12. data/docs/JobTemplateDetails.md +35 -0
  13. data/docs/JobTemplateDetails1.md +21 -0
  14. data/docs/JobTemplateLocaleUpdateParameters.md +6 -2
  15. data/docs/{JobTemplateLocale.md → JobTemplateLocales.md} +6 -4
  16. data/docs/JobTemplateLocalesApi.md +8 -8
  17. data/docs/JobTemplateLocalesCreateParameters.md +5 -1
  18. data/docs/JobTemplatesApi.md +41 -41
  19. data/docs/KeysSearchParameters.md +1 -1
  20. data/docs/LocaleTeamPreview.md +21 -0
  21. data/docs/{JobTemplateUserPreview.md → LocaleUserPreview.md} +2 -2
  22. data/docs/LocalesApi.md +8 -4
  23. data/docs/NotificationGroupDetail.md +1 -1
  24. data/docs/NotificationGroupsApi.md +4 -4
  25. data/docs/NotificationsApi.md +4 -4
  26. data/docs/Project.md +2 -0
  27. data/docs/ProjectCreateParameters.md +5 -1
  28. data/docs/ProjectDetails.md +2 -0
  29. data/docs/ProjectUpdateParameters.md +5 -1
  30. data/docs/SearchApi.md +1 -1
  31. data/docs/TranslationsApi.md +23 -19
  32. data/docs/TranslationsExcludeParameters.md +1 -1
  33. data/docs/TranslationsIncludeParameters.md +1 -1
  34. data/docs/TranslationsReviewParameters.md +1 -1
  35. data/docs/TranslationsSearchParameters.md +1 -1
  36. data/docs/TranslationsUnverifyParameters.md +1 -1
  37. data/docs/TranslationsVerifyParameters.md +1 -1
  38. data/docs/UploadsApi.md +3 -3
  39. data/lib/phrase/api/bitbucket_sync_api.rb +4 -4
  40. data/lib/phrase/api/branches_api.rb +6 -6
  41. data/lib/phrase/api/git_hub_sync_api.rb +4 -4
  42. data/lib/phrase/api/git_lab_sync_api.rb +4 -4
  43. data/lib/phrase/api/job_comments_api.rb +9 -9
  44. data/lib/phrase/api/job_template_locales_api.rb +12 -12
  45. data/lib/phrase/api/job_templates_api.rb +72 -72
  46. data/lib/phrase/api/locales_api.rb +10 -4
  47. data/lib/phrase/api/notification_groups_api.rb +6 -6
  48. data/lib/phrase/api/notifications_api.rb +6 -6
  49. data/lib/phrase/api/search_api.rb +2 -2
  50. data/lib/phrase/api/translations_api.rb +20 -14
  51. data/lib/phrase/api/uploads_api.rb +2 -2
  52. data/lib/phrase/models/job_locale.rb +13 -2
  53. data/lib/phrase/models/job_locale_update_parameters.rb +28 -4
  54. data/lib/phrase/models/job_locales_create_parameters.rb +33 -4
  55. data/lib/phrase/models/job_template_details.rb +285 -0
  56. data/lib/phrase/models/job_template_details1.rb +214 -0
  57. data/lib/phrase/models/job_template_locale_update_parameters.rb +28 -9
  58. data/lib/phrase/models/{job_template_locale.rb → job_template_locales.rb} +18 -7
  59. data/lib/phrase/models/job_template_locales_create_parameters.rb +28 -4
  60. data/lib/phrase/models/keys_search_parameters.rb +1 -1
  61. data/lib/phrase/models/locale_team_preview.rb +212 -0
  62. data/lib/phrase/models/{job_template_user_preview.rb → locale_user_preview.rb} +3 -3
  63. data/lib/phrase/models/notification_group_detail.rb +1 -1
  64. data/lib/phrase/models/project.rb +10 -1
  65. data/lib/phrase/models/project_create_parameters.rb +22 -2
  66. data/lib/phrase/models/project_details.rb +10 -1
  67. data/lib/phrase/models/project_update_parameters.rb +22 -2
  68. data/lib/phrase/models/translations_exclude_parameters.rb +1 -1
  69. data/lib/phrase/models/translations_include_parameters.rb +1 -1
  70. data/lib/phrase/models/translations_review_parameters.rb +1 -1
  71. data/lib/phrase/models/translations_search_parameters.rb +1 -1
  72. data/lib/phrase/models/translations_unverify_parameters.rb +1 -1
  73. data/lib/phrase/models/translations_verify_parameters.rb +1 -1
  74. data/lib/phrase/version.rb +1 -1
  75. data/lib/phrase.rb +5 -2
  76. data/spec/api/bitbucket_sync_api_spec.rb +2 -2
  77. data/spec/api/branches_api_spec.rb +3 -3
  78. data/spec/api/git_hub_sync_api_spec.rb +2 -2
  79. data/spec/api/git_lab_sync_api_spec.rb +2 -2
  80. data/spec/api/job_comments_api_spec.rb +3 -3
  81. data/spec/api/job_template_locales_api_spec.rb +4 -4
  82. data/spec/api/job_templates_api_spec.rb +17 -17
  83. data/spec/api/locales_api_spec.rb +4 -2
  84. data/spec/api/notification_groups_api_spec.rb +2 -2
  85. data/spec/api/notifications_api_spec.rb +2 -2
  86. data/spec/api/search_api_spec.rb +1 -1
  87. data/spec/api/translations_api_spec.rb +9 -7
  88. data/spec/api/uploads_api_spec.rb +1 -1
  89. data/spec/models/job_locale_spec.rb +6 -0
  90. data/spec/models/job_locale_update_parameters_spec.rb +12 -0
  91. data/spec/models/job_locales_create_parameters_spec.rb +12 -0
  92. data/spec/models/job_template_details1_spec.rb +41 -0
  93. data/spec/models/job_template_details_spec.rb +83 -0
  94. data/spec/models/job_template_locale_update_parameters_spec.rb +12 -0
  95. data/spec/models/job_template_locales_create_parameters_spec.rb +12 -0
  96. data/spec/models/{job_template_locale_spec.rb → job_template_locales_spec.rb} +12 -6
  97. data/spec/models/locale_team_preview_spec.rb +41 -0
  98. data/spec/models/{job_template_user_preview_spec.rb → locale_user_preview_spec.rb} +6 -6
  99. data/spec/models/project_create_parameters_spec.rb +12 -0
  100. data/spec/models/project_details_spec.rb +6 -0
  101. data/spec/models/project_spec.rb +6 -0
  102. data/spec/models/project_update_parameters_spec.rb +12 -0
  103. metadata +237 -225
@@ -0,0 +1,214 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class JobTemplateDetails1
5
+ attr_accessor :owner
6
+
7
+ attr_accessor :creator
8
+
9
+ attr_accessor :locales
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+ :'owner' => :'owner',
15
+ :'creator' => :'creator',
16
+ :'locales' => :'locales'
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.openapi_types
22
+ {
23
+ :'owner' => :'UserPreview',
24
+ :'creator' => :'UserPreview',
25
+ :'locales' => :'Array<LocalePreview>'
26
+ }
27
+ end
28
+
29
+ # List of attributes with nullable: true
30
+ def self.openapi_nullable
31
+ Set.new([
32
+ ])
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ if (!attributes.is_a?(Hash))
39
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobTemplateDetails1` initialize method"
40
+ end
41
+
42
+ # check to see if the attribute exists and convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h|
44
+ if (!self.class.attribute_map.key?(k.to_sym))
45
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobTemplateDetails1`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
46
+ end
47
+ h[k.to_sym] = v
48
+ }
49
+
50
+ if attributes.key?(:'owner')
51
+ self.owner = attributes[:'owner']
52
+ end
53
+
54
+ if attributes.key?(:'creator')
55
+ self.creator = attributes[:'creator']
56
+ end
57
+
58
+ if attributes.key?(:'locales')
59
+ if (value = attributes[:'locales']).is_a?(Array)
60
+ self.locales = value
61
+ end
62
+ end
63
+ end
64
+
65
+ # Show invalid properties with the reasons. Usually used together with valid?
66
+ # @return Array for valid properties with the reasons
67
+ def list_invalid_properties
68
+ invalid_properties = Array.new
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ true
76
+ end
77
+
78
+ # Checks equality by comparing each attribute.
79
+ # @param [Object] Object to be compared
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ owner == o.owner &&
84
+ creator == o.creator &&
85
+ locales == o.locales
86
+ end
87
+
88
+ # @see the `==` method
89
+ # @param [Object] Object to be compared
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculates hash code according to all attributes.
95
+ # @return [Integer] Hash code
96
+ def hash
97
+ [owner, creator, locales].hash
98
+ end
99
+
100
+ # Builds the object from hash
101
+ # @param [Hash] attributes Model attributes in the form of hash
102
+ # @return [Object] Returns the model itself
103
+ def self.build_from_hash(attributes)
104
+ new.build_from_hash(attributes)
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 build_from_hash(attributes)
111
+ return nil unless attributes.is_a?(Hash)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if type =~ /\AArray<(.*)>/i
114
+ # check to ensure the input is an array given that the attribute
115
+ # is documented as an array but the input is not
116
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
117
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
118
+ end
119
+ elsif !attributes[self.class.attribute_map[key]].nil?
120
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
121
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
122
+ end
123
+
124
+ self
125
+ end
126
+
127
+ # Deserializes the data based on type
128
+ # @param string type Data type
129
+ # @param string value Value to be deserialized
130
+ # @return [Object] Deserialized data
131
+ def _deserialize(type, value)
132
+ case type.to_sym
133
+ when :DateTime
134
+ DateTime.parse(value)
135
+ when :Date
136
+ Date.parse(value)
137
+ when :String
138
+ value.to_s
139
+ when :Integer
140
+ value.to_i
141
+ when :Float
142
+ value.to_f
143
+ when :Boolean
144
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
145
+ true
146
+ else
147
+ false
148
+ end
149
+ when :Object
150
+ # generic object (usually a Hash), return directly
151
+ value
152
+ when /\AArray<(?<inner_type>.+)>\z/
153
+ inner_type = Regexp.last_match[:inner_type]
154
+ value.map { |v| _deserialize(inner_type, v) }
155
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
156
+ k_type = Regexp.last_match[:k_type]
157
+ v_type = Regexp.last_match[:v_type]
158
+ {}.tap do |hash|
159
+ value.each do |k, v|
160
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
161
+ end
162
+ end
163
+ else # model
164
+ Phrase.const_get(type).build_from_hash(value)
165
+ end
166
+ end
167
+
168
+ # Returns the string representation of the object
169
+ # @return [String] String presentation of the object
170
+ def to_s
171
+ to_hash.to_s
172
+ end
173
+
174
+ # to_body is an alias to to_hash (backward compatibility)
175
+ # @return [Hash] Returns the object in the form of hash
176
+ def to_body
177
+ to_hash
178
+ end
179
+
180
+ # Returns the object in the form of hash
181
+ # @return [Hash] Returns the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ if value.nil?
187
+ is_nullable = self.class.openapi_nullable.include?(attr)
188
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
189
+ end
190
+
191
+ hash[param] = _to_hash(value)
192
+ end
193
+ hash
194
+ end
195
+
196
+ # Outputs non-array value in the form of hash
197
+ # For object, use to_hash. Otherwise, just return the value
198
+ # @param [Object] value Any valid value
199
+ # @return [Hash] Returns the value in the form of hash
200
+ def _to_hash(value)
201
+ if value.is_a?(Array)
202
+ value.compact.map { |v| _to_hash(v) }
203
+ elsif value.is_a?(Hash)
204
+ {}.tap do |hash|
205
+ value.each { |k, v| hash[k] = _to_hash(v) }
206
+ end
207
+ elsif value.respond_to? :to_hash
208
+ value.to_hash
209
+ else
210
+ value
211
+ end
212
+ end
213
+ end
214
+ end
@@ -14,13 +14,21 @@ module Phrase
14
14
  # Array of reviewer ids to be assigned to the job template locale
15
15
  attr_accessor :reviewer_ids
16
16
 
17
+ # Array of team ids to be assigned to the job locale as translators
18
+ attr_accessor :translator_team_ids
19
+
20
+ # Array of team ids to be assigned to the job locale as reviewers
21
+ attr_accessor :reviewer_team_ids
22
+
17
23
  # Attribute mapping from ruby-style variable name to JSON key.
18
24
  def self.attribute_map
19
25
  {
20
26
  :'branch' => :'branch',
21
27
  :'locale_id' => :'locale_id',
22
28
  :'user_ids' => :'user_ids',
23
- :'reviewer_ids' => :'reviewer_ids'
29
+ :'reviewer_ids' => :'reviewer_ids',
30
+ :'translator_team_ids' => :'translator_team_ids',
31
+ :'reviewer_team_ids' => :'reviewer_team_ids'
24
32
  }
25
33
  end
26
34
 
@@ -30,7 +38,9 @@ module Phrase
30
38
  :'branch' => :'String',
31
39
  :'locale_id' => :'String',
32
40
  :'user_ids' => :'Array<String>',
33
- :'reviewer_ids' => :'Array<String>'
41
+ :'reviewer_ids' => :'Array<String>',
42
+ :'translator_team_ids' => :'Array<String>',
43
+ :'reviewer_team_ids' => :'Array<String>'
34
44
  }
35
45
  end
36
46
 
@@ -74,23 +84,30 @@ module Phrase
74
84
  self.reviewer_ids = value
75
85
  end
76
86
  end
87
+
88
+ if attributes.key?(:'translator_team_ids')
89
+ if (value = attributes[:'translator_team_ids']).is_a?(Array)
90
+ self.translator_team_ids = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'reviewer_team_ids')
95
+ if (value = attributes[:'reviewer_team_ids']).is_a?(Array)
96
+ self.reviewer_team_ids = value
97
+ end
98
+ end
77
99
  end
78
100
 
79
101
  # Show invalid properties with the reasons. Usually used together with valid?
80
102
  # @return Array for valid properties with the reasons
81
103
  def list_invalid_properties
82
104
  invalid_properties = Array.new
83
- if @locale_id.nil?
84
- invalid_properties.push('invalid value for "locale_id", locale_id cannot be nil.')
85
- end
86
-
87
105
  invalid_properties
88
106
  end
89
107
 
90
108
  # Check to see if the all the properties in the model are valid
91
109
  # @return true if the model is valid
92
110
  def valid?
93
- return false if @locale_id.nil?
94
111
  true
95
112
  end
96
113
 
@@ -102,7 +119,9 @@ module Phrase
102
119
  branch == o.branch &&
103
120
  locale_id == o.locale_id &&
104
121
  user_ids == o.user_ids &&
105
- reviewer_ids == o.reviewer_ids
122
+ reviewer_ids == o.reviewer_ids &&
123
+ translator_team_ids == o.translator_team_ids &&
124
+ reviewer_team_ids == o.reviewer_team_ids
106
125
  end
107
126
 
108
127
  # @see the `==` method
@@ -114,7 +133,7 @@ module Phrase
114
133
  # Calculates hash code according to all attributes.
115
134
  # @return [Integer] Hash code
116
135
  def hash
117
- [branch, locale_id, user_ids, reviewer_ids].hash
136
+ [branch, locale_id, user_ids, reviewer_ids, translator_team_ids, reviewer_team_ids].hash
118
137
  end
119
138
 
120
139
  # Builds the object from hash
@@ -1,7 +1,7 @@
1
1
  require 'date'
2
2
 
3
3
  module Phrase
4
- class JobTemplateLocale
4
+ class JobTemplateLocales
5
5
  attr_accessor :id
6
6
 
7
7
  attr_accessor :job_template
@@ -10,13 +10,16 @@ module Phrase
10
10
 
11
11
  attr_accessor :users
12
12
 
13
+ attr_accessor :teams
14
+
13
15
  # Attribute mapping from ruby-style variable name to JSON key.
14
16
  def self.attribute_map
15
17
  {
16
18
  :'id' => :'id',
17
19
  :'job_template' => :'job_template',
18
20
  :'locale' => :'locale',
19
- :'users' => :'users'
21
+ :'users' => :'users',
22
+ :'teams' => :'teams'
20
23
  }
21
24
  end
22
25
 
@@ -26,7 +29,8 @@ module Phrase
26
29
  :'id' => :'String',
27
30
  :'job_template' => :'JobTemplatePreview',
28
31
  :'locale' => :'LocalePreview',
29
- :'users' => :'Array<JobTemplateUserPreview>'
32
+ :'users' => :'Array<LocaleUserPreview>',
33
+ :'teams' => :'Array<LocaleTeamPreview>'
30
34
  }
31
35
  end
32
36
 
@@ -40,13 +44,13 @@ module Phrase
40
44
  # @param [Hash] attributes Model attributes in the form of hash
41
45
  def initialize(attributes = {})
42
46
  if (!attributes.is_a?(Hash))
43
- fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobTemplateLocale` initialize method"
47
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::JobTemplateLocales` initialize method"
44
48
  end
45
49
 
46
50
  # check to see if the attribute exists and convert string to symbol for hash key
47
51
  attributes = attributes.each_with_object({}) { |(k, v), h|
48
52
  if (!self.class.attribute_map.key?(k.to_sym))
49
- fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobTemplateLocale`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
53
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::JobTemplateLocales`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
50
54
  end
51
55
  h[k.to_sym] = v
52
56
  }
@@ -68,6 +72,12 @@ module Phrase
68
72
  self.users = value
69
73
  end
70
74
  end
75
+
76
+ if attributes.key?(:'teams')
77
+ if (value = attributes[:'teams']).is_a?(Array)
78
+ self.teams = value
79
+ end
80
+ end
71
81
  end
72
82
 
73
83
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -91,7 +101,8 @@ module Phrase
91
101
  id == o.id &&
92
102
  job_template == o.job_template &&
93
103
  locale == o.locale &&
94
- users == o.users
104
+ users == o.users &&
105
+ teams == o.teams
95
106
  end
96
107
 
97
108
  # @see the `==` method
@@ -103,7 +114,7 @@ module Phrase
103
114
  # Calculates hash code according to all attributes.
104
115
  # @return [Integer] Hash code
105
116
  def hash
106
- [id, job_template, locale, users].hash
117
+ [id, job_template, locale, users, teams].hash
107
118
  end
108
119
 
109
120
  # Builds the object from hash
@@ -14,13 +14,21 @@ module Phrase
14
14
  # Array of reviewer ids to be assigned to the job template locale
15
15
  attr_accessor :reviewer_ids
16
16
 
17
+ # Array of team ids to be assigned to the job locale as translators
18
+ attr_accessor :translator_team_ids
19
+
20
+ # Array of team ids to be assigned to the job locale as reviewers
21
+ attr_accessor :reviewer_team_ids
22
+
17
23
  # Attribute mapping from ruby-style variable name to JSON key.
18
24
  def self.attribute_map
19
25
  {
20
26
  :'branch' => :'branch',
21
27
  :'locale_id' => :'locale_id',
22
28
  :'user_ids' => :'user_ids',
23
- :'reviewer_ids' => :'reviewer_ids'
29
+ :'reviewer_ids' => :'reviewer_ids',
30
+ :'translator_team_ids' => :'translator_team_ids',
31
+ :'reviewer_team_ids' => :'reviewer_team_ids'
24
32
  }
25
33
  end
26
34
 
@@ -30,7 +38,9 @@ module Phrase
30
38
  :'branch' => :'String',
31
39
  :'locale_id' => :'String',
32
40
  :'user_ids' => :'Array<String>',
33
- :'reviewer_ids' => :'Array<String>'
41
+ :'reviewer_ids' => :'Array<String>',
42
+ :'translator_team_ids' => :'Array<String>',
43
+ :'reviewer_team_ids' => :'Array<String>'
34
44
  }
35
45
  end
36
46
 
@@ -74,6 +84,18 @@ module Phrase
74
84
  self.reviewer_ids = value
75
85
  end
76
86
  end
87
+
88
+ if attributes.key?(:'translator_team_ids')
89
+ if (value = attributes[:'translator_team_ids']).is_a?(Array)
90
+ self.translator_team_ids = value
91
+ end
92
+ end
93
+
94
+ if attributes.key?(:'reviewer_team_ids')
95
+ if (value = attributes[:'reviewer_team_ids']).is_a?(Array)
96
+ self.reviewer_team_ids = value
97
+ end
98
+ end
77
99
  end
78
100
 
79
101
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -102,7 +124,9 @@ module Phrase
102
124
  branch == o.branch &&
103
125
  locale_id == o.locale_id &&
104
126
  user_ids == o.user_ids &&
105
- reviewer_ids == o.reviewer_ids
127
+ reviewer_ids == o.reviewer_ids &&
128
+ translator_team_ids == o.translator_team_ids &&
129
+ reviewer_team_ids == o.reviewer_team_ids
106
130
  end
107
131
 
108
132
  # @see the `==` method
@@ -114,7 +138,7 @@ module Phrase
114
138
  # Calculates hash code according to all attributes.
115
139
  # @return [Integer] Hash code
116
140
  def hash
117
- [branch, locale_id, user_ids, reviewer_ids].hash
141
+ [branch, locale_id, user_ids, reviewer_ids, translator_team_ids, reviewer_team_ids].hash
118
142
  end
119
143
 
120
144
  # Builds the object from hash
@@ -11,7 +11,7 @@ module Phrase
11
11
  # Order direction. Can be one of: asc, desc.
12
12
  attr_accessor :order
13
13
 
14
- # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - spaces, commas, and colons need to be escaped with double backslashes</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>.
14
+ # Specify a query to do broad search for keys by name (including wildcards).<br><br> The following qualifiers are also supported in the search term:<br> <ul> <li><code>ids:key_id,...</code> for queries on a comma-separated list of ids</li> <li><code>name:key_name</code> for text queries on exact key names - spaces, commas, and colons need to be escaped with double backslashes</li> <li><code>tags:tag_name</code> to filter for keys with certain tags</li> <li><code>translated:{true|false}</code> for translation status (also requires <code>locale_id</code> to be specified)</li> <li><code>updated_at:{>=|<=}2013-02-21T00:00:00Z</code> for date range queries</li> <li><code>unmentioned_in_upload:upload_id</code> to filter keys unmentioned within upload</li> </ul> Find more examples <a href=\"#overview--usage-examples\">here</a>. Please note: If <code>tags</code> are added to filter the search, the search will be limited to a maximum of 65,536 tagged keys.
15
15
  attr_accessor :q
16
16
 
17
17
  # Locale used to determine the translation state of a key when filtering for untranslated or translated keys.
@@ -0,0 +1,212 @@
1
+ require 'date'
2
+
3
+ module Phrase
4
+ class LocaleTeamPreview
5
+ attr_accessor :id
6
+
7
+ attr_accessor :name
8
+
9
+ attr_accessor :role
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+ :'id' => :'id',
15
+ :'name' => :'name',
16
+ :'role' => :'role'
17
+ }
18
+ end
19
+
20
+ # Attribute type mapping.
21
+ def self.openapi_types
22
+ {
23
+ :'id' => :'String',
24
+ :'name' => :'String',
25
+ :'role' => :'String'
26
+ }
27
+ end
28
+
29
+ # List of attributes with nullable: true
30
+ def self.openapi_nullable
31
+ Set.new([
32
+ ])
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ if (!attributes.is_a?(Hash))
39
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Phrase::LocaleTeamPreview` initialize method"
40
+ end
41
+
42
+ # check to see if the attribute exists and convert string to symbol for hash key
43
+ attributes = attributes.each_with_object({}) { |(k, v), h|
44
+ if (!self.class.attribute_map.key?(k.to_sym))
45
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Phrase::LocaleTeamPreview`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
46
+ end
47
+ h[k.to_sym] = v
48
+ }
49
+
50
+ if attributes.key?(:'id')
51
+ self.id = attributes[:'id']
52
+ end
53
+
54
+ if attributes.key?(:'name')
55
+ self.name = attributes[:'name']
56
+ end
57
+
58
+ if attributes.key?(:'role')
59
+ self.role = attributes[:'role']
60
+ end
61
+ end
62
+
63
+ # Show invalid properties with the reasons. Usually used together with valid?
64
+ # @return Array for valid properties with the reasons
65
+ def list_invalid_properties
66
+ invalid_properties = Array.new
67
+ invalid_properties
68
+ end
69
+
70
+ # Check to see if the all the properties in the model are valid
71
+ # @return true if the model is valid
72
+ def valid?
73
+ true
74
+ end
75
+
76
+ # Checks equality by comparing each attribute.
77
+ # @param [Object] Object to be compared
78
+ def ==(o)
79
+ return true if self.equal?(o)
80
+ self.class == o.class &&
81
+ id == o.id &&
82
+ name == o.name &&
83
+ role == o.role
84
+ end
85
+
86
+ # @see the `==` method
87
+ # @param [Object] Object to be compared
88
+ def eql?(o)
89
+ self == o
90
+ end
91
+
92
+ # Calculates hash code according to all attributes.
93
+ # @return [Integer] Hash code
94
+ def hash
95
+ [id, name, role].hash
96
+ end
97
+
98
+ # Builds the object from hash
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ # @return [Object] Returns the model itself
101
+ def self.build_from_hash(attributes)
102
+ new.build_from_hash(attributes)
103
+ end
104
+
105
+ # Builds the object from hash
106
+ # @param [Hash] attributes Model attributes in the form of hash
107
+ # @return [Object] Returns the model itself
108
+ def build_from_hash(attributes)
109
+ return nil unless attributes.is_a?(Hash)
110
+ self.class.openapi_types.each_pair do |key, type|
111
+ if type =~ /\AArray<(.*)>/i
112
+ # check to ensure the input is an array given that the attribute
113
+ # is documented as an array but the input is not
114
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
115
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
116
+ end
117
+ elsif !attributes[self.class.attribute_map[key]].nil?
118
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
120
+ end
121
+
122
+ self
123
+ end
124
+
125
+ # Deserializes the data based on type
126
+ # @param string type Data type
127
+ # @param string value Value to be deserialized
128
+ # @return [Object] Deserialized data
129
+ def _deserialize(type, value)
130
+ case type.to_sym
131
+ when :DateTime
132
+ DateTime.parse(value)
133
+ when :Date
134
+ Date.parse(value)
135
+ when :String
136
+ value.to_s
137
+ when :Integer
138
+ value.to_i
139
+ when :Float
140
+ value.to_f
141
+ when :Boolean
142
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
+ true
144
+ else
145
+ false
146
+ end
147
+ when :Object
148
+ # generic object (usually a Hash), return directly
149
+ value
150
+ when /\AArray<(?<inner_type>.+)>\z/
151
+ inner_type = Regexp.last_match[:inner_type]
152
+ value.map { |v| _deserialize(inner_type, v) }
153
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
+ k_type = Regexp.last_match[:k_type]
155
+ v_type = Regexp.last_match[:v_type]
156
+ {}.tap do |hash|
157
+ value.each do |k, v|
158
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
+ end
160
+ end
161
+ else # model
162
+ Phrase.const_get(type).build_from_hash(value)
163
+ end
164
+ end
165
+
166
+ # Returns the string representation of the object
167
+ # @return [String] String presentation of the object
168
+ def to_s
169
+ to_hash.to_s
170
+ end
171
+
172
+ # to_body is an alias to to_hash (backward compatibility)
173
+ # @return [Hash] Returns the object in the form of hash
174
+ def to_body
175
+ to_hash
176
+ end
177
+
178
+ # Returns the object in the form of hash
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_hash
181
+ hash = {}
182
+ self.class.attribute_map.each_pair do |attr, param|
183
+ value = self.send(attr)
184
+ if value.nil?
185
+ is_nullable = self.class.openapi_nullable.include?(attr)
186
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
187
+ end
188
+
189
+ hash[param] = _to_hash(value)
190
+ end
191
+ hash
192
+ end
193
+
194
+ # Outputs non-array value in the form of hash
195
+ # For object, use to_hash. Otherwise, just return the value
196
+ # @param [Object] value Any valid value
197
+ # @return [Hash] Returns the value in the form of hash
198
+ def _to_hash(value)
199
+ if value.is_a?(Array)
200
+ value.compact.map { |v| _to_hash(v) }
201
+ elsif value.is_a?(Hash)
202
+ {}.tap do |hash|
203
+ value.each { |k, v| hash[k] = _to_hash(v) }
204
+ end
205
+ elsif value.respond_to? :to_hash
206
+ value.to_hash
207
+ else
208
+ value
209
+ end
210
+ end
211
+ end
212
+ end