Class: IntacctRB::Attachment
Instance Attribute Summary collapse
-
#customer_data ⇒ Object
Returns the value of attribute customer_data.
Instance Method Summary collapse
- #attachment_xml(xml) ⇒ Object
- #create ⇒ Object
- #delete_intacct_key ⇒ Object
- #delete_intacct_system_id ⇒ Object
- #get_date_at(xpath, object) ⇒ Object
- #set_intacct_system_id ⇒ Object
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 xml xml.supdocid object.supdoc_id xml.supdocfoldername object.folder_name xml. { object..each do || xml. { xml. .name xml. .type xml. .data } end } end |
#create ⇒ Object
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 { 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 |