zyphr 0.1.48 → 0.1.49
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.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/docs/PasswordPolicy.md +30 -0
- data/docs/PasswordRequirementsResponseData.md +3 -1
- data/docs/PasswordStrength.md +24 -0
- data/docs/PasswordStrengthRequest.md +20 -0
- data/docs/PasswordStrengthResponse.md +20 -0
- data/docs/UtilityApi.md +73 -1
- data/lib/zyphr/api/utility_api.rb +70 -2
- data/lib/zyphr/models/password_policy.rb +401 -0
- data/lib/zyphr/models/password_requirements_response_data.rb +49 -3
- data/lib/zyphr/models/password_strength.rb +363 -0
- data/lib/zyphr/models/{password_requirements.rb → password_strength_request.rb} +36 -52
- data/lib/zyphr/models/password_strength_response.rb +229 -0
- data/lib/zyphr.rb +4 -1
- data/spec/api/utility_api_spec.rb +13 -1
- data/spec/models/{password_requirements_spec.rb → password_policy_spec.rb} +12 -6
- data/spec/models/password_requirements_response_data_spec.rb +6 -0
- data/spec/models/password_strength_request_spec.rb +42 -0
- data/spec/models/password_strength_response_spec.rb +42 -0
- data/spec/models/password_strength_spec.rb +58 -0
- data/zyphr.gemspec +1 -1
- metadata +18 -6
- data/docs/PasswordRequirements.md +0 -28
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Zyphr API
|
|
3
|
+
|
|
4
|
+
#Zyphr is a multi-channel notification platform that enables developers to send emails, push notifications, SMS, and in-app messages through a unified API. ## Authentication All API requests require authentication using an API key. Include your API key in the `X-API-Key` header: ``` X-API-Key: zy_live_xxxxxxxxxxxx ``` API keys can be created in the Zyphr Dashboard. Use `zy_test_*` keys for testing and `zy_live_*` keys for production. ## Rate Limiting The API implements rate limiting to ensure fair usage. Rate limit information is included in response headers: - `X-RateLimit-Limit`: Maximum requests per window - `X-RateLimit-Remaining`: Remaining requests in current window - `X-RateLimit-Reset`: Unix timestamp when the window resets ## Account Sending Status Every authenticated response carries the account's current sending state so you can surface it in your own tooling without a separate call: - `X-Account-Sending-Status`: `active`, `throttled`, or `frozen` - `X-Account-Sending-Status-Reason`: human-readable reason (present only when the status is `throttled` or `frozen`) This header is informational and non-blocking on non-send endpoints (reads, billing, and deliverability stay available). Send-capable endpoints additionally enforce the state: a frozen account receives `403 account_frozen` and a throttled account receives `429 account_throttled`, both with the reason in the error message. ## Errors All errors follow a consistent format: ```json { \"error\": { \"code\": \"error_code\", \"message\": \"Human readable message\", \"details\": {} }, \"meta\": { \"request_id\": \"req_xxxx\" } } ```
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: support@zyphr.dev
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.12.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Zyphr
|
|
17
|
+
# Structured password policy rules for the application. Use these fields to drive a live, client-side requirements checklist (e.g. a green/grey indicator per rule) before submitting a registration or reset.
|
|
18
|
+
class PasswordPolicy
|
|
19
|
+
# Minimum password length.
|
|
20
|
+
attr_accessor :min_length
|
|
21
|
+
|
|
22
|
+
# Maximum password length.
|
|
23
|
+
attr_accessor :max_length
|
|
24
|
+
|
|
25
|
+
# Whether at least one uppercase letter (A-Z) is required.
|
|
26
|
+
attr_accessor :require_uppercase
|
|
27
|
+
|
|
28
|
+
# Whether at least one lowercase letter (a-z) is required.
|
|
29
|
+
attr_accessor :require_lowercase
|
|
30
|
+
|
|
31
|
+
# Whether at least one number (0-9) is required.
|
|
32
|
+
attr_accessor :require_numbers
|
|
33
|
+
|
|
34
|
+
# Whether at least one special character is required.
|
|
35
|
+
attr_accessor :require_special
|
|
36
|
+
|
|
37
|
+
# Whether commonly used passwords are rejected.
|
|
38
|
+
attr_accessor :disallow_common
|
|
39
|
+
|
|
40
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
41
|
+
def self.attribute_map
|
|
42
|
+
{
|
|
43
|
+
:'min_length' => :'min_length',
|
|
44
|
+
:'max_length' => :'max_length',
|
|
45
|
+
:'require_uppercase' => :'require_uppercase',
|
|
46
|
+
:'require_lowercase' => :'require_lowercase',
|
|
47
|
+
:'require_numbers' => :'require_numbers',
|
|
48
|
+
:'require_special' => :'require_special',
|
|
49
|
+
:'disallow_common' => :'disallow_common'
|
|
50
|
+
}
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Returns attribute mapping this model knows about
|
|
54
|
+
def self.acceptable_attribute_map
|
|
55
|
+
attribute_map
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Returns all the JSON keys this model knows about
|
|
59
|
+
def self.acceptable_attributes
|
|
60
|
+
acceptable_attribute_map.values
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Attribute type mapping.
|
|
64
|
+
def self.openapi_types
|
|
65
|
+
{
|
|
66
|
+
:'min_length' => :'Integer',
|
|
67
|
+
:'max_length' => :'Integer',
|
|
68
|
+
:'require_uppercase' => :'Boolean',
|
|
69
|
+
:'require_lowercase' => :'Boolean',
|
|
70
|
+
:'require_numbers' => :'Boolean',
|
|
71
|
+
:'require_special' => :'Boolean',
|
|
72
|
+
:'disallow_common' => :'Boolean'
|
|
73
|
+
}
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# List of attributes with nullable: true
|
|
77
|
+
def self.openapi_nullable
|
|
78
|
+
Set.new([
|
|
79
|
+
])
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Initializes the object
|
|
83
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
84
|
+
def initialize(attributes = {})
|
|
85
|
+
if (!attributes.is_a?(Hash))
|
|
86
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Zyphr::PasswordPolicy` initialize method"
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
90
|
+
acceptable_attribute_map = self.class.acceptable_attribute_map
|
|
91
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
92
|
+
if (!acceptable_attribute_map.key?(k.to_sym))
|
|
93
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Zyphr::PasswordPolicy`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
|
|
94
|
+
end
|
|
95
|
+
h[k.to_sym] = v
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if attributes.key?(:'min_length')
|
|
99
|
+
self.min_length = attributes[:'min_length']
|
|
100
|
+
else
|
|
101
|
+
self.min_length = nil
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'max_length')
|
|
105
|
+
self.max_length = attributes[:'max_length']
|
|
106
|
+
else
|
|
107
|
+
self.max_length = nil
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'require_uppercase')
|
|
111
|
+
self.require_uppercase = attributes[:'require_uppercase']
|
|
112
|
+
else
|
|
113
|
+
self.require_uppercase = nil
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
if attributes.key?(:'require_lowercase')
|
|
117
|
+
self.require_lowercase = attributes[:'require_lowercase']
|
|
118
|
+
else
|
|
119
|
+
self.require_lowercase = nil
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'require_numbers')
|
|
123
|
+
self.require_numbers = attributes[:'require_numbers']
|
|
124
|
+
else
|
|
125
|
+
self.require_numbers = nil
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
if attributes.key?(:'require_special')
|
|
129
|
+
self.require_special = attributes[:'require_special']
|
|
130
|
+
else
|
|
131
|
+
self.require_special = nil
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
if attributes.key?(:'disallow_common')
|
|
135
|
+
self.disallow_common = attributes[:'disallow_common']
|
|
136
|
+
else
|
|
137
|
+
self.disallow_common = nil
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
142
|
+
# @return Array for valid properties with the reasons
|
|
143
|
+
def list_invalid_properties
|
|
144
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
145
|
+
invalid_properties = Array.new
|
|
146
|
+
if @min_length.nil?
|
|
147
|
+
invalid_properties.push('invalid value for "min_length", min_length cannot be nil.')
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
if @max_length.nil?
|
|
151
|
+
invalid_properties.push('invalid value for "max_length", max_length cannot be nil.')
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
if @require_uppercase.nil?
|
|
155
|
+
invalid_properties.push('invalid value for "require_uppercase", require_uppercase cannot be nil.')
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if @require_lowercase.nil?
|
|
159
|
+
invalid_properties.push('invalid value for "require_lowercase", require_lowercase cannot be nil.')
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
if @require_numbers.nil?
|
|
163
|
+
invalid_properties.push('invalid value for "require_numbers", require_numbers cannot be nil.')
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
if @require_special.nil?
|
|
167
|
+
invalid_properties.push('invalid value for "require_special", require_special cannot be nil.')
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if @disallow_common.nil?
|
|
171
|
+
invalid_properties.push('invalid value for "disallow_common", disallow_common cannot be nil.')
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
invalid_properties
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
# Check to see if the all the properties in the model are valid
|
|
178
|
+
# @return true if the model is valid
|
|
179
|
+
def valid?
|
|
180
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
181
|
+
return false if @min_length.nil?
|
|
182
|
+
return false if @max_length.nil?
|
|
183
|
+
return false if @require_uppercase.nil?
|
|
184
|
+
return false if @require_lowercase.nil?
|
|
185
|
+
return false if @require_numbers.nil?
|
|
186
|
+
return false if @require_special.nil?
|
|
187
|
+
return false if @disallow_common.nil?
|
|
188
|
+
true
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
# Custom attribute writer method with validation
|
|
192
|
+
# @param [Object] min_length Value to be assigned
|
|
193
|
+
def min_length=(min_length)
|
|
194
|
+
if min_length.nil?
|
|
195
|
+
fail ArgumentError, 'min_length cannot be nil'
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
@min_length = min_length
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Custom attribute writer method with validation
|
|
202
|
+
# @param [Object] max_length Value to be assigned
|
|
203
|
+
def max_length=(max_length)
|
|
204
|
+
if max_length.nil?
|
|
205
|
+
fail ArgumentError, 'max_length cannot be nil'
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
@max_length = max_length
|
|
209
|
+
end
|
|
210
|
+
|
|
211
|
+
# Custom attribute writer method with validation
|
|
212
|
+
# @param [Object] require_uppercase Value to be assigned
|
|
213
|
+
def require_uppercase=(require_uppercase)
|
|
214
|
+
if require_uppercase.nil?
|
|
215
|
+
fail ArgumentError, 'require_uppercase cannot be nil'
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
@require_uppercase = require_uppercase
|
|
219
|
+
end
|
|
220
|
+
|
|
221
|
+
# Custom attribute writer method with validation
|
|
222
|
+
# @param [Object] require_lowercase Value to be assigned
|
|
223
|
+
def require_lowercase=(require_lowercase)
|
|
224
|
+
if require_lowercase.nil?
|
|
225
|
+
fail ArgumentError, 'require_lowercase cannot be nil'
|
|
226
|
+
end
|
|
227
|
+
|
|
228
|
+
@require_lowercase = require_lowercase
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
# Custom attribute writer method with validation
|
|
232
|
+
# @param [Object] require_numbers Value to be assigned
|
|
233
|
+
def require_numbers=(require_numbers)
|
|
234
|
+
if require_numbers.nil?
|
|
235
|
+
fail ArgumentError, 'require_numbers cannot be nil'
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
@require_numbers = require_numbers
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
# Custom attribute writer method with validation
|
|
242
|
+
# @param [Object] require_special Value to be assigned
|
|
243
|
+
def require_special=(require_special)
|
|
244
|
+
if require_special.nil?
|
|
245
|
+
fail ArgumentError, 'require_special cannot be nil'
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
@require_special = require_special
|
|
249
|
+
end
|
|
250
|
+
|
|
251
|
+
# Custom attribute writer method with validation
|
|
252
|
+
# @param [Object] disallow_common Value to be assigned
|
|
253
|
+
def disallow_common=(disallow_common)
|
|
254
|
+
if disallow_common.nil?
|
|
255
|
+
fail ArgumentError, 'disallow_common cannot be nil'
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
@disallow_common = disallow_common
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
# Checks equality by comparing each attribute.
|
|
262
|
+
# @param [Object] Object to be compared
|
|
263
|
+
def ==(o)
|
|
264
|
+
return true if self.equal?(o)
|
|
265
|
+
self.class == o.class &&
|
|
266
|
+
min_length == o.min_length &&
|
|
267
|
+
max_length == o.max_length &&
|
|
268
|
+
require_uppercase == o.require_uppercase &&
|
|
269
|
+
require_lowercase == o.require_lowercase &&
|
|
270
|
+
require_numbers == o.require_numbers &&
|
|
271
|
+
require_special == o.require_special &&
|
|
272
|
+
disallow_common == o.disallow_common
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
# @see the `==` method
|
|
276
|
+
# @param [Object] Object to be compared
|
|
277
|
+
def eql?(o)
|
|
278
|
+
self == o
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
# Calculates hash code according to all attributes.
|
|
282
|
+
# @return [Integer] Hash code
|
|
283
|
+
def hash
|
|
284
|
+
[min_length, max_length, require_uppercase, require_lowercase, require_numbers, require_special, disallow_common].hash
|
|
285
|
+
end
|
|
286
|
+
|
|
287
|
+
# Builds the object from hash
|
|
288
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
289
|
+
# @return [Object] Returns the model itself
|
|
290
|
+
def self.build_from_hash(attributes)
|
|
291
|
+
return nil unless attributes.is_a?(Hash)
|
|
292
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
293
|
+
transformed_hash = {}
|
|
294
|
+
openapi_types.each_pair do |key, type|
|
|
295
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
296
|
+
transformed_hash["#{key}"] = nil
|
|
297
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
298
|
+
# check to ensure the input is an array given that the attribute
|
|
299
|
+
# is documented as an array but the input is not
|
|
300
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
301
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
302
|
+
end
|
|
303
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
304
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
305
|
+
end
|
|
306
|
+
end
|
|
307
|
+
new(transformed_hash)
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
# Deserializes the data based on type
|
|
311
|
+
# @param string type Data type
|
|
312
|
+
# @param string value Value to be deserialized
|
|
313
|
+
# @return [Object] Deserialized data
|
|
314
|
+
def self._deserialize(type, value)
|
|
315
|
+
case type.to_sym
|
|
316
|
+
when :Time
|
|
317
|
+
Time.parse(value)
|
|
318
|
+
when :Date
|
|
319
|
+
Date.parse(value)
|
|
320
|
+
when :String
|
|
321
|
+
value.to_s
|
|
322
|
+
when :Integer
|
|
323
|
+
value.to_i
|
|
324
|
+
when :Float
|
|
325
|
+
value.to_f
|
|
326
|
+
when :Boolean
|
|
327
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
328
|
+
true
|
|
329
|
+
else
|
|
330
|
+
false
|
|
331
|
+
end
|
|
332
|
+
when :Object
|
|
333
|
+
# generic object (usually a Hash), return directly
|
|
334
|
+
value
|
|
335
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
336
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
337
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
338
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
339
|
+
k_type = Regexp.last_match[:k_type]
|
|
340
|
+
v_type = Regexp.last_match[:v_type]
|
|
341
|
+
{}.tap do |hash|
|
|
342
|
+
value.each do |k, v|
|
|
343
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
else # model
|
|
347
|
+
# models (e.g. Pet) or oneOf
|
|
348
|
+
klass = Zyphr.const_get(type)
|
|
349
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
350
|
+
end
|
|
351
|
+
end
|
|
352
|
+
|
|
353
|
+
# Returns the string representation of the object
|
|
354
|
+
# @return [String] String presentation of the object
|
|
355
|
+
def to_s
|
|
356
|
+
to_hash.to_s
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
360
|
+
# @return [Hash] Returns the object in the form of hash
|
|
361
|
+
def to_body
|
|
362
|
+
to_hash
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
# Returns the object in the form of hash
|
|
366
|
+
# @return [Hash] Returns the object in the form of hash
|
|
367
|
+
def to_hash
|
|
368
|
+
hash = {}
|
|
369
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
370
|
+
value = self.send(attr)
|
|
371
|
+
if value.nil?
|
|
372
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
373
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
374
|
+
end
|
|
375
|
+
|
|
376
|
+
hash[param] = _to_hash(value)
|
|
377
|
+
end
|
|
378
|
+
hash
|
|
379
|
+
end
|
|
380
|
+
|
|
381
|
+
# Outputs non-array value in the form of hash
|
|
382
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
383
|
+
# @param [Object] value Any valid value
|
|
384
|
+
# @return [Hash] Returns the value in the form of hash
|
|
385
|
+
def _to_hash(value)
|
|
386
|
+
if value.is_a?(Array)
|
|
387
|
+
value.compact.map { |v| _to_hash(v) }
|
|
388
|
+
elsif value.is_a?(Hash)
|
|
389
|
+
{}.tap do |hash|
|
|
390
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
391
|
+
end
|
|
392
|
+
elsif value.respond_to? :to_hash
|
|
393
|
+
value.to_hash
|
|
394
|
+
else
|
|
395
|
+
value
|
|
396
|
+
end
|
|
397
|
+
end
|
|
398
|
+
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
end
|
|
@@ -15,11 +15,15 @@ require 'time'
|
|
|
15
15
|
|
|
16
16
|
module Zyphr
|
|
17
17
|
class PasswordRequirementsResponseData
|
|
18
|
+
attr_accessor :policy
|
|
19
|
+
|
|
20
|
+
# Human-readable display strings for the active password rules (e.g. \"At least 8 characters\"). Backward-compatible with the original response shape.
|
|
18
21
|
attr_accessor :requirements
|
|
19
22
|
|
|
20
23
|
# Attribute mapping from ruby-style variable name to JSON key.
|
|
21
24
|
def self.attribute_map
|
|
22
25
|
{
|
|
26
|
+
:'policy' => :'policy',
|
|
23
27
|
:'requirements' => :'requirements'
|
|
24
28
|
}
|
|
25
29
|
end
|
|
@@ -37,7 +41,8 @@ module Zyphr
|
|
|
37
41
|
# Attribute type mapping.
|
|
38
42
|
def self.openapi_types
|
|
39
43
|
{
|
|
40
|
-
:'
|
|
44
|
+
:'policy' => :'PasswordPolicy',
|
|
45
|
+
:'requirements' => :'Array<String>'
|
|
41
46
|
}
|
|
42
47
|
end
|
|
43
48
|
|
|
@@ -63,8 +68,18 @@ module Zyphr
|
|
|
63
68
|
h[k.to_sym] = v
|
|
64
69
|
}
|
|
65
70
|
|
|
71
|
+
if attributes.key?(:'policy')
|
|
72
|
+
self.policy = attributes[:'policy']
|
|
73
|
+
else
|
|
74
|
+
self.policy = nil
|
|
75
|
+
end
|
|
76
|
+
|
|
66
77
|
if attributes.key?(:'requirements')
|
|
67
|
-
|
|
78
|
+
if (value = attributes[:'requirements']).is_a?(Array)
|
|
79
|
+
self.requirements = value
|
|
80
|
+
end
|
|
81
|
+
else
|
|
82
|
+
self.requirements = nil
|
|
68
83
|
end
|
|
69
84
|
end
|
|
70
85
|
|
|
@@ -73,6 +88,14 @@ module Zyphr
|
|
|
73
88
|
def list_invalid_properties
|
|
74
89
|
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
75
90
|
invalid_properties = Array.new
|
|
91
|
+
if @policy.nil?
|
|
92
|
+
invalid_properties.push('invalid value for "policy", policy cannot be nil.')
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
if @requirements.nil?
|
|
96
|
+
invalid_properties.push('invalid value for "requirements", requirements cannot be nil.')
|
|
97
|
+
end
|
|
98
|
+
|
|
76
99
|
invalid_properties
|
|
77
100
|
end
|
|
78
101
|
|
|
@@ -80,14 +103,37 @@ module Zyphr
|
|
|
80
103
|
# @return true if the model is valid
|
|
81
104
|
def valid?
|
|
82
105
|
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
106
|
+
return false if @policy.nil?
|
|
107
|
+
return false if @requirements.nil?
|
|
83
108
|
true
|
|
84
109
|
end
|
|
85
110
|
|
|
111
|
+
# Custom attribute writer method with validation
|
|
112
|
+
# @param [Object] policy Value to be assigned
|
|
113
|
+
def policy=(policy)
|
|
114
|
+
if policy.nil?
|
|
115
|
+
fail ArgumentError, 'policy cannot be nil'
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
@policy = policy
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
# Custom attribute writer method with validation
|
|
122
|
+
# @param [Object] requirements Value to be assigned
|
|
123
|
+
def requirements=(requirements)
|
|
124
|
+
if requirements.nil?
|
|
125
|
+
fail ArgumentError, 'requirements cannot be nil'
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
@requirements = requirements
|
|
129
|
+
end
|
|
130
|
+
|
|
86
131
|
# Checks equality by comparing each attribute.
|
|
87
132
|
# @param [Object] Object to be compared
|
|
88
133
|
def ==(o)
|
|
89
134
|
return true if self.equal?(o)
|
|
90
135
|
self.class == o.class &&
|
|
136
|
+
policy == o.policy &&
|
|
91
137
|
requirements == o.requirements
|
|
92
138
|
end
|
|
93
139
|
|
|
@@ -100,7 +146,7 @@ module Zyphr
|
|
|
100
146
|
# Calculates hash code according to all attributes.
|
|
101
147
|
# @return [Integer] Hash code
|
|
102
148
|
def hash
|
|
103
|
-
[requirements].hash
|
|
149
|
+
[policy, requirements].hash
|
|
104
150
|
end
|
|
105
151
|
|
|
106
152
|
# Builds the object from hash
|