Class: IntacctRB::Attachment
- Inherits:
-
Base
show all
- Defined in:
- lib/intacctrb/attachment.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#current_user, #data, #intacct_action, #object, #response, #sent_xml
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #intacct_id
Instance Attribute Details
#customer_data ⇒ Object
Returns the value of attribute customer_data.
3
4
5
|
# File 'lib/intacctrb/attachment.rb', line 3
def customer_data
@customer_data
end
|
Instance Method Details
#attachment_xml(xml) ⇒ Object
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/intacctrb/attachment.rb', line 35
def attachment_xml xml
xml.supdocid object.supdoc_id
xml.supdocfoldername object.folder_name
xml.attachments {
object.attachments.each do |attachment|
xml.attachment {
xml.attachmentname attachment.name
xml.attachmenttype attachment.type
xml.attachmentdata attachment.data
}
end
}
end
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/intacctrb/attachment.rb', line 6
def create
return false if object.intacct_system_id.present?
send_xml('create') do |xml|
xml.function(controlid: "f1") {
xml.create_supdoc {
attachment_xml xml
}
}
end
if !successful?
raise IntacctRB::Exceptions::Attachment.new(response.at('//error//description2'))
end
object.intacct_id
end
|
#delete_intacct_key ⇒ Object
57
58
59
|
# File 'lib/intacctrb/attachment.rb', line 57
def delete_intacct_key
object.intacct_key = nil
end
|
#delete_intacct_system_id ⇒ Object
53
54
55
|
# File 'lib/intacctrb/attachment.rb', line 53
def delete_intacct_system_id
object.intacct_system_id = nil
end
|
#get_date_at(xpath, object) ⇒ Object
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/intacctrb/attachment.rb', line 24
def get_date_at(xpath, object)
year = object.at("#{xpath}/year").content
month = object.at("#{xpath}/month").content
day = object.at("#{xpath}/day").content
if [year,month,day].any?(&:empty?)
nil
else
Date.new(year.to_i,month.to_i,day.to_i)
end
end
|
#set_intacct_system_id ⇒ Object
49
50
51
|
# File 'lib/intacctrb/attachment.rb', line 49
def set_intacct_system_id
object.intacct_system_id = intacct_object_id
end
|