lib/square_connect/models/tender.rb in square_connect-2.20190612.1.314 vs lib/square_connect/models/tender.rb in square_connect-2.20190710.0.321
- old
+ new
@@ -49,32 +49,11 @@
attr_accessor :cash_details
# Additional recipients (other than the merchant) receiving a portion of this tender. For example, fees assessed on the purchase by a third party integration.
attr_accessor :additional_recipients
- 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
{
:'id' => :'id',
:'location_id' => :'location_id',
@@ -188,22 +167,10 @@
# Check to see if the all the properties in the model are valid
# @return true if the model is valid
def valid?
return false if @type.nil?
- type_validator = EnumAttributeValidator.new('String', ["CARD", "CASH", "THIRD_PARTY_CARD", "SQUARE_GIFT_CARD", "NO_SALE", "OTHER"])
- return false unless type_validator.valid?(@type)
return true
- end
-
- # Custom attribute writer method checking allowed values (enum).
- # @param [Object] type Object to be assigned
- def type=(type)
- validator = EnumAttributeValidator.new('String', ["CARD", "CASH", "THIRD_PARTY_CARD", "SQUARE_GIFT_CARD", "NO_SALE", "OTHER"])
- unless validator.valid?(type)
- fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
- end
- @type = type
end
# Checks equality by comparing each attribute.
# @param [Object] Object to be compared
def ==(o)