shipping 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/shipping/base.rb +84 -2
- data/lib/shipping/fedex.rb +2 -0
- metadata +2 -36
- data/doc/classes/Shipping.html +0 -141
- data/doc/classes/Shipping/Base.html +0 -393
- data/doc/classes/Shipping/Base.src/M000008.html +0 -26
- data/doc/classes/Shipping/Base.src/M000009.html +0 -18
- data/doc/classes/Shipping/Base.src/M000010.html +0 -18
- data/doc/classes/Shipping/FedEx.html +0 -266
- data/doc/classes/Shipping/FedEx.src/M000003.html +0 -21
- data/doc/classes/Shipping/FedEx.src/M000004.html +0 -21
- data/doc/classes/Shipping/FedEx.src/M000005.html +0 -39
- data/doc/classes/Shipping/FedEx.src/M000006.html +0 -50
- data/doc/classes/Shipping/FedEx.src/M000007.html +0 -155
- data/doc/classes/Shipping/ShippingError.html +0 -111
- data/doc/classes/Shipping/UPS.html +0 -178
- data/doc/classes/Shipping/UPS.src/M000001.html +0 -32
- data/doc/classes/Shipping/UPS.src/M000002.html +0 -53
- data/doc/created.rid +0 -1
- data/doc/files/README.html +0 -174
- data/doc/files/lib/shipping/base_rb.html +0 -115
- data/doc/files/lib/shipping/fedex_rb.html +0 -120
- data/doc/files/lib/shipping/ups_rb.html +0 -115
- data/doc/files/lib/shipping_rb.html +0 -130
- data/doc/fr_class_index.html +0 -31
- data/doc/fr_file_index.html +0 -31
- data/doc/fr_method_index.html +0 -36
- data/doc/index.html +0 -24
- data/doc/rdoc-style.css +0 -208
@@ -1,26 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>new (Shipping::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/shipping/base.rb, line 22</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
|
15
|
-
<span class="ruby-identifier">prefs</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">expand_path</span>(<span class="ruby-identifier">options</span>[<span class="ruby-identifier">:prefs</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">"~/.shipping.yml"</span>)
|
16
|
-
<span class="ruby-constant">YAML</span>.<span class="ruby-identifier">load</span>(<span class="ruby-constant">File</span>.<span class="ruby-identifier">open</span>(<span class="ruby-identifier">prefs</span>)).<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">pref</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span> <span class="ruby-identifier">eval</span>(<span class="ruby-node">"@#{pref} = #{value.inspect}"</span>)} <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">exists?</span>(<span class="ruby-identifier">prefs</span>)
|
17
|
-
|
18
|
-
<span class="ruby-ivar">@required</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
|
19
|
-
|
20
|
-
<span class="ruby-comment cmt"># include all provided data</span>
|
21
|
-
<span class="ruby-identifier">options</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">method</span>, <span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
|
22
|
-
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{method}"</span>, <span class="ruby-identifier">value</span>)
|
23
|
-
<span class="ruby-keyword kw">end</span>
|
24
|
-
<span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>fedex (Shipping::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/shipping/base.rb, line 35</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fedex</span>
|
15
|
-
<span class="ruby-constant">Shipping</span><span class="ruby-operator">::</span><span class="ruby-constant">FedEx</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">prepare_vars</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,18 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>ups (Shipping::Base)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/shipping/base.rb, line 40</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">ups</span>
|
15
|
-
<span class="ruby-constant">Shipping</span><span class="ruby-operator">::</span><span class="ruby-constant">UPS</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">prepare_vars</span>
|
16
|
-
<span class="ruby-keyword kw">end</span></pre>
|
17
|
-
</body>
|
18
|
-
</html>
|
@@ -1,266 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
-
<head>
|
8
|
-
<title>Class: Shipping::FedEx</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
-
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
-
<script type="text/javascript">
|
13
|
-
// <![CDATA[
|
14
|
-
|
15
|
-
function popupCode( url ) {
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
-
}
|
18
|
-
|
19
|
-
function toggleCode( id ) {
|
20
|
-
if ( document.getElementById )
|
21
|
-
elem = document.getElementById( id );
|
22
|
-
else if ( document.all )
|
23
|
-
elem = eval( "document.all." + id );
|
24
|
-
else
|
25
|
-
return false;
|
26
|
-
|
27
|
-
elemStyle = elem.style;
|
28
|
-
|
29
|
-
if ( elemStyle.display != "block" ) {
|
30
|
-
elemStyle.display = "block"
|
31
|
-
} else {
|
32
|
-
elemStyle.display = "none"
|
33
|
-
}
|
34
|
-
|
35
|
-
return true;
|
36
|
-
}
|
37
|
-
|
38
|
-
// Make codeblocks hidden by default
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
-
|
41
|
-
// ]]>
|
42
|
-
</script>
|
43
|
-
|
44
|
-
</head>
|
45
|
-
<body>
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
<div id="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">Shipping::FedEx</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/shipping/fedex_rb.html">
|
59
|
-
lib/shipping/fedex.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
<a href="Base.html">
|
69
|
-
Base
|
70
|
-
</a>
|
71
|
-
</td>
|
72
|
-
</tr>
|
73
|
-
</table>
|
74
|
-
</div>
|
75
|
-
<!-- banner header -->
|
76
|
-
|
77
|
-
<div id="bodyContent">
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
<div id="contextContent">
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
</div>
|
86
|
-
|
87
|
-
<div id="method-list">
|
88
|
-
<h3 class="section-bar">Methods</h3>
|
89
|
-
|
90
|
-
<div class="name-list">
|
91
|
-
<a href="#M000004">base_price</a>
|
92
|
-
<a href="#M000005">express_service_availability</a>
|
93
|
-
<a href="#M000007">label</a>
|
94
|
-
<a href="#M000003">price</a>
|
95
|
-
<a href="#M000006">register</a>
|
96
|
-
</div>
|
97
|
-
</div>
|
98
|
-
|
99
|
-
</div>
|
100
|
-
|
101
|
-
|
102
|
-
<!-- if includes -->
|
103
|
-
|
104
|
-
<div id="section">
|
105
|
-
|
106
|
-
|
107
|
-
<div id="constants-list">
|
108
|
-
<h3 class="section-bar">Constants</h3>
|
109
|
-
|
110
|
-
<div class="name-list">
|
111
|
-
<table summary="Constants">
|
112
|
-
<tr class="top-aligned-row context-row">
|
113
|
-
<td class="context-item-name">ServiceTypes</td>
|
114
|
-
<td>=</td>
|
115
|
-
<td class="context-item-value">{ "priority" => "PRIORITYOVERNIGHT", "2day" => "FEDEX2DAY", "standard_overnight" => "STANDARDOVERNIGHT", "first_overnight" => "FIRSTOVERNIGHT", "express_saver" => "FEDEXEXPRESSSAVER", "1day_freight" => "FEDEX1DAYFREIGHT", "2day_freight" => "FEDEX2DAYFREIGHT", "3day_freight" => "FEDEX3DAYFREIGHT", "international_priority" => "INTERNATIONALPRIORITY", "international_economy" => "INTERNATIONALECONOMY", "international_first" => "INTERNATIONALFIRST", "international_priority_freight" => "INTERNATIONALPRIORITYFREIGHT", "international_economy_freight" => "INTERNATIONALECONOMYFREIGHT", "home_delivery" => "GROUNDHOMEDELIVERY", "ground_service" => "FEDEXGROUND", "international_ground_service" => "INTERNATIONALGROUND"</td>
|
116
|
-
<td width="3em"> </td>
|
117
|
-
<td class="context-item-desc">
|
118
|
-
The following type hashes are to allow cross-api data retrieval
|
119
|
-
|
120
|
-
</td>
|
121
|
-
</tr>
|
122
|
-
<tr class="top-aligned-row context-row">
|
123
|
-
<td class="context-item-name">PackageTypes</td>
|
124
|
-
<td>=</td>
|
125
|
-
<td class="context-item-value">{ "fedex_envelope" => "FEDEXENVELOPE", "fedex_pak" => "FEDEXPAK", "fedex_box" => "FEDEXBOX", "fedex_tube" => "FEDEXTUBE", "fedex_10_kg_box" => "FEDEX10KGBOX", "fedex_25_kg_box" => "FEDEX25KGBOX", "your_packaging" => "YOURPACKAGING"</td>
|
126
|
-
</tr>
|
127
|
-
<tr class="top-aligned-row context-row">
|
128
|
-
<td class="context-item-name">DropoffTypes</td>
|
129
|
-
<td>=</td>
|
130
|
-
<td class="context-item-value">{ 'regular_pickup' => 'REGULARPICKUP', 'request_courier' => 'REQUESTCOURIER', 'dropbox' => 'DROPBOX', 'business_service_center' => 'BUSINESSSERVICECENTER', 'station' => 'STATION'</td>
|
131
|
-
</tr>
|
132
|
-
<tr class="top-aligned-row context-row">
|
133
|
-
<td class="context-item-name">PaymentTypes</td>
|
134
|
-
<td>=</td>
|
135
|
-
<td class="context-item-value">{ 'sender' => 'SENDER', 'recipient' => 'RECIPIENT', 'third_party' => 'THIRDPARTY', 'collect' => 'COLLECT'</td>
|
136
|
-
</tr>
|
137
|
-
<tr class="top-aligned-row context-row">
|
138
|
-
<td class="context-item-name">TransactionTypes</td>
|
139
|
-
<td>=</td>
|
140
|
-
<td class="context-item-value">{ 'rate_ground' => ['022','FDXG'], 'rate_express' => ['022','FDXE'], 'rate_services' => ['025',''], 'ship_ground' => ['021','FDXG'], 'ship_express' => ['021','FDXE'], 'cancel_express' => ['023','FDXE'], 'cancel_ground' => ['023','FDXG'], 'close_ground' => ['007','FDXG'], 'service_available' => ['019','FDXE'], 'fedex_locater' => ['410',''], 'subscribe' => ['211',''], 'sig_proof_delivery' => ['402',''], 'track' => ['405',''], 'ref_track' => ['403','']</td>
|
141
|
-
</tr>
|
142
|
-
</table>
|
143
|
-
</div>
|
144
|
-
</div>
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
<!-- if method_list -->
|
152
|
-
<div id="methods">
|
153
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
154
|
-
|
155
|
-
<div id="method-M000004" class="method-detail">
|
156
|
-
<a name="M000004"></a>
|
157
|
-
|
158
|
-
<div class="method-heading">
|
159
|
-
<a href="FedEx.src/M000004.html" target="Code" class="method-signature"
|
160
|
-
onclick="popupCode('FedEx.src/M000004.html');return false;">
|
161
|
-
<span class="method-name">base_price</span><span class="method-args">()</span>
|
162
|
-
</a>
|
163
|
-
</div>
|
164
|
-
|
165
|
-
<div class="method-description">
|
166
|
-
<p>
|
167
|
-
Gets the base price of the shipping (with discounts taken into
|
168
|
-
consideration)
|
169
|
-
</p>
|
170
|
-
</div>
|
171
|
-
</div>
|
172
|
-
|
173
|
-
<div id="method-M000005" class="method-detail">
|
174
|
-
<a name="M000005"></a>
|
175
|
-
|
176
|
-
<div class="method-heading">
|
177
|
-
<a href="FedEx.src/M000005.html" target="Code" class="method-signature"
|
178
|
-
onclick="popupCode('FedEx.src/M000005.html');return false;">
|
179
|
-
<span class="method-name">express_service_availability</span><span class="method-args">()</span>
|
180
|
-
</a>
|
181
|
-
</div>
|
182
|
-
|
183
|
-
<div class="method-description">
|
184
|
-
<p>
|
185
|
-
still not sure what the best way to handle this transaction’s return
|
186
|
-
data would be. Possibly a hash of the form {service =>
|
187
|
-
delivery_estimate}?
|
188
|
-
</p>
|
189
|
-
</div>
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<div id="method-M000007" class="method-detail">
|
193
|
-
<a name="M000007"></a>
|
194
|
-
|
195
|
-
<div class="method-heading">
|
196
|
-
<a href="FedEx.src/M000007.html" target="Code" class="method-signature"
|
197
|
-
onclick="popupCode('FedEx.src/M000007.html');return false;">
|
198
|
-
<span class="method-name">label</span><span class="method-args">()</span>
|
199
|
-
</a>
|
200
|
-
</div>
|
201
|
-
|
202
|
-
<div class="method-description">
|
203
|
-
<p>
|
204
|
-
require ‘fileutils’ fedex = Shipping::FedEx.new :name =>
|
205
|
-
‘John Doe’, … , :sender_zip => 97202 label =
|
206
|
-
fedex.label
|
207
|
-
</p>
|
208
|
-
<pre>
|
209
|
-
puts label.url
|
210
|
-
</pre>
|
211
|
-
<p>
|
212
|
-
puts label.tracking_number
|
213
|
-
</p>
|
214
|
-
<pre>
|
215
|
-
In the future you will be able to do:
|
216
|
-
</pre>
|
217
|
-
<p>
|
218
|
-
FileUtils.cp label.image.path, ’/path/to/my/images/directory/’
|
219
|
-
</p>
|
220
|
-
</div>
|
221
|
-
</div>
|
222
|
-
|
223
|
-
<div id="method-M000003" class="method-detail">
|
224
|
-
<a name="M000003"></a>
|
225
|
-
|
226
|
-
<div class="method-heading">
|
227
|
-
<a href="FedEx.src/M000003.html" target="Code" class="method-signature"
|
228
|
-
onclick="popupCode('FedEx.src/M000003.html');return false;">
|
229
|
-
<span class="method-name">price</span><span class="method-args">()</span>
|
230
|
-
</a>
|
231
|
-
</div>
|
232
|
-
|
233
|
-
<div class="method-description">
|
234
|
-
<p>
|
235
|
-
Gets the total price of the shipping
|
236
|
-
</p>
|
237
|
-
</div>
|
238
|
-
</div>
|
239
|
-
|
240
|
-
<div id="method-M000006" class="method-detail">
|
241
|
-
<a name="M000006"></a>
|
242
|
-
|
243
|
-
<div class="method-heading">
|
244
|
-
<a href="FedEx.src/M000006.html" target="Code" class="method-signature"
|
245
|
-
onclick="popupCode('FedEx.src/M000006.html');return false;">
|
246
|
-
<span class="method-name">register</span><span class="method-args">()</span>
|
247
|
-
</a>
|
248
|
-
</div>
|
249
|
-
|
250
|
-
<div class="method-description">
|
251
|
-
</div>
|
252
|
-
</div>
|
253
|
-
|
254
|
-
|
255
|
-
</div>
|
256
|
-
|
257
|
-
|
258
|
-
</div>
|
259
|
-
|
260
|
-
|
261
|
-
<div id="validator-badges">
|
262
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
263
|
-
</div>
|
264
|
-
|
265
|
-
</body>
|
266
|
-
</html>
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>price (Shipping::FedEx)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/shipping/fedex.rb, line 11</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">price</span>
|
15
|
-
<span class="ruby-identifier">get_price</span>
|
16
|
-
<span class="ruby-identifier">p</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-ivar">@response</span>, <span class="ruby-value str">"//FDXRateReply/EstimatedCharges/DiscountedCharges/NetCharge"</span>).<span class="ruby-identifier">text</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
17
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ShippingError</span>, <span class="ruby-identifier">get_error</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">nil?</span>
|
18
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">p</span>
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
20
|
-
</body>
|
21
|
-
</html>
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>base_price (Shipping::FedEx)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/shipping/fedex.rb, line 19</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">base_price</span>
|
15
|
-
<span class="ruby-identifier">get_price</span>
|
16
|
-
<span class="ruby-identifier">p</span> = <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-ivar">@response</span>, <span class="ruby-value str">"//FDXRateReply/EstimatedCharges/DiscountedCharges/BaseCharge"</span>).<span class="ruby-identifier">text</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
17
|
-
<span class="ruby-identifier">raise</span> <span class="ruby-constant">ShippingError</span>, <span class="ruby-identifier">get_error</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">nil?</span>
|
18
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-identifier">p</span>
|
19
|
-
<span class="ruby-keyword kw">end</span></pre>
|
20
|
-
</body>
|
21
|
-
</html>
|
@@ -1,39 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>express_service_availability (Shipping::FedEx)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/shipping/fedex.rb, line 27</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">express_service_availability</span>
|
15
|
-
|
16
|
-
<span class="ruby-ivar">@data</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>
|
17
|
-
<span class="ruby-identifier">b</span> = <span class="ruby-constant">Builder</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlMarkup</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">:target</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@data</span>
|
18
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">instruct!</span>
|
19
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">FDXServiceAvailabilityRequest</span>(<span class="ruby-value str">'xmlns:api'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'http://www.fedex.com/fsmapi'</span>, <span class="ruby-value str">'xmlns:xsi'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'http://www.w3.org/2001/XMLSchema-instance'</span>, <span class="ruby-value str">'xsi:noNamespaceSchemaLocation'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'FDXServiceAvailabilityRequest.xsd'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
20
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">RequestHeader</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
21
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">AccountNumber</span> <span class="ruby-ivar">@fedex_account</span>
|
22
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">MeterNumber</span> <span class="ruby-ivar">@fedex_meter</span>
|
23
|
-
}
|
24
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">OriginAddress</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
25
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">PostalCode</span> <span class="ruby-ivar">@sender_zip</span>
|
26
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">CountryCode</span> <span class="ruby-ivar">@sender_country_code</span> <span class="ruby-operator">||</span> <span class="ruby-value str">"US"</span>
|
27
|
-
}
|
28
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">DestinationAddress</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
29
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">PostalCode</span> <span class="ruby-ivar">@zip</span>
|
30
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">CountryCode</span> <span class="ruby-ivar">@country</span> <span class="ruby-operator">||</span> <span class="ruby-value str">"US"</span>
|
31
|
-
}
|
32
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">ShipDate</span> <span class="ruby-ivar">@ship_date</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@ship_date</span>.<span class="ruby-identifier">nil?</span>
|
33
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">PackageCount</span> <span class="ruby-ivar">@package_total</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'1'</span>
|
34
|
-
}
|
35
|
-
|
36
|
-
<span class="ruby-identifier">get_response</span> <span class="ruby-ivar">@fedex_url</span>
|
37
|
-
<span class="ruby-keyword kw">end</span></pre>
|
38
|
-
</body>
|
39
|
-
</html>
|
@@ -1,50 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
-
|
6
|
-
<html>
|
7
|
-
<head>
|
8
|
-
<title>register (Shipping::FedEx)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre><span class="ruby-comment cmt"># File lib/shipping/fedex.rb, line 52</span>
|
14
|
-
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">register</span>
|
15
|
-
<span class="ruby-ivar">@required</span> = [<span class="ruby-identifier">:name</span>, <span class="ruby-identifier">:company</span>, <span class="ruby-identifier">:phone</span>, <span class="ruby-identifier">:email</span>, <span class="ruby-identifier">:address</span>, <span class="ruby-identifier">:city</span>, <span class="ruby-identifier">:state</span>, <span class="ruby-identifier">:zip</span>]
|
16
|
-
<span class="ruby-ivar">@required</span> <span class="ruby-operator">+=</span> [<span class="ruby-identifier">:fedex_account</span>, <span class="ruby-identifier">:fedex_url</span>]
|
17
|
-
|
18
|
-
<span class="ruby-identifier">state</span> = <span class="ruby-constant">STATES</span>.<span class="ruby-identifier">has_value?</span>(<span class="ruby-ivar">@state</span>.<span class="ruby-identifier">downcase</span>) <span class="ruby-operator">?</span> <span class="ruby-constant">STATES</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@state</span>.<span class="ruby-identifier">downcase</span>).<span class="ruby-identifier">upcase</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@state</span>.<span class="ruby-identifier">upcase</span>
|
19
|
-
|
20
|
-
<span class="ruby-ivar">@data</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>
|
21
|
-
<span class="ruby-identifier">b</span> = <span class="ruby-constant">Builder</span><span class="ruby-operator">::</span><span class="ruby-constant">XmlMarkup</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">:target</span> =<span class="ruby-operator">></span> <span class="ruby-ivar">@data</span>
|
22
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">instruct!</span>
|
23
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">FDXSubscriptionRequest</span>(<span class="ruby-value str">'xmlns:api'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'http://www.fedex.com/fsmapi'</span>, <span class="ruby-value str">'xmlns:xsi'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'http://www.w3.org/2001/XMLSchema-instance'</span>, <span class="ruby-value str">'xsi:noNamespaceSchemaLocation'</span> =<span class="ruby-operator">></span> <span class="ruby-value str">'FDXSubscriptionRequest.xsd'</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
24
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">RequestHeader</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
25
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">CustomerTransactionIdentifier</span> <span class="ruby-ivar">@transaction_identifier</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@transaction_identifier</span> <span class="ruby-comment cmt"># optional</span>
|
26
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">AccountNumber</span> <span class="ruby-ivar">@fedex_account</span>
|
27
|
-
}
|
28
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">Contact</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
29
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">PersonName</span> <span class="ruby-ivar">@name</span>
|
30
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">CompanyName</span> <span class="ruby-ivar">@company</span>
|
31
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">Department</span> <span class="ruby-ivar">@department</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@department</span>
|
32
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">PhoneNumber</span> <span class="ruby-ivar">@phone</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/[^\d]/</span>,<span class="ruby-value str">""</span>)
|
33
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-identifier">tag!</span> <span class="ruby-value str">"E-MailAddress"</span><span class="ruby-value str">"E-MailAddress"</span>, <span class="ruby-ivar">@email</span>
|
34
|
-
}
|
35
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">Address</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span>
|
36
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">Line1</span> <span class="ruby-ivar">@address</span>
|
37
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">Line2</span> <span class="ruby-ivar">@address2</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@address2</span>
|
38
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">City</span> <span class="ruby-ivar">@city</span>
|
39
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">StateOrProvinceCode</span> <span class="ruby-identifier">state</span>
|
40
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">PostalCode</span> <span class="ruby-ivar">@zip</span>
|
41
|
-
<span class="ruby-identifier">b</span>.<span class="ruby-constant">CountryCode</span> <span class="ruby-ivar">@country</span> <span class="ruby-operator">||</span> <span class="ruby-value str">'US'</span>
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
<span class="ruby-identifier">get_response</span> <span class="ruby-ivar">@fedex_url</span>
|
46
|
-
|
47
|
-
<span class="ruby-keyword kw">return</span> <span class="ruby-constant">REXML</span><span class="ruby-operator">::</span><span class="ruby-constant">XPath</span>.<span class="ruby-identifier">first</span>(<span class="ruby-ivar">@response</span>, <span class="ruby-value str">"//FDXSubscriptionReply/MeterNumber"</span>).<span class="ruby-identifier">text</span>
|
48
|
-
<span class="ruby-keyword kw">end</span></pre>
|
49
|
-
</body>
|
50
|
-
</html>
|