Class: YNAB::MoneyMovement
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- YNAB::MoneyMovement
- Defined in:
- lib/ynab/models/money_movement.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
The amount of the money movement in milliunits format.
-
#amount_currency ⇒ Object
The money movement amount as a decimal currency amount.
-
#amount_formatted ⇒ Object
The money movement amount formatted in the plan’s currency format.
-
#from_category_id ⇒ Object
The id of the category the money was moved from.
-
#id ⇒ Object
Returns the value of attribute id.
-
#money_movement_group_id ⇒ Object
The id of the money movement group this movement belongs to.
-
#month ⇒ Object
The month of the money movement in ISO format (e.g. 2024-01-01).
-
#moved_at ⇒ Object
The date/time the money movement was processed on the server in ISO format (e.g. 2024-01-01T12:00:00Z).
-
#note ⇒ Object
Returns the value of attribute note.
-
#performed_by_user_id ⇒ Object
The id of the user who performed the money movement.
-
#to_category_id ⇒ Object
The id of the category the money was moved to.
Class Method Summary collapse
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3).
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ MoneyMovement
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ MoneyMovement
Initializes the object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/ynab/models/money_movement.rb', line 100 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `YNAB::MoneyMovement` 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 `YNAB::MoneyMovement`. 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?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'month') self.month = attributes[:'month'] end if attributes.key?(:'moved_at') self.moved_at = attributes[:'moved_at'] end if attributes.key?(:'note') self.note = attributes[:'note'] end if attributes.key?(:'money_movement_group_id') self.money_movement_group_id = attributes[:'money_movement_group_id'] end if attributes.key?(:'performed_by_user_id') self.performed_by_user_id = attributes[:'performed_by_user_id'] end if attributes.key?(:'from_category_id') self.from_category_id = attributes[:'from_category_id'] end if attributes.key?(:'to_category_id') self.to_category_id = attributes[:'to_category_id'] end if attributes.key?(:'amount') self.amount = attributes[:'amount'] end if attributes.key?(:'amount_formatted') self.amount_formatted = attributes[:'amount_formatted'] end if attributes.key?(:'amount_currency') self.amount_currency = attributes[:'amount_currency'] end end |
Instance Attribute Details
#amount ⇒ Object
The amount of the money movement in milliunits format
38 39 40 |
# File 'lib/ynab/models/money_movement.rb', line 38 def amount @amount end |
#amount_currency ⇒ Object
The money movement amount as a decimal currency amount
44 45 46 |
# File 'lib/ynab/models/money_movement.rb', line 44 def amount_currency @amount_currency end |
#amount_formatted ⇒ Object
The money movement amount formatted in the plan’s currency format
41 42 43 |
# File 'lib/ynab/models/money_movement.rb', line 41 def amount_formatted @amount_formatted end |
#from_category_id ⇒ Object
The id of the category the money was moved from
32 33 34 |
# File 'lib/ynab/models/money_movement.rb', line 32 def from_category_id @from_category_id end |
#id ⇒ Object
Returns the value of attribute id.
15 16 17 |
# File 'lib/ynab/models/money_movement.rb', line 15 def id @id end |
#money_movement_group_id ⇒ Object
The id of the money movement group this movement belongs to
26 27 28 |
# File 'lib/ynab/models/money_movement.rb', line 26 def money_movement_group_id @money_movement_group_id end |
#month ⇒ Object
The month of the money movement in ISO format (e.g. 2024-01-01)
18 19 20 |
# File 'lib/ynab/models/money_movement.rb', line 18 def month @month end |
#moved_at ⇒ Object
The date/time the money movement was processed on the server in ISO format (e.g. 2024-01-01T12:00:00Z)
21 22 23 |
# File 'lib/ynab/models/money_movement.rb', line 21 def moved_at @moved_at end |
#note ⇒ Object
Returns the value of attribute note.
23 24 25 |
# File 'lib/ynab/models/money_movement.rb', line 23 def note @note end |
#performed_by_user_id ⇒ Object
The id of the user who performed the money movement
29 30 31 |
# File 'lib/ynab/models/money_movement.rb', line 29 def performed_by_user_id @performed_by_user_id end |
#to_category_id ⇒ Object
The id of the category the money was moved to
35 36 37 |
# File 'lib/ynab/models/money_movement.rb', line 35 def to_category_id @to_category_id end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
64 65 66 |
# File 'lib/ynab/models/money_movement.rb', line 64 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/ynab/models/money_movement.rb', line 47 def self.attribute_map { :'id' => :'id', :'month' => :'month', :'moved_at' => :'moved_at', :'note' => :'note', :'money_movement_group_id' => :'money_movement_group_id', :'performed_by_user_id' => :'performed_by_user_id', :'from_category_id' => :'from_category_id', :'to_category_id' => :'to_category_id', :'amount' => :'amount', :'amount_formatted' => :'amount_formatted', :'amount_currency' => :'amount_currency' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/ynab/models/money_movement.rb', line 206 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_all_of ⇒ Object
List of class defined in allOf (OpenAPI v3)
92 93 94 95 96 |
# File 'lib/ynab/models/money_movement.rb', line 92 def self.openapi_all_of [ :'MoneyMovementBase' ] end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
86 87 88 89 |
# File 'lib/ynab/models/money_movement.rb', line 86 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/ynab/models/money_movement.rb', line 69 def self.openapi_types { :'id' => :'String', :'month' => :'Date', :'moved_at' => :'Time', :'note' => :'String', :'money_movement_group_id' => :'String', :'performed_by_user_id' => :'String', :'from_category_id' => :'String', :'to_category_id' => :'String', :'amount' => :'Integer', :'amount_formatted' => :'String', :'amount_currency' => :'Float' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/ynab/models/money_movement.rb', line 175 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && month == o.month && moved_at == o.moved_at && note == o.note && money_movement_group_id == o.money_movement_group_id && performed_by_user_id == o.performed_by_user_id && from_category_id == o.from_category_id && to_category_id == o.to_category_id && amount == o.amount && amount_formatted == o.amount_formatted && amount_currency == o.amount_currency end |
#eql?(o) ⇒ Boolean
193 194 195 |
# File 'lib/ynab/models/money_movement.rb', line 193 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
199 200 201 |
# File 'lib/ynab/models/money_movement.rb', line 199 def hash [id, month, moved_at, note, money_movement_group_id, performed_by_user_id, from_category_id, to_category_id, amount, amount_formatted, amount_currency].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
160 161 162 163 |
# File 'lib/ynab/models/money_movement.rb', line 160 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/ynab/models/money_movement.rb', line 228 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 |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
167 168 169 170 171 |
# File 'lib/ynab/models/money_movement.rb', line 167 def valid? return false if @id.nil? return false if @amount.nil? true end |