cargowise 0.8.6 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.9.0 - 13th February 2012
2
+ * Use Cargowise::CA_CERT_FILE to specify a bundle of SSL certs
3
+
1
4
  v0.8.6 - 6th November 2011
2
5
  * dependency updates to more recent versions
3
6
 
@@ -10,6 +10,7 @@ require 'andand'
10
10
 
11
11
  module Cargowise
12
12
  DEFAULT_NS = "http://www.edi.com.au/EnterpriseService/"
13
+ CA_CERT_FILE = "/etc/ssl/certs/ca-certificates.crt"
13
14
  end
14
15
 
15
16
  # this lib
@@ -22,12 +22,20 @@ module Cargowise
22
22
  def hello(company_code, username, pass)
23
23
  soap_action = 'http://www.edi.com.au/EnterpriseService/Hello'
24
24
  soap_headers = headers(company_code, username, pass)
25
- response = invoke('tns:Hello', :soap_action => soap_action, :soap_header => soap_headers)
25
+ response = invoke('tns:Hello', :soap_action => soap_action, :soap_header => soap_headers, :http_options => cw_http_options)
26
26
  response.document.xpath("//tns:HelloResponse/tns:HelloResult/text()", {"tns" => Cargowise::DEFAULT_NS}).to_s
27
27
  end
28
28
 
29
29
  private
30
30
 
31
+ def cw_http_options
32
+ if File.file?(Cargowise::CA_CERT_FILE)
33
+ {:trust_ca_file => Cargowise::CA_CERT_FILE}
34
+ else
35
+ {}
36
+ end
37
+ end
38
+
31
39
  def headers(company_code, username, pass)
32
40
  {
33
41
  "tns:WebTrackerSOAPHeader" => {
@@ -16,7 +16,7 @@ module Cargowise
16
16
  def get_order_list(company_code, username, pass, filter_hash)
17
17
  soap_action = 'http://www.edi.com.au/EnterpriseService/GetOrderList'
18
18
  soap_headers = headers(company_code, username, pass)
19
- response = invoke('tns:GetOrderList', :soap_action => soap_action, :soap_header => soap_headers, :soap_body => filter_hash)
19
+ response = invoke('tns:GetOrderList', :soap_action => soap_action, :soap_header => soap_headers, :soap_body => filter_hash, :http_options => cwkhttp_options)
20
20
  response.document.xpath("//tns:GetOrderListResult/tns:WebOrder", {"tns" => Cargowise::DEFAULT_NS}).map do |node|
21
21
  Cargowise::Order.new(node)
22
22
  end
@@ -134,6 +134,9 @@ module Cargowise
134
134
  base_uri = tracker_login_uri(via)
135
135
  login_uri = base_uri + "/Login/Login.aspx"
136
136
  agent = Mechanize.new
137
+ if File.file?(Cargowise::CA_CERT_FILE)
138
+ agent.agent.http.ca_file = CA_CERT_FILE
139
+ end
137
140
  page = agent.get(login_uri)
138
141
  form = page.forms.first
139
142
  input_name = form.fields.detect { |field| field.name.to_s.downcase.include?("number")}.andand.name
@@ -15,9 +15,9 @@ module Cargowise
15
15
  # for samples
16
16
  #
17
17
  def get_shipments_list(company_code, username, pass, filter_hash)
18
- soap_action = 'http://www.edi.com.au/EnterpriseService/GetShipmentsList'
18
+ soap_action = 'http://www.edi.com.au/EnterpriseService/GetShipmentsList'
19
19
  soap_headers = headers(company_code, username, pass)
20
- response = invoke('tns:GetShipmentsList', :soap_action => soap_action, :soap_header => soap_headers, :soap_body => filter_hash)
20
+ response = invoke('tns:GetShipmentsList', :soap_action => soap_action, :soap_header => soap_headers, :soap_body => filter_hash, :http_options => cw_http_options)
21
21
  response.document.xpath("//tns:GetShipmentsListResult/tns:WebShipment", {"tns" => Cargowise::DEFAULT_NS}).map do |node|
22
22
  Cargowise::Shipment.new(node)
23
23
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cargowise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-06 00:00:00.000000000 Z
12
+ date: 2012-02-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: curb
16
- requirement: &29092260 !ruby/object:Gem::Requirement
16
+ requirement: &17294800 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *29092260
24
+ version_requirements: *17294800
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: andand
27
- requirement: &29091580 !ruby/object:Gem::Requirement
27
+ requirement: &17294280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *29091580
35
+ version_requirements: *17294280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: handsoap
38
- requirement: &29090640 !ruby/object:Gem::Requirement
38
+ requirement: &17293220 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.1.7
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *29090640
46
+ version_requirements: *17293220
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: nokogiri
49
- requirement: &29089720 !ruby/object:Gem::Requirement
49
+ requirement: &17291940 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '1.4'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *29089720
57
+ version_requirements: *17291940
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: mechanize
60
- requirement: &29086720 !ruby/object:Gem::Requirement
60
+ requirement: &17291440 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,7 +65,7 @@ dependencies:
65
65
  version: '2.0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *29086720
68
+ version_requirements: *17291440
69
69
  description: Retrieve tracking and status information on your shipments from entpriseEDI
70
70
  email:
71
71
  - james@yob.id.au