lib/fastly/models/validator_result.rb in fastly-5.3.0 vs lib/fastly/models/validator_result.rb in fastly-5.3.1

- old
+ new

@@ -12,50 +12,16 @@ require 'time' module Fastly # Results from VCL linting class ValidatorResult - attr_accessor :msg + attr_accessor :data - attr_accessor :status - - attr_accessor :errors - - attr_accessor :warnings - - attr_accessor :messages - - class EnumAttributeValidator - attr_reader :datatype - attr_reader :allowable_values - - def initialize(datatype, allowable_values) - @allowable_values = allowable_values.map do |value| - case datatype.to_s - when /Integer/i - value.to_i - when /Float/i - value.to_f - else - value - end - end - end - - def valid?(value) - !value || allowable_values.include?(value) - end - end - # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { - :'msg' => :'msg', - :'status' => :'status', - :'errors' => :'errors', - :'warnings' => :'warnings', - :'messages' => :'messages' + :'data' => :'data' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes @@ -63,22 +29,17 @@ end # Attribute type mapping. def self.fastly_types { - :'msg' => :'String', - :'status' => :'String', - :'errors' => :'Array<String>', - :'warnings' => :'Array<String>', - :'messages' => :'Array<ValidatorResultMessages>' + :'data' => :'ValidatorResultData' } end # List of attributes with nullable: true def self.fastly_nullable Set.new([ - :'msg', ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash @@ -93,35 +54,13 @@ fail ArgumentError, "`#{k}` is not a valid attribute in `Fastly::ValidatorResult`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect end h[k.to_sym] = v } - if attributes.key?(:'msg') - self.msg = attributes[:'msg'] + if attributes.key?(:'data') + self.data = attributes[:'data'] end - - if attributes.key?(:'status') - self.status = attributes[:'status'] - end - - if attributes.key?(:'errors') - if (value = attributes[:'errors']).is_a?(Array) - self.errors = value - end - end - - if attributes.key?(:'warnings') - if (value = attributes[:'warnings']).is_a?(Array) - self.warnings = value - end - end - - if attributes.key?(:'messages') - if (value = attributes[:'messages']).is_a?(Array) - self.messages = value - end - end end # Show invalid properties with the reasons. Usually used together with valid? # @return Array for valid properties with the reasons def list_invalid_properties @@ -130,35 +69,19 @@ end # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? - status_validator = EnumAttributeValidator.new('String', ["error", "ok"]) - return false unless status_validator.valid?(@status) true end - # Custom attribute writer method checking allowed values (enum). - # @param [Object] status Object to be assigned - def status=(status) - validator = EnumAttributeValidator.new('String', ["error", "ok"]) - unless validator.valid?(status) - fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}." - end - @status = status - end - # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o) return true if self.equal?(o) self.class == o.class && - msg == o.msg && - status == o.status && - errors == o.errors && - warnings == o.warnings && - messages == o.messages + data == o.data end # @see the `==` method # @param [Object] Object to be compared def eql?(o) @@ -166,10 +89,10 @@ end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [msg, status, errors, warnings, messages].hash + [data].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself