Class: Quickbooks::Model::ModelProperty

Inherits:
Object
  • Object
show all
Defined in:
lib/quickbooks/model.rb

Overview

A ModelProperty is just a little data store that keeps track of characteristics of each of the model’s properties.

Instance Method Summary collapse

Constructor Details

#initialize(klass_name, addable = false, writable = false, readable = false) ⇒ ModelProperty

:nodoc:



7
8
9
10
11
12
# File 'lib/quickbooks/model.rb', line 7

def initialize(klass_name, addable=false, writable=false, readable=false) #:nodoc:
  @klass_name = klass_name
  @addable = !!addable
  @writable = !!writable
  @readable = !!readable
end

Instance Method Details

#addable!Object

:nodoc:



28
29
30
# File 'lib/quickbooks/model.rb', line 28

def addable! #:nodoc:
  @addable = true
end

#addable?Boolean

Can I include this property when creating a new object?

Returns:



25
26
27
# File 'lib/quickbooks/model.rb', line 25

def addable?
  @addable
end

#klassObject

Get the class constant for the property.



20
21
22
# File 'lib/quickbooks/model.rb', line 20

def klass
  QB[@klass_name]
end

#klass_nameObject

Get the class name of the property.



15
16
17
# File 'lib/quickbooks/model.rb', line 15

def klass_name
  @klass_name
end

#readable!Object

:nodoc:



44
45
46
# File 'lib/quickbooks/model.rb', line 44

def readable! #:nodoc:
  @readable = true
end

#readable?Boolean

Is this property returned when reading back from QuickBooks?

Returns:



41
42
43
# File 'lib/quickbooks/model.rb', line 41

def readable?
  @readable
end

#writable!Object

:nodoc:



36
37
38
# File 'lib/quickbooks/model.rb', line 36

def writable! #:nodoc:
  @writable = true
end

#writable?Boolean

Can I include this property when modifying an existing object?

Returns:



33
34
35
# File 'lib/quickbooks/model.rb', line 33

def writable?
  @writable
end