Class: Economic::Order
Instance Attribute Summary
Attributes inherited from Entity
#id, #number, #partial, #persisted, #session
Instance Method Summary
collapse
Methods inherited from Entity
#==, default_values, defaults, #destroy, #get, #get_data, #handle, #handle=, handle_writer, has_properties, #initialize, #inspect, key, #partial?, #persisted?, properties, properties_not_triggering_full_load, property_reader, property_writer, proxy, #proxy, #save, #update_properties
Instance Method Details
#attention ⇒ Object
24
25
26
27
|
# File 'lib/economic/order.rb', line 24
def attention
return nil if attention_handle.nil?
@attention ||= session.contacts.find(attention_handle)
end
|
#attention=(contact) ⇒ Object
29
30
31
32
|
# File 'lib/economic/order.rb', line 29
def attention=(contact)
self.attention_handle = contact.handle
@attention = contact
end
|
#attention_handle=(handle) ⇒ Object
34
35
36
37
|
# File 'lib/economic/order.rb', line 34
def attention_handle=(handle)
@attention = nil unless handle == @attention_handle
@attention_handle = handle
end
|
#cancel_sent_status ⇒ Object
39
40
41
|
# File 'lib/economic/order.rb', line 39
def cancel_sent_status
request(:cancel_sent_status, "orderHandle" => handle.to_hash)
end
|
#debtor ⇒ Object
43
44
45
46
|
# File 'lib/economic/order.rb', line 43
def debtor
return nil if debtor_handle.nil?
@debtor ||= session.debtors.find(debtor_handle)
end
|
#debtor=(debtor) ⇒ Object
48
49
50
51
|
# File 'lib/economic/order.rb', line 48
def debtor=(debtor)
self.debtor_handle = debtor.handle
@debtor = debtor
end
|
#debtor_handle=(handle) ⇒ Object
53
54
55
56
|
# File 'lib/economic/order.rb', line 53
def debtor_handle=(handle)
@debtor = nil unless handle == @debtor_handle
@debtor_handle = handle
end
|
#order_lines ⇒ Object
58
59
60
|
# File 'lib/economic/order.rb', line 58
def order_lines
OrderLineProxy.new(self).find_by_order(handle.to_hash)
end
|
#pdf ⇒ Object
Returns the PDF version of Invoice as a String.
To get it as a file you can do:
File.open("invoice.pdf", 'wb') do |file|
file << invoice.pdf
end
69
70
71
72
73
|
# File 'lib/economic/order.rb', line 69
def pdf
response = request(:get_pdf, "orderHandle" => handle.to_hash)
Base64.decode64(response)
end
|
#register_as_sent ⇒ Object
75
76
77
|
# File 'lib/economic/order.rb', line 75
def register_as_sent
request(:register_as_sent, "orderHandle" => handle.to_hash)
end
|