=begin #Synctera API #
Welcome to the official reference documentation for Synctera APIs. Our APIs are the best way to automate your company's banking needs and are designed to be easy to understand and implement.
We're continuously growing this library and what you see here is just the start, but if you need something specific or have a question, contact us.
The version of the OpenAPI document: 0.60.0 Generated by: https://openapi-generator.tech OpenAPI Generator version: 6.5.0 =end require 'date' require 'time' module SyncteraRubySdk # Simulate receiving an ACH transaction class AchTransactionSimulationRequest # Number of the receiving account attr_accessor :account_number # Amount to transfer in cents (e.g. 100 = $1). attr_accessor :amount # The type of transaction (debit or credit) in relation to the receiving account. A credit is a transfer in and a debit is a transfer pulling money out of the receiving account. attr_accessor :dc_sign # Effective date of the transaction. Transactions with the current date or date in the past are posted immediately. Future-dated transactions are scheduled to be posted on the chosen date. attr_accessor :effective_date 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 { :'account_number' => :'account_number', :'amount' => :'amount', :'dc_sign' => :'dc_sign', :'effective_date' => :'effective_date' } end # Returns all the JSON keys this model knows about def self.acceptable_attributes attribute_map.values end # Attribute type mapping. def self.openapi_types { :'account_number' => :'String', :'amount' => :'Integer', :'dc_sign' => :'String', :'effective_date' => :'Date' } end # List of attributes with nullable: true def self.openapi_nullable Set.new([ ]) 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 `SyncteraRubySdk::AchTransactionSimulationRequest` 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 `SyncteraRubySdk::AchTransactionSimulationRequest`. 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?(:'account_number') self.account_number = attributes[:'account_number'] end if attributes.key?(:'amount') self.amount = attributes[:'amount'] end if attributes.key?(:'dc_sign') self.dc_sign = attributes[:'dc_sign'] end if attributes.key?(:'effective_date') self.effective_date = attributes[:'effective_date'] 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 invalid_properties = Array.new if @account_number.nil? invalid_properties.push('invalid value for "account_number", account_number cannot be nil.') end if @amount.nil? invalid_properties.push('invalid value for "amount", amount cannot be nil.') end if @dc_sign.nil? invalid_properties.push('invalid value for "dc_sign", dc_sign cannot be nil.') end if @effective_date.nil? invalid_properties.push('invalid value for "effective_date", effective_date cannot be nil.') end invalid_properties end # 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 @account_number.nil? return false if @amount.nil? return false if @dc_sign.nil? dc_sign_validator = EnumAttributeValidator.new('String', ["debit", "credit"]) return false unless dc_sign_validator.valid?(@dc_sign) return false if @effective_date.nil? true end # Custom attribute writer method checking allowed values (enum). # @param [Object] dc_sign Object to be assigned def dc_sign=(dc_sign) validator = EnumAttributeValidator.new('String', ["debit", "credit"]) unless validator.valid?(dc_sign) fail ArgumentError, "invalid value for \"dc_sign\", must be one of #{validator.allowable_values}." end @dc_sign = dc_sign 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 && account_number == o.account_number && amount == o.amount && dc_sign == o.dc_sign && effective_date == o.effective_date end # @see the `==` method # @param [Object] Object to be compared def eql?(o) self == o end # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash [account_number, amount, dc_sign, effective_date].hash end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def self.build_from_hash(attributes) new.build_from_hash(attributes) end # Builds the object from hash # @param [Hash] attributes Model attributes in the form of hash # @return [Object] Returns the model itself def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end # Deserializes the data based on type # @param string type Data type # @param string value Value to be deserialized # @return [Object] Deserialized data def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?