class FireflyIIIClient::TransactionSplit
Attributes
Amount of the transaction.
Optional. Use either this or the bill_name
Optional. Use either this or the bill_id
The budget ID for this transaction.
The name of the budget to be used. If the budget name is unknown, the ID will be used or the value will be ignored.
Internal ID of bunq transaction.
The category ID for this transaction.
The name of the category to be used. If the category is unknown, it will be created. If the ID and the name point to different categories, the ID overrules the name.
Currency
code. Default is the source account's currency, or the user's default currency. Can be used instead of currency_id.
Number of decimals used in this currency.
Currency
ID. Default is the source account's currency, or the user's default currency. Can be used instead of currency_code.
Date of the transaction
Description of the transaction. Will only be used if more than one split is submitted.
ID of the destination account. For a deposit or a transfer, this must always be an asset account. For withdrawals this must be an expense account.
Name of the destination account. You can submit the name instead of the ID. For everything except transfers, the account will be auto-generated if unknown, so submitting a name is enough.
Reference to external ID in other systems.
The amount in a foreign currency.
Currency
code. Default is NULL. Can be used instead of the foreign_currency_id
, but either is required when submitting a foreign amount.
Number of decimals in the currency
Currency
ID. Default is null. Is required when you submit a foreign amount.
Hash value of original import transaction (for duplicate detection).
Reference to internal reference of other systems.
Order of this entry in the list of transactions.
System generated identifier for original creator of transaction.
Optional. Use either this or the piggy_bank_name
Optional. Use either this or the piggy_bank_id
If the transaction has been reconciled already. When you set this, the amount can no longer be edited by the user.
Reference to recurrence that made the transaction.
SEPA Batch ID
SEPA Clearing Code
SEPA Creditor Identifier
SEPA Country
SEPA end-to-end Identifier
SEPA Opposing Account
Identifier
SEPA mandate identifier
SEPA External Purpose indicator
ID of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account.
Name of the source account. For a withdrawal or a transfer, this must always be an asset account. For deposits, this must be a revenue account. Can be used instead of the source_id. If the transaction is a deposit, the source_name
can be filled in freely: the account will be created based on the name.
ID of the underlying transaction journal. Each transaction consists of a transaction group (see the top ID) and one or more journals making up the splits of the transaction.
Type of transaction. expense cannot be written.
User
ID
Public Class Methods
Returns all the JSON keys this model knows about
# File lib/firefly_iii_client/models/transaction_split.rb, line 257 def self.acceptable_attributes attribute_map.values end
Attribute mapping from ruby-style variable name to JSON key.
# File lib/firefly_iii_client/models/transaction_split.rb, line 195 def self.attribute_map { :'user' => :'user', :'transaction_journal_id' => :'transaction_journal_id', :'type' => :'type', :'date' => :'date', :'amount' => :'amount', :'description' => :'description', :'order' => :'order', :'currency_id' => :'currency_id', :'currency_code' => :'currency_code', :'currency_symbol' => :'currency_symbol', :'currency_name' => :'currency_name', :'currency_decimal_places' => :'currency_decimal_places', :'foreign_amount' => :'foreign_amount', :'foreign_currency_id' => :'foreign_currency_id', :'foreign_currency_code' => :'foreign_currency_code', :'foreign_currency_symbol' => :'foreign_currency_symbol', :'foreign_currency_decimal_places' => :'foreign_currency_decimal_places', :'budget_id' => :'budget_id', :'budget_name' => :'budget_name', :'category_id' => :'category_id', :'category_name' => :'category_name', :'source_id' => :'source_id', :'source_name' => :'source_name', :'source_iban' => :'source_iban', :'source_type' => :'source_type', :'destination_id' => :'destination_id', :'destination_name' => :'destination_name', :'destination_iban' => :'destination_iban', :'destination_type' => :'destination_type', :'reconciled' => :'reconciled', :'piggy_bank_id' => :'piggy_bank_id', :'piggy_bank_name' => :'piggy_bank_name', :'bill_id' => :'bill_id', :'bill_name' => :'bill_name', :'tags' => :'tags', :'notes' => :'notes', :'internal_reference' => :'internal_reference', :'external_id' => :'external_id', :'original_source' => :'original_source', :'recurrence_id' => :'recurrence_id', :'bunq_payment_id' => :'bunq_payment_id', :'import_hash_v2' => :'import_hash_v2', :'sepa_cc' => :'sepa_cc', :'sepa_ct_op' => :'sepa_ct_op', :'sepa_ct_id' => :'sepa_ct_id', :'sepa_db' => :'sepa_db', :'sepa_country' => :'sepa_country', :'sepa_ep' => :'sepa_ep', :'sepa_ci' => :'sepa_ci', :'sepa_batch_id' => :'sepa_batch_id', :'interest_date' => :'interest_date', :'book_date' => :'book_date', :'process_date' => :'process_date', :'due_date' => :'due_date', :'payment_date' => :'payment_date', :'invoice_date' => :'invoice_date' } end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/firefly_iii_client/models/transaction_split.rb, line 733 def self.build_from_hash(attributes) new.build_from_hash(attributes) end
Initializes the object @param [Hash] attributes Model attributes in the form of hash
# File lib/firefly_iii_client/models/transaction_split.rb, line 375 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `FireflyIIIClient::TransactionSplit` 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 `FireflyIIIClient::TransactionSplit`. 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?(:'user') self.user = attributes[:'user'] end if attributes.key?(:'transaction_journal_id') self.transaction_journal_id = attributes[:'transaction_journal_id'] end if attributes.key?(:'type') self.type = attributes[:'type'] end if attributes.key?(:'date') self.date = attributes[:'date'] end if attributes.key?(:'amount') self.amount = attributes[:'amount'] end if attributes.key?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'order') self.order = attributes[:'order'] end if attributes.key?(:'currency_id') self.currency_id = attributes[:'currency_id'] end if attributes.key?(:'currency_code') self.currency_code = attributes[:'currency_code'] end if attributes.key?(:'currency_symbol') self.currency_symbol = attributes[:'currency_symbol'] end if attributes.key?(:'currency_name') self.currency_name = attributes[:'currency_name'] end if attributes.key?(:'currency_decimal_places') self.currency_decimal_places = attributes[:'currency_decimal_places'] end if attributes.key?(:'foreign_amount') self.foreign_amount = attributes[:'foreign_amount'] end if attributes.key?(:'foreign_currency_id') self.foreign_currency_id = attributes[:'foreign_currency_id'] end if attributes.key?(:'foreign_currency_code') self.foreign_currency_code = attributes[:'foreign_currency_code'] end if attributes.key?(:'foreign_currency_symbol') self.foreign_currency_symbol = attributes[:'foreign_currency_symbol'] end if attributes.key?(:'foreign_currency_decimal_places') self.foreign_currency_decimal_places = attributes[:'foreign_currency_decimal_places'] end if attributes.key?(:'budget_id') self.budget_id = attributes[:'budget_id'] end if attributes.key?(:'budget_name') self.budget_name = attributes[:'budget_name'] end if attributes.key?(:'category_id') self.category_id = attributes[:'category_id'] end if attributes.key?(:'category_name') self.category_name = attributes[:'category_name'] end if attributes.key?(:'source_id') self.source_id = attributes[:'source_id'] end if attributes.key?(:'source_name') self.source_name = attributes[:'source_name'] end if attributes.key?(:'source_iban') self.source_iban = attributes[:'source_iban'] end if attributes.key?(:'source_type') self.source_type = attributes[:'source_type'] end if attributes.key?(:'destination_id') self.destination_id = attributes[:'destination_id'] end if attributes.key?(:'destination_name') self.destination_name = attributes[:'destination_name'] end if attributes.key?(:'destination_iban') self.destination_iban = attributes[:'destination_iban'] end if attributes.key?(:'destination_type') self.destination_type = attributes[:'destination_type'] end if attributes.key?(:'reconciled') self.reconciled = attributes[:'reconciled'] end if attributes.key?(:'piggy_bank_id') self.piggy_bank_id = attributes[:'piggy_bank_id'] end if attributes.key?(:'piggy_bank_name') self.piggy_bank_name = attributes[:'piggy_bank_name'] end if attributes.key?(:'bill_id') self.bill_id = attributes[:'bill_id'] end if attributes.key?(:'bill_name') self.bill_name = attributes[:'bill_name'] end if attributes.key?(:'tags') if (value = attributes[:'tags']).is_a?(Array) self.tags = value end end if attributes.key?(:'notes') self.notes = attributes[:'notes'] end if attributes.key?(:'internal_reference') self.internal_reference = attributes[:'internal_reference'] end if attributes.key?(:'external_id') self.external_id = attributes[:'external_id'] end if attributes.key?(:'original_source') self.original_source = attributes[:'original_source'] end if attributes.key?(:'recurrence_id') self.recurrence_id = attributes[:'recurrence_id'] end if attributes.key?(:'bunq_payment_id') self.bunq_payment_id = attributes[:'bunq_payment_id'] end if attributes.key?(:'import_hash_v2') self.import_hash_v2 = attributes[:'import_hash_v2'] end if attributes.key?(:'sepa_cc') self.sepa_cc = attributes[:'sepa_cc'] end if attributes.key?(:'sepa_ct_op') self.sepa_ct_op = attributes[:'sepa_ct_op'] end if attributes.key?(:'sepa_ct_id') self.sepa_ct_id = attributes[:'sepa_ct_id'] end if attributes.key?(:'sepa_db') self.sepa_db = attributes[:'sepa_db'] end if attributes.key?(:'sepa_country') self.sepa_country = attributes[:'sepa_country'] end if attributes.key?(:'sepa_ep') self.sepa_ep = attributes[:'sepa_ep'] end if attributes.key?(:'sepa_ci') self.sepa_ci = attributes[:'sepa_ci'] end if attributes.key?(:'sepa_batch_id') self.sepa_batch_id = attributes[:'sepa_batch_id'] end if attributes.key?(:'interest_date') self.interest_date = attributes[:'interest_date'] end if attributes.key?(:'book_date') self.book_date = attributes[:'book_date'] end if attributes.key?(:'process_date') self.process_date = attributes[:'process_date'] end if attributes.key?(:'due_date') self.due_date = attributes[:'due_date'] end if attributes.key?(:'payment_date') self.payment_date = attributes[:'payment_date'] end if attributes.key?(:'invoice_date') self.invoice_date = attributes[:'invoice_date'] end end
List of attributes with nullable: true
# File lib/firefly_iii_client/models/transaction_split.rb, line 324 def self.openapi_nullable Set.new([ :'order', :'currency_id', :'currency_code', :'foreign_amount', :'foreign_currency_id', :'foreign_currency_code', :'foreign_currency_symbol', :'foreign_currency_decimal_places', :'budget_id', :'budget_name', :'category_id', :'category_name', :'source_id', :'source_name', :'source_iban', :'destination_id', :'destination_name', :'destination_iban', :'reconciled', :'piggy_bank_id', :'piggy_bank_name', :'bill_id', :'bill_name', :'tags', :'notes', :'internal_reference', :'external_id', :'original_source', :'recurrence_id', :'bunq_payment_id', :'import_hash_v2', :'sepa_cc', :'sepa_ct_id', :'sepa_db', :'sepa_country', :'sepa_ep', :'sepa_ci', :'sepa_batch_id', :'interest_date', :'book_date', :'process_date', :'due_date', :'payment_date', :'invoice_date' ]) end
Attribute type mapping.
# File lib/firefly_iii_client/models/transaction_split.rb, line 262 def self.openapi_types { :'user' => :'Integer', :'transaction_journal_id' => :'Integer', :'type' => :'String', :'date' => :'Date', :'amount' => :'Float', :'description' => :'String', :'order' => :'Integer', :'currency_id' => :'Integer', :'currency_code' => :'String', :'currency_symbol' => :'String', :'currency_name' => :'String', :'currency_decimal_places' => :'Integer', :'foreign_amount' => :'Float', :'foreign_currency_id' => :'Integer', :'foreign_currency_code' => :'String', :'foreign_currency_symbol' => :'String', :'foreign_currency_decimal_places' => :'Integer', :'budget_id' => :'Integer', :'budget_name' => :'String', :'category_id' => :'Integer', :'category_name' => :'String', :'source_id' => :'Integer', :'source_name' => :'String', :'source_iban' => :'String', :'source_type' => :'AccountTypeProperty', :'destination_id' => :'Integer', :'destination_name' => :'String', :'destination_iban' => :'String', :'destination_type' => :'AccountTypeProperty', :'reconciled' => :'Boolean', :'piggy_bank_id' => :'Integer', :'piggy_bank_name' => :'String', :'bill_id' => :'Integer', :'bill_name' => :'String', :'tags' => :'Array<String>', :'notes' => :'String', :'internal_reference' => :'String', :'external_id' => :'String', :'original_source' => :'String', :'recurrence_id' => :'Integer', :'bunq_payment_id' => :'String', :'import_hash_v2' => :'String', :'sepa_cc' => :'String', :'sepa_ct_op' => :'String', :'sepa_ct_id' => :'String', :'sepa_db' => :'String', :'sepa_country' => :'String', :'sepa_ep' => :'String', :'sepa_ci' => :'String', :'sepa_batch_id' => :'String', :'interest_date' => :'Date', :'book_date' => :'Date', :'process_date' => :'Date', :'due_date' => :'Date', :'payment_date' => :'Date', :'invoice_date' => :'Date' } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] Object to be compared
# File lib/firefly_iii_client/models/transaction_split.rb, line 657 def ==(o) return true if self.equal?(o) self.class == o.class && user == o.user && transaction_journal_id == o.transaction_journal_id && type == o.type && date == o.date && amount == o.amount && description == o.description && order == o.order && currency_id == o.currency_id && currency_code == o.currency_code && currency_symbol == o.currency_symbol && currency_name == o.currency_name && currency_decimal_places == o.currency_decimal_places && foreign_amount == o.foreign_amount && foreign_currency_id == o.foreign_currency_id && foreign_currency_code == o.foreign_currency_code && foreign_currency_symbol == o.foreign_currency_symbol && foreign_currency_decimal_places == o.foreign_currency_decimal_places && budget_id == o.budget_id && budget_name == o.budget_name && category_id == o.category_id && category_name == o.category_name && source_id == o.source_id && source_name == o.source_name && source_iban == o.source_iban && source_type == o.source_type && destination_id == o.destination_id && destination_name == o.destination_name && destination_iban == o.destination_iban && destination_type == o.destination_type && reconciled == o.reconciled && piggy_bank_id == o.piggy_bank_id && piggy_bank_name == o.piggy_bank_name && bill_id == o.bill_id && bill_name == o.bill_name && tags == o.tags && notes == o.notes && internal_reference == o.internal_reference && external_id == o.external_id && original_source == o.original_source && recurrence_id == o.recurrence_id && bunq_payment_id == o.bunq_payment_id && import_hash_v2 == o.import_hash_v2 && sepa_cc == o.sepa_cc && sepa_ct_op == o.sepa_ct_op && sepa_ct_id == o.sepa_ct_id && sepa_db == o.sepa_db && sepa_country == o.sepa_country && sepa_ep == o.sepa_ep && sepa_ci == o.sepa_ci && sepa_batch_id == o.sepa_batch_id && interest_date == o.interest_date && book_date == o.book_date && process_date == o.process_date && due_date == o.due_date && payment_date == o.payment_date && invoice_date == o.invoice_date end
Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data
# File lib/firefly_iii_client/models/transaction_split.rb, line 763 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<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\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 # models (e.g. Pet) or oneOf klass = FireflyIIIClient.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end 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
# File lib/firefly_iii_client/models/transaction_split.rb, line 834 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
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/firefly_iii_client/models/transaction_split.rb, line 740 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) 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
@see the `==` method @param [Object] Object to be compared
# File lib/firefly_iii_client/models/transaction_split.rb, line 720 def eql?(o) self == o end
Calculates hash code according to all attributes. @return [Integer] Hash code
# File lib/firefly_iii_client/models/transaction_split.rb, line 726 def hash [user, transaction_journal_id, type, date, amount, description, order, currency_id, currency_code, currency_symbol, currency_name, currency_decimal_places, foreign_amount, foreign_currency_id, foreign_currency_code, foreign_currency_symbol, foreign_currency_decimal_places, budget_id, budget_name, category_id, category_name, source_id, source_name, source_iban, source_type, destination_id, destination_name, destination_iban, destination_type, reconciled, piggy_bank_id, piggy_bank_name, bill_id, bill_name, tags, notes, internal_reference, external_id, original_source, recurrence_id, bunq_payment_id, import_hash_v2, sepa_cc, sepa_ct_op, sepa_ct_id, sepa_db, sepa_country, sepa_ep, sepa_ci, sepa_batch_id, interest_date, book_date, process_date, due_date, payment_date, invoice_date].hash end
Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properties with the reasons
# File lib/firefly_iii_client/models/transaction_split.rb, line 617 def list_invalid_properties invalid_properties = Array.new if @date.nil? invalid_properties.push('invalid value for "date", date cannot be nil.') end if @amount.nil? invalid_properties.push('invalid value for "amount", amount cannot be nil.') end if @description.nil? invalid_properties.push('invalid value for "description", description cannot be nil.') end invalid_properties end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/firefly_iii_client/models/transaction_split.rb, line 816 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end
Returns the string representation of the object @return [String] String presentation of the object
# File lib/firefly_iii_client/models/transaction_split.rb, line 804 def to_s to_hash.to_s end
Custom attribute writer method checking allowed values (enum). @param [Object] type Object to be assigned
# File lib/firefly_iii_client/models/transaction_split.rb, line 647 def type=(type) validator = EnumAttributeValidator.new('String', ["withdrawal", "expense", "deposit", "transfer", "opening-balance", "reconciliation"]) unless validator.valid?(type) fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}." end @type = type end
Check to see if the all the properties in the model are valid @return true if the model is valid
# File lib/firefly_iii_client/models/transaction_split.rb, line 636 def valid? type_validator = EnumAttributeValidator.new('String', ["withdrawal", "expense", "deposit", "transfer", "opening-balance", "reconciliation"]) return false unless type_validator.valid?(@type) return false if @date.nil? return false if @amount.nil? return false if @description.nil? true end