Class: Intacct::Functions::Read

Inherits:
Object
  • Object
show all
Defined in:
lib/intacct/functions/read.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, keys:, fields:, **args) ⇒ Read

Returns a new instance of Read.



8
9
10
11
12
13
# File 'lib/intacct/functions/read.rb', line 8

def initialize(object, keys:, fields:, **args)
  @object = object
  @keys = keys
  @fields = fields
  @args = args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



6
7
8
# File 'lib/intacct/functions/read.rb', line 6

def args
  @args
end

#fieldsObject (readonly)

Returns the value of attribute fields.



6
7
8
# File 'lib/intacct/functions/read.rb', line 6

def fields
  @fields
end

#keysObject (readonly)

Returns the value of attribute keys.



6
7
8
# File 'lib/intacct/functions/read.rb', line 6

def keys
  @keys
end

#objectObject (readonly)

Returns the value of attribute object.



6
7
8
# File 'lib/intacct/functions/read.rb', line 6

def object
  @object
end

Instance Method Details

#to_xmlObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/intacct/functions/read.rb', line 15

def to_xml
  builder = Builder::XmlMarkup.new
  builder.read do
    builder.object @object
    builder.keys keys.join(",")
    fields_value = @fields.any? ? @fields.join(",") : "*"
    builder.fields fields_value
    args.each do |key, value|
      builder.tag!(key, value)
    end
  end
end