Class: ConnectWise::GLAccount
- Inherits:
-
Object
- Object
- ConnectWise::GLAccount
- Defined in:
- lib/connect_wise/models/gl_account.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#_info ⇒ Object
Returns the value of attribute _info.
-
#cogs1 ⇒ Object
Max length: 255;.
-
#cogs10 ⇒ Object
Max length: 255;.
-
#cogs2 ⇒ Object
Max length: 255;.
-
#cogs3 ⇒ Object
Max length: 255;.
-
#cogs4 ⇒ Object
Max length: 255;.
-
#cogs5 ⇒ Object
Max length: 255;.
-
#cogs6 ⇒ Object
Max length: 255;.
-
#cogs7 ⇒ Object
Max length: 255;.
-
#cogs8 ⇒ Object
Max length: 255;.
-
#cogs9 ⇒ Object
Max length: 255;.
-
#gl_type ⇒ Object
Returns the value of attribute gl_type.
-
#id ⇒ Object
Returns the value of attribute id.
-
#inventory ⇒ Object
Max length: 255;.
-
#mapped_record ⇒ Object
Returns the value of attribute mapped_record.
-
#mapped_type ⇒ Object
Returns the value of attribute mapped_type.
-
#product_id ⇒ Object
Max length: 255;.
-
#sales_code ⇒ Object
Max length: 255;.
-
#segment1 ⇒ Object
Max length: 255;.
-
#segment10 ⇒ Object
Max length: 255;.
-
#segment2 ⇒ Object
Max length: 255;.
-
#segment3 ⇒ Object
Max length: 255;.
-
#segment4 ⇒ Object
Max length: 255;.
-
#segment5 ⇒ Object
Max length: 255;.
-
#segment6 ⇒ Object
Max length: 255;.
-
#segment7 ⇒ Object
Max length: 255;.
-
#segment8 ⇒ Object
Max length: 255;.
-
#segment9 ⇒ Object
Max length: 255;.
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
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ GLAccount
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ GLAccount
Initializes the object
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'lib/connect_wise/models/gl_account.rb', line 190 def initialize(attributes = {}) raise ArgumentError, 'The input argument (attributes) must be a hash in `ConnectWise::GLAccount` initialize method' unless attributes.is_a?(Hash) # check to see if the attribute exists and convert string to symbol for hash key attributes = attributes.each_with_object({}) do |(k, v), h| raise ArgumentError, "`#{k}` is not a valid attribute in `ConnectWise::GLAccount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym) h[k.to_sym] = v end self.gl_type = attributes[:gl_type] if attributes.key?(:gl_type) self.mapped_type = attributes[:mapped_type] if attributes.key?(:mapped_type) self.mapped_record = attributes[:mapped_record] if attributes.key?(:mapped_record) self.id = attributes[:id] if attributes.key?(:id) self.segment1 = attributes[:segment1] if attributes.key?(:segment1) self.segment2 = attributes[:segment2] if attributes.key?(:segment2) self.segment3 = attributes[:segment3] if attributes.key?(:segment3) self.segment4 = attributes[:segment4] if attributes.key?(:segment4) self.segment5 = attributes[:segment5] if attributes.key?(:segment5) self.segment6 = attributes[:segment6] if attributes.key?(:segment6) self.segment7 = attributes[:segment7] if attributes.key?(:segment7) self.segment8 = attributes[:segment8] if attributes.key?(:segment8) self.segment9 = attributes[:segment9] if attributes.key?(:segment9) self.segment10 = attributes[:segment10] if attributes.key?(:segment10) self.cogs1 = attributes[:cogs1] if attributes.key?(:cogs1) self.cogs2 = attributes[:cogs2] if attributes.key?(:cogs2) self.cogs3 = attributes[:cogs3] if attributes.key?(:cogs3) self.cogs4 = attributes[:cogs4] if attributes.key?(:cogs4) self.cogs5 = attributes[:cogs5] if attributes.key?(:cogs5) self.cogs6 = attributes[:cogs6] if attributes.key?(:cogs6) self.cogs7 = attributes[:cogs7] if attributes.key?(:cogs7) self.cogs8 = attributes[:cogs8] if attributes.key?(:cogs8) self.cogs9 = attributes[:cogs9] if attributes.key?(:cogs9) self.cogs10 = attributes[:cogs10] if attributes.key?(:cogs10) self.product_id = attributes[:product_id] if attributes.key?(:product_id) self.inventory = attributes[:inventory] if attributes.key?(:inventory) self.sales_code = attributes[:sales_code] if attributes.key?(:sales_code) return unless attributes.key?(:_info) return unless (value = attributes[:_info]).is_a?(Hash) self._info = value end |
Instance Attribute Details
#_info ⇒ Object
Returns the value of attribute _info.
16 17 18 |
# File 'lib/connect_wise/models/gl_account.rb', line 16 def _info @_info end |
#cogs1 ⇒ Object
Max length: 255;
49 50 51 |
# File 'lib/connect_wise/models/gl_account.rb', line 49 def cogs1 @cogs1 end |
#cogs10 ⇒ Object
Max length: 255;
76 77 78 |
# File 'lib/connect_wise/models/gl_account.rb', line 76 def cogs10 @cogs10 end |
#cogs2 ⇒ Object
Max length: 255;
52 53 54 |
# File 'lib/connect_wise/models/gl_account.rb', line 52 def cogs2 @cogs2 end |
#cogs3 ⇒ Object
Max length: 255;
55 56 57 |
# File 'lib/connect_wise/models/gl_account.rb', line 55 def cogs3 @cogs3 end |
#cogs4 ⇒ Object
Max length: 255;
58 59 60 |
# File 'lib/connect_wise/models/gl_account.rb', line 58 def cogs4 @cogs4 end |
#cogs5 ⇒ Object
Max length: 255;
61 62 63 |
# File 'lib/connect_wise/models/gl_account.rb', line 61 def cogs5 @cogs5 end |
#cogs6 ⇒ Object
Max length: 255;
64 65 66 |
# File 'lib/connect_wise/models/gl_account.rb', line 64 def cogs6 @cogs6 end |
#cogs7 ⇒ Object
Max length: 255;
67 68 69 |
# File 'lib/connect_wise/models/gl_account.rb', line 67 def cogs7 @cogs7 end |
#cogs8 ⇒ Object
Max length: 255;
70 71 72 |
# File 'lib/connect_wise/models/gl_account.rb', line 70 def cogs8 @cogs8 end |
#cogs9 ⇒ Object
Max length: 255;
73 74 75 |
# File 'lib/connect_wise/models/gl_account.rb', line 73 def cogs9 @cogs9 end |
#gl_type ⇒ Object
Returns the value of attribute gl_type.
16 17 18 |
# File 'lib/connect_wise/models/gl_account.rb', line 16 def gl_type @gl_type end |
#id ⇒ Object
Returns the value of attribute id.
16 17 18 |
# File 'lib/connect_wise/models/gl_account.rb', line 16 def id @id end |
#inventory ⇒ Object
Max length: 255;
82 83 84 |
# File 'lib/connect_wise/models/gl_account.rb', line 82 def inventory @inventory end |
#mapped_record ⇒ Object
Returns the value of attribute mapped_record.
16 17 18 |
# File 'lib/connect_wise/models/gl_account.rb', line 16 def mapped_record @mapped_record end |
#mapped_type ⇒ Object
Returns the value of attribute mapped_type.
16 17 18 |
# File 'lib/connect_wise/models/gl_account.rb', line 16 def mapped_type @mapped_type end |
#product_id ⇒ Object
Max length: 255;
79 80 81 |
# File 'lib/connect_wise/models/gl_account.rb', line 79 def product_id @product_id end |
#sales_code ⇒ Object
Max length: 255;
85 86 87 |
# File 'lib/connect_wise/models/gl_account.rb', line 85 def sales_code @sales_code end |
#segment1 ⇒ Object
Max length: 255;
19 20 21 |
# File 'lib/connect_wise/models/gl_account.rb', line 19 def segment1 @segment1 end |
#segment10 ⇒ Object
Max length: 255;
46 47 48 |
# File 'lib/connect_wise/models/gl_account.rb', line 46 def segment10 @segment10 end |
#segment2 ⇒ Object
Max length: 255;
22 23 24 |
# File 'lib/connect_wise/models/gl_account.rb', line 22 def segment2 @segment2 end |
#segment3 ⇒ Object
Max length: 255;
25 26 27 |
# File 'lib/connect_wise/models/gl_account.rb', line 25 def segment3 @segment3 end |
#segment4 ⇒ Object
Max length: 255;
28 29 30 |
# File 'lib/connect_wise/models/gl_account.rb', line 28 def segment4 @segment4 end |
#segment5 ⇒ Object
Max length: 255;
31 32 33 |
# File 'lib/connect_wise/models/gl_account.rb', line 31 def segment5 @segment5 end |
#segment6 ⇒ Object
Max length: 255;
34 35 36 |
# File 'lib/connect_wise/models/gl_account.rb', line 34 def segment6 @segment6 end |
#segment7 ⇒ Object
Max length: 255;
37 38 39 |
# File 'lib/connect_wise/models/gl_account.rb', line 37 def segment7 @segment7 end |
#segment8 ⇒ Object
Max length: 255;
40 41 42 |
# File 'lib/connect_wise/models/gl_account.rb', line 40 def segment8 @segment8 end |
#segment9 ⇒ Object
Max length: 255;
43 44 45 |
# File 'lib/connect_wise/models/gl_account.rb', line 43 def segment9 @segment9 end |
Class Method Details
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
143 144 145 |
# File 'lib/connect_wise/models/gl_account.rb', line 143 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/connect_wise/models/gl_account.rb', line 109 def self.attribute_map { gl_type: :glType, mapped_type: :mappedType, mapped_record: :mappedRecord, id: :id, segment1: :segment1, segment2: :segment2, segment3: :segment3, segment4: :segment4, segment5: :segment5, segment6: :segment6, segment7: :segment7, segment8: :segment8, segment9: :segment9, segment10: :segment10, cogs1: :cogs1, cogs2: :cogs2, cogs3: :cogs3, cogs4: :cogs4, cogs5: :cogs5, cogs6: :cogs6, cogs7: :cogs7, cogs8: :cogs8, cogs9: :cogs9, cogs10: :cogs10, product_id: :productId, inventory: :inventory, sales_code: :salesCode, _info: :_info } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
342 343 344 |
# File 'lib/connect_wise/models/gl_account.rb', line 342 def self.build_from_hash(attributes) new.build_from_hash(attributes) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
182 183 184 185 186 |
# File 'lib/connect_wise/models/gl_account.rb', line 182 def self.openapi_nullable Set.new([ :gl_type ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 |
# File 'lib/connect_wise/models/gl_account.rb', line 148 def self.openapi_types { gl_type: :String, mapped_type: :MappedTypeReference, mapped_record: :MappedRecordReference, id: :Integer, segment1: :String, segment2: :String, segment3: :String, segment4: :String, segment5: :String, segment6: :String, segment7: :String, segment8: :String, segment9: :String, segment10: :String, cogs1: :String, cogs2: :String, cogs3: :String, cogs4: :String, cogs5: :String, cogs6: :String, cogs7: :String, cogs8: :String, cogs9: :String, cogs10: :String, product_id: :String, inventory: :String, sales_code: :String, _info: :'Hash<String, String>' } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/connect_wise/models/gl_account.rb', line 293 def ==(other) return true if equal?(other) self.class == other.class && gl_type == other.gl_type && mapped_type == other.mapped_type && mapped_record == other.mapped_record && id == other.id && segment1 == other.segment1 && segment2 == other.segment2 && segment3 == other.segment3 && segment4 == other.segment4 && segment5 == other.segment5 && segment6 == other.segment6 && segment7 == other.segment7 && segment8 == other.segment8 && segment9 == other.segment9 && segment10 == other.segment10 && cogs1 == other.cogs1 && cogs2 == other.cogs2 && cogs3 == other.cogs3 && cogs4 == other.cogs4 && cogs5 == other.cogs5 && cogs6 == other.cogs6 && cogs7 == other.cogs7 && cogs8 == other.cogs8 && cogs9 == other.cogs9 && cogs10 == other.cogs10 && product_id == other.product_id && inventory == other.inventory && sales_code == other.sales_code && _info == other._info end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 |
# File 'lib/connect_wise/models/gl_account.rb', line 372 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 = ConnectWise.const_get(type) klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
443 444 445 446 447 448 449 450 451 452 453 454 455 |
# File 'lib/connect_wise/models/gl_account.rb', line 443 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 |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 |
# File 'lib/connect_wise/models/gl_account.rb', line 349 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) 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 send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize(::Regexp.last_match(1), v) }) if attributes[self.class.attribute_map[key]].is_a?(Array) elsif !attributes[self.class.attribute_map[key]].nil? send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end end self end |
#eql?(other) ⇒ Boolean
329 330 331 |
# File 'lib/connect_wise/models/gl_account.rb', line 329 def eql?(other) self == other end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
335 336 337 |
# File 'lib/connect_wise/models/gl_account.rb', line 335 def hash [gl_type, mapped_type, mapped_record, id, segment1, segment2, segment3, segment4, segment5, segment6, segment7, segment8, segment9, segment10, cogs1, cogs2, cogs3, cogs4, cogs5, cogs6, cogs7, cogs8, cogs9, cogs10, product_id, inventory, sales_code, _info].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
262 263 264 265 266 267 268 269 |
# File 'lib/connect_wise/models/gl_account.rb', line 262 def list_invalid_properties invalid_properties = [] invalid_properties.push('invalid value for "mapped_type", mapped_type cannot be nil.') if @mapped_type.nil? invalid_properties.push('invalid value for "mapped_record", mapped_record cannot be nil.') if @mapped_record.nil? invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
419 420 421 |
# File 'lib/connect_wise/models/gl_account.rb', line 419 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
425 426 427 428 429 430 431 432 433 434 435 436 437 |
# File 'lib/connect_wise/models/gl_account.rb', line 425 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = 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 |
#to_s ⇒ String
Returns the string representation of the object
413 414 415 |
# File 'lib/connect_wise/models/gl_account.rb', line 413 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
273 274 275 276 277 278 279 280 |
# File 'lib/connect_wise/models/gl_account.rb', line 273 def valid? gl_type_validator = EnumAttributeValidator.new('String', %w[AP AR EE EI EO IA IT P PF R RA RD RE RP ST SD ET FT PT]) return false unless gl_type_validator.valid?(@gl_type) return false if @mapped_type.nil? return false if @mapped_record.nil? true end |