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.
-
#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_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
90 91 92 93 94 95 96 97 98 99 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 |
# File 'lib/ynab/models/money_movement.rb', line 90 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 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 |
#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
56 57 58 |
# File 'lib/ynab/models/money_movement.rb', line 56 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/ynab/models/money_movement.rb', line 41 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' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/ynab/models/money_movement.rb', line 186 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_nullable ⇒ Object
List of attributes with nullable: true
76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/ynab/models/money_movement.rb', line 76 def self.openapi_nullable Set.new([ :'month', :'moved_at', :'note', :'money_movement_group_id', :'performed_by_user_id', :'from_category_id', :'to_category_id', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ynab/models/money_movement.rb', line 61 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' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/ynab/models/money_movement.rb', line 157 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 end |
#eql?(o) ⇒ Boolean
173 174 175 |
# File 'lib/ynab/models/money_movement.rb', line 173 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
179 180 181 |
# File 'lib/ynab/models/money_movement.rb', line 179 def hash [id, month, moved_at, note, money_movement_group_id, performed_by_user_id, from_category_id, to_category_id, amount].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
142 143 144 145 |
# File 'lib/ynab/models/money_movement.rb', line 142 def list_invalid_properties invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/ynab/models/money_movement.rb', line 208 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
149 150 151 152 153 |
# File 'lib/ynab/models/money_movement.rb', line 149 def valid? return false if @id.nil? return false if @amount.nil? true end |