lib/VoucherifySdk/models/session.rb in voucherify-5.0.0 vs lib/VoucherifySdk/models/session.rb in voucherify-6.0.0

- old
+ new

@@ -16,11 +16,11 @@ module VoucherifySdk class Session # The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated. attr_accessor :key - # This parameter is required to establish a new session. The session locks the redemption quantity by 1. + # This parameter is required to establish a new session. attr_accessor :type # Value for the period of time that the session is active. Units for this parameter are defined by the session.ttl_unit parameter. attr_accessor :ttl @@ -75,32 +75,27 @@ end # List of attributes with nullable: true def self.openapi_nullable Set.new([ + :'key', + :'type', + :'ttl', + :'ttl_unit' ]) end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) - if (!attributes.is_a?(Hash)) - fail ArgumentError, "The input argument (attributes) must be a hash in `VoucherifySdk::Session` initialize method" - end - # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| - if (!self.class.attribute_map.key?(k.to_sym)) - fail ArgumentError, "`#{k}` is not a valid attribute in `VoucherifySdk::Session`. 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?(:'key') self.key = attributes[:'key'] - else - self.key = 'LOCK' end if attributes.key?(:'type') self.type = attributes[:'type'] else @@ -126,46 +121,14 @@ # Check to see if the all the properties in the model are valid # @return true if the model is valid def valid? warn '[DEPRECATED] the `valid?` method is obsolete' - key_validator = EnumAttributeValidator.new('String', ["LOCK"]) - return false unless key_validator.valid?(@key) type_validator = EnumAttributeValidator.new('String', ["LOCK"]) return false unless type_validator.valid?(@type) ttl_unit_validator = EnumAttributeValidator.new('String', ["DAYS", "HOURS", "MICROSECONDS", "MILLISECONDS", "MINUTES", "NANOSECONDS", "SECONDS"]) return false unless ttl_unit_validator.valid?(@ttl_unit) true - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] key Object to be assigned - def key=(key) - validator = EnumAttributeValidator.new('String', ["LOCK"]) - unless validator.valid?(key) - fail ArgumentError, "invalid value for \"key\", must be one of #{validator.allowable_values}." - end - @key = key - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] type Object to be assigned - def type=(type) - validator = EnumAttributeValidator.new('String', ["LOCK"]) - unless validator.valid?(type) - fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." - end - @type = type - end - - # Custom attribute writer method checking allowed values (enum). - # @param [Object] ttl_unit Object to be assigned - def ttl_unit=(ttl_unit) - validator = EnumAttributeValidator.new('String', ["DAYS", "HOURS", "MICROSECONDS", "MILLISECONDS", "MINUTES", "NANOSECONDS", "SECONDS"]) - unless validator.valid?(ttl_unit) - fail ArgumentError, "invalid value for \"ttl_unit\", must be one of #{validator.allowable_values}." - end - @ttl_unit = ttl_unit end # Checks equality by comparing each attribute. # @param [Object] Object to be compared def ==(o)