cargowise 0.5 → 0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.6 - 31st August 2010
2
+ * new methods Order#to_xml and Shipment#to_xml
3
+ * new attribute Shipment#invoices
4
+
1
5
  v0.5 - 27th August 2010
2
6
 
3
7
  * initial release
@@ -16,6 +16,7 @@ require 'cargowise/abstract_result'
16
16
  require 'cargowise/order'
17
17
  require 'cargowise/shipment'
18
18
  require 'cargowise/document'
19
+ require 'cargowise/invoice'
19
20
  require 'cargowise/endpoint'
20
21
  require 'cargowise/abstract_search'
21
22
  require 'cargowise/order_search'
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+
3
+ module Cargowise
4
+
5
+ # An invoice that is associated with a Shipment. Not built
6
+ # directly, but available via the invoices() attribute
7
+ # of the Shipment model.
8
+ #
9
+ class Invoice < AbstractResult
10
+
11
+ attr_reader :number, :issuer, :type, :date, :due_date
12
+ attr_reader :currency, :total, :outstanding
13
+ attr_reader :link
14
+
15
+ def initialize(node)
16
+ @node = node
17
+
18
+ @number = text_value("./InvoiceNumber")
19
+ @issuer = text_value("./IssuerName")
20
+ @date = time_value("./InvoiceDate")
21
+ @due_date = time_value("./DueDate")
22
+ @currency = text_value("./Currency")
23
+ @total = decimal_value("./TotalAmount")
24
+ @outstanding = decimal_value("./OutstandingAmount")
25
+ @link = text_value("./Link")
26
+ end
27
+ end
28
+ end
@@ -50,6 +50,10 @@ module Cargowise
50
50
  }
51
51
  end
52
52
 
53
+ def to_xml
54
+ @node.to_xml
55
+ end
56
+
53
57
  end
54
58
 
55
59
  end
@@ -28,7 +28,7 @@ module Cargowise
28
28
 
29
29
  attr_reader :consignee_name
30
30
 
31
- attr_reader :documents
31
+ attr_reader :documents, :invoices
32
32
 
33
33
  def initialize(node)
34
34
  @node = node
@@ -52,6 +52,16 @@ module Cargowise
52
52
  }.sort_by { |doc|
53
53
  doc.date
54
54
  }
55
+
56
+ @invoices = node_array("./RelatedInvoiceLinks/InvoiceLink").map { |node|
57
+ Invoice.new(node)
58
+ }.sort_by { |inv|
59
+ inv.due_date
60
+ }
61
+ end
62
+
63
+ def to_xml
64
+ @node.to_xml
55
65
  end
56
66
 
57
67
  end
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cargowise
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
9
- version: "0.5"
8
+ - 6
9
+ version: "0.6"
10
10
  platform: ruby
11
11
  authors:
12
12
  - James Healy
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-08-27 00:00:00 +10:00
17
+ date: 2010-08-31 00:00:00 +10:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -60,6 +60,7 @@ extra_rdoc_files: []
60
60
  files:
61
61
  - lib/cargowise/shipment.rb
62
62
  - lib/cargowise/shipments_client.rb
63
+ - lib/cargowise/invoice.rb
63
64
  - lib/cargowise/abstract_client.rb
64
65
  - lib/cargowise/abstract_search.rb
65
66
  - lib/cargowise/order.rb