=begin #Hydrogen Nucleus API #The Hydrogen Nucleus API OpenAPI spec version: 1.9.5 Contact: info@hydrogenplatform.com Generated by: https://github.com/swagger-api/swagger-codegen.git Swagger Codegen version: 2.4.19 =end require 'date' module NucleusApi # Aggregation Account Object class AggregationAccount # accountCategoryId attr_accessor :account_category_id # accountHolder attr_accessor :account_holder # accountName attr_accessor :account_name attr_accessor :account_number # apr attr_accessor :apr # apy attr_accessor :apy # bankLinkId attr_accessor :bank_link_id # businessId attr_accessor :business_id # category attr_accessor :category # clientId attr_accessor :client_id attr_accessor :create_date # creditLimit attr_accessor :credit_limit # currencyCode attr_accessor :currency_code # deathBenefit attr_accessor :death_benefit # financialOfferId attr_accessor :financial_offer_id attr_accessor :id # institutionId attr_accessor :institution_id # institutionName attr_accessor :institution_name # interestRate attr_accessor :interest_rate # isActive attr_accessor :is_active attr_accessor :is_asset attr_accessor :is_business attr_accessor :is_cash attr_accessor :is_investment # isLinkVerified attr_accessor :is_link_verified # isManual attr_accessor :is_manual # lastPayment attr_accessor :last_payment # lastPaymentDate attr_accessor :last_payment_date # mask attr_accessor :mask # maturityDate attr_accessor :maturity_date attr_accessor :metadata # minimumPayment attr_accessor :minimum_payment # nextPaymentDate attr_accessor :next_payment_date attr_accessor :secondary_id # subcategory attr_accessor :subcategory attr_accessor :update_date # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'account_category_id' => :'account_category_id', :'account_holder' => :'account_holder', :'account_name' => :'account_name', :'account_number' => :'account_number', :'apr' => :'apr', :'apy' => :'apy', :'bank_link_id' => :'bank_link_id', :'business_id' => :'business_id', :'category' => :'category', :'client_id' => :'client_id', :'create_date' => :'create_date', :'credit_limit' => :'credit_limit', :'currency_code' => :'currency_code', :'death_benefit' => :'death_benefit', :'financial_offer_id' => :'financial_offer_id', :'id' => :'id', :'institution_id' => :'institution_id', :'institution_name' => :'institution_name', :'interest_rate' => :'interest_rate', :'is_active' => :'is_active', :'is_asset' => :'is_asset', :'is_business' => :'is_business', :'is_cash' => :'is_cash', :'is_investment' => :'is_investment', :'is_link_verified' => :'is_link_verified', :'is_manual' => :'is_manual', :'last_payment' => :'last_payment', :'last_payment_date' => :'last_payment_date', :'mask' => :'mask', :'maturity_date' => :'maturity_date', :'metadata' => :'metadata', :'minimum_payment' => :'minimum_payment', :'next_payment_date' => :'next_payment_date', :'secondary_id' => :'secondary_id', :'subcategory' => :'subcategory', :'update_date' => :'update_date' } end # Attribute type mapping. def self.swagger_types { :'account_category_id' => :'String', :'account_holder' => :'String', :'account_name' => :'String', :'account_number' => :'String', :'apr' => :'Float', :'apy' => :'Float', :'bank_link_id' => :'String', :'business_id' => :'String', :'category' => :'String', :'client_id' => :'String', :'create_date' => :'DateTime', :'credit_limit' => :'Float', :'currency_code' => :'String', :'death_benefit' => :'Float', :'financial_offer_id' => :'String', :'id' => :'String', :'institution_id' => :'String', :'institution_name' => :'String', :'interest_rate' => :'Float', :'is_active' => :'BOOLEAN', :'is_asset' => :'BOOLEAN', :'is_business' => :'BOOLEAN', :'is_cash' => :'BOOLEAN', :'is_investment' => :'BOOLEAN', :'is_link_verified' => :'BOOLEAN', :'is_manual' => :'BOOLEAN', :'last_payment' => :'Float', :'last_payment_date' => :'DateTime', :'mask' => :'String', :'maturity_date' => :'DateTime', :'metadata' => :'Hash', :'minimum_payment' => :'Float', :'next_payment_date' => :'DateTime', :'secondary_id' => :'String', :'subcategory' => :'String', :'update_date' => :'DateTime' } end # Initializes the object # @param [Hash] attributes Model attributes in the form of hash def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'account_category_id') self.account_category_id = attributes[:'account_category_id'] end if attributes.has_key?(:'account_holder') self.account_holder = attributes[:'account_holder'] end if attributes.has_key?(:'account_name') self.account_name = attributes[:'account_name'] end if attributes.has_key?(:'account_number') self.account_number = attributes[:'account_number'] end if attributes.has_key?(:'apr') self.apr = attributes[:'apr'] end if attributes.has_key?(:'apy') self.apy = attributes[:'apy'] end if attributes.has_key?(:'bank_link_id') self.bank_link_id = attributes[:'bank_link_id'] end if attributes.has_key?(:'business_id') self.business_id = attributes[:'business_id'] end if attributes.has_key?(:'category') self.category = attributes[:'category'] end if attributes.has_key?(:'client_id') self.client_id = attributes[:'client_id'] end if attributes.has_key?(:'create_date') self.create_date = attributes[:'create_date'] end if attributes.has_key?(:'credit_limit') self.credit_limit = attributes[:'credit_limit'] end if attributes.has_key?(:'currency_code') self.currency_code = attributes[:'currency_code'] end if attributes.has_key?(:'death_benefit') self.death_benefit = attributes[:'death_benefit'] end if attributes.has_key?(:'financial_offer_id') self.financial_offer_id = attributes[:'financial_offer_id'] end if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'institution_id') self.institution_id = attributes[:'institution_id'] end if attributes.has_key?(:'institution_name') self.institution_name = attributes[:'institution_name'] end if attributes.has_key?(:'interest_rate') self.interest_rate = attributes[:'interest_rate'] end if attributes.has_key?(:'is_active') self.is_active = attributes[:'is_active'] end if attributes.has_key?(:'is_asset') self.is_asset = attributes[:'is_asset'] end if attributes.has_key?(:'is_business') self.is_business = attributes[:'is_business'] end if attributes.has_key?(:'is_cash') self.is_cash = attributes[:'is_cash'] end if attributes.has_key?(:'is_investment') self.is_investment = attributes[:'is_investment'] end if attributes.has_key?(:'is_link_verified') self.is_link_verified = attributes[:'is_link_verified'] end if attributes.has_key?(:'is_manual') self.is_manual = attributes[:'is_manual'] end if attributes.has_key?(:'last_payment') self.last_payment = attributes[:'last_payment'] end if attributes.has_key?(:'last_payment_date') self.last_payment_date = attributes[:'last_payment_date'] end if attributes.has_key?(:'mask') self.mask = attributes[:'mask'] end if attributes.has_key?(:'maturity_date') self.maturity_date = attributes[:'maturity_date'] end if attributes.has_key?(:'metadata') if (value = attributes[:'metadata']).is_a?(Hash) self.metadata = value end end if attributes.has_key?(:'minimum_payment') self.minimum_payment = attributes[:'minimum_payment'] end if attributes.has_key?(:'next_payment_date') self.next_payment_date = attributes[:'next_payment_date'] end if attributes.has_key?(:'secondary_id') self.secondary_id = attributes[:'secondary_id'] end if attributes.has_key?(:'subcategory') self.subcategory = attributes[:'subcategory'] end if attributes.has_key?(:'update_date') self.update_date = attributes[:'update_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_name.nil? invalid_properties.push('invalid value for "account_name", account_name cannot be nil.') end if @institution_name.nil? invalid_properties.push('invalid value for "institution_name", institution_name 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_name.nil? return false if @category.nil? return false if @institution_name.nil? true 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_category_id == o.account_category_id && account_holder == o.account_holder && account_name == o.account_name && account_number == o.account_number && apr == o.apr && apy == o.apy && bank_link_id == o.bank_link_id && business_id == o.business_id && category == o.category && client_id == o.client_id && create_date == o.create_date && credit_limit == o.credit_limit && currency_code == o.currency_code && death_benefit == o.death_benefit && financial_offer_id == o.financial_offer_id && id == o.id && institution_id == o.institution_id && institution_name == o.institution_name && interest_rate == o.interest_rate && is_active == o.is_active && is_asset == o.is_asset && is_business == o.is_business && is_cash == o.is_cash && is_investment == o.is_investment && is_link_verified == o.is_link_verified && is_manual == o.is_manual && last_payment == o.last_payment && last_payment_date == o.last_payment_date && mask == o.mask && maturity_date == o.maturity_date && metadata == o.metadata && minimum_payment == o.minimum_payment && next_payment_date == o.next_payment_date && secondary_id == o.secondary_id && subcategory == o.subcategory && update_date == o.update_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 [Fixnum] Hash code def hash [account_category_id, account_holder, account_name, account_number, apr, apy, bank_link_id, business_id, category, client_id, create_date, credit_limit, currency_code, death_benefit, financial_offer_id, id, institution_id, institution_name, interest_rate, is_active, is_asset, is_business, is_cash, is_investment, is_link_verified, is_manual, last_payment, last_payment_date, mask, maturity_date, metadata, minimum_payment, next_payment_date, secondary_id, subcategory, update_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 build_from_hash(attributes) self.class.swagger_types.each_pair do |key, type| if 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 # or else data not found in attributes(hash), not an issue as the data can be optional 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 :DateTime (value) when :Date (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<(?.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?.+?), (?.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = NucleusApi.const_get(type).new temp_model.build_from_hash(value) end end # Returns the string representation of the object # @return [String] String presentation of the object def to_s to_hash.to_s end # to_body is an alias to to_hash (backward compatibility) # @return [Hash] Returns the object in the form of hash def to_body to_hash end # Returns the object in the form of hash # @return [Hash] Returns the object in the form of hash def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) hash[param] = _to_hash(value) end hash end # Outputs non-array value in the form of hash # For object, use to_hash. Otherwise, just return the value # @param [Object] value Any valid value # @return [Hash] Returns the value in the form of hash def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end end end