shipping 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +46 -0
- data/Rakefile +93 -0
- data/doc/classes/Shipping/Base.html +323 -0
- data/doc/classes/Shipping/Base.src/M000005.html +26 -0
- data/doc/classes/Shipping/Base.src/M000006.html +18 -0
- data/doc/classes/Shipping/Base.src/M000007.html +18 -0
- data/doc/classes/Shipping/FedEx.html +184 -0
- data/doc/classes/Shipping/FedEx.src/M000003.html +21 -0
- data/doc/classes/Shipping/FedEx.src/M000004.html +21 -0
- data/doc/classes/Shipping/ShippingError.html +111 -0
- data/doc/classes/Shipping/UPS.html +167 -0
- data/doc/classes/Shipping/UPS.src/M000001.html +32 -0
- data/doc/classes/Shipping/UPS.src/M000002.html +52 -0
- data/doc/classes/Shipping.html +136 -0
- data/doc/created.rid +1 -0
- data/doc/files/README.html +174 -0
- data/doc/files/lib/shipping/base_rb.html +115 -0
- data/doc/files/lib/shipping/fedex_rb.html +115 -0
- data/doc/files/lib/shipping/ups_rb.html +115 -0
- data/doc/files/lib/shipping_rb.html +128 -0
- data/doc/fr_class_index.html +31 -0
- data/doc/fr_file_index.html +31 -0
- data/doc/fr_method_index.html +33 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/shipping/base.rb +71 -0
- data/lib/shipping/fedex.rb +532 -0
- data/lib/shipping/ups.rb +83 -0
- data/lib/shipping.rb +33 -0
- data/test/base/base_test.rb +18 -0
- data/test/fedex/fedex_test.rb +10 -0
- data/test/test_helper.rb +4 -0
- data/test/ups/ups_test.rb +16 -0
- metadata +81 -0
data/README
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
== Welcome to Shipping
|
2
|
+
|
3
|
+
Shipping is a module that connects APIs for various shippers like UPS and FedEx.
|
4
|
+
|
5
|
+
== Download
|
6
|
+
|
7
|
+
* gem install shipping
|
8
|
+
* http://rubyforge.org/projects/shipping
|
9
|
+
* svn co http://rufy.com/svn/shipping/trunk
|
10
|
+
|
11
|
+
=== Usage
|
12
|
+
There is going to be some data that will persist for all connections. For example, you will not want to repeat the fedex account number every time in your implementation code. To set default values, setup a file called .shipping.yml in the home directory of the user who will be using this library. An example file would be:
|
13
|
+
|
14
|
+
fedex_url: https://gatewaybeta.fedex.com/GatewayDC
|
15
|
+
fedex_account: 1234556
|
16
|
+
fedex_meter: 387878
|
17
|
+
|
18
|
+
ups_account: 7B4F74E3075AEEFF
|
19
|
+
ups_user: username
|
20
|
+
ups_password: password
|
21
|
+
|
22
|
+
You can set as many default values as you would like in this file.
|
23
|
+
|
24
|
+
require 'shipping'
|
25
|
+
|
26
|
+
ups = Shipping::UPS.new :zip => 97202, :sender_zip => 10001, :weight => 2
|
27
|
+
ups.price => 8.77
|
28
|
+
ups.valid_address? => false
|
29
|
+
|
30
|
+
ups.city = "Portland"
|
31
|
+
ups.valid_address? => true
|
32
|
+
|
33
|
+
Alternately, you can instantiate the base class and then see both UPS and FedEx information.
|
34
|
+
|
35
|
+
ship = Shipping::Base.new :zip => 97202, :state => "OR", :sender_zip => 10001, :weight => 2
|
36
|
+
ship.ups.price => 8.77
|
37
|
+
ship.fedex.price => 5.17
|
38
|
+
|
39
|
+
ship.city = "Portland"
|
40
|
+
ship.ups.valid_address? => true
|
41
|
+
|
42
|
+
== Authors
|
43
|
+
* Lucas Carlson (mailto:lucas@rufy.com)
|
44
|
+
|
45
|
+
This library is released under the terms of the GNU LGPL.
|
46
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
require 'rake/gempackagetask'
|
6
|
+
require 'rake/contrib/rubyforgepublisher'
|
7
|
+
|
8
|
+
PKG_VERSION = "1.0.0"
|
9
|
+
|
10
|
+
PKG_FILES = FileList[
|
11
|
+
"lib/**/*", "bin/*", "test/**/*", "[A-Z]*", "Rakefile", "doc/**/*"
|
12
|
+
]
|
13
|
+
|
14
|
+
desc "Default Task"
|
15
|
+
task :default => [ :test ]
|
16
|
+
|
17
|
+
# Run the unit tests
|
18
|
+
desc "Run all unit tests"
|
19
|
+
Rake::TestTask.new("test") { |t|
|
20
|
+
t.libs << "lib"
|
21
|
+
t.pattern = 'test/*/*_test.rb'
|
22
|
+
t.verbose = true
|
23
|
+
}
|
24
|
+
|
25
|
+
# Make a console, useful when working on tests
|
26
|
+
desc "Generate a test console"
|
27
|
+
task :console do
|
28
|
+
verbose( false ) { sh "irb -I lib/ -r 'shipping'" }
|
29
|
+
end
|
30
|
+
|
31
|
+
# Genereate the RDoc documentation
|
32
|
+
desc "Create documentation"
|
33
|
+
Rake::RDocTask.new("doc") { |rdoc|
|
34
|
+
rdoc.title = "Ruby Shipping - UPS, FedEx, USPS"
|
35
|
+
rdoc.rdoc_dir = 'doc'
|
36
|
+
rdoc.rdoc_files.include('README')
|
37
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
38
|
+
}
|
39
|
+
|
40
|
+
# Genereate the package
|
41
|
+
spec = Gem::Specification.new do |s|
|
42
|
+
|
43
|
+
#### Basic information.
|
44
|
+
|
45
|
+
s.name = 'shipping'
|
46
|
+
s.version = PKG_VERSION
|
47
|
+
s.summary = <<-EOF
|
48
|
+
A general shipping module to find out the shipping prices via UPS or FedEx.
|
49
|
+
EOF
|
50
|
+
s.description = <<-EOF
|
51
|
+
A general shipping module to find out the shipping prices via UPS or FedEx.
|
52
|
+
EOF
|
53
|
+
|
54
|
+
#### Which files are to be included in this gem? Everything! (Except CVS directories.)
|
55
|
+
|
56
|
+
s.files = PKG_FILES
|
57
|
+
|
58
|
+
#### Load-time details: library and application (you will need one or both).
|
59
|
+
|
60
|
+
s.require_path = 'lib'
|
61
|
+
s.autorequire = 'shipping'
|
62
|
+
|
63
|
+
#### Documentation and testing.
|
64
|
+
|
65
|
+
s.has_rdoc = true
|
66
|
+
|
67
|
+
#### Author and project details.
|
68
|
+
|
69
|
+
s.author = "Lucas Carlson"
|
70
|
+
s.email = "lucas@rufy.com"
|
71
|
+
s.homepage = "http://shipping.rufy.com/"
|
72
|
+
end
|
73
|
+
|
74
|
+
Rake::GemPackageTask.new(spec) do |pkg|
|
75
|
+
pkg.need_zip = true
|
76
|
+
pkg.need_tar = true
|
77
|
+
end
|
78
|
+
|
79
|
+
desc "Report code statistics (KLOCs, etc) from the application"
|
80
|
+
task :stats do
|
81
|
+
require 'code_statistics'
|
82
|
+
CodeStatistics.new(
|
83
|
+
["Library", "lib"],
|
84
|
+
["Units", "test"]
|
85
|
+
).to_s
|
86
|
+
end
|
87
|
+
|
88
|
+
desc "Publish new documentation"
|
89
|
+
task :publish do
|
90
|
+
`ssh rufy update-shipping-doc`
|
91
|
+
`scp pkg/shipping-1.0.0.* rufy:www/shipping.rufy.com/docs/`
|
92
|
+
Rake::RubyForgePublisher.new('shipping', 'cardmagic').upload
|
93
|
+
end
|
@@ -0,0 +1,323 @@
|
|
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::Base</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::Base</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/shipping/base_rb.html">
|
59
|
+
lib/shipping/base.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
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000006">fedex</a>
|
90
|
+
<a href="#M000005">new</a>
|
91
|
+
<a href="#M000007">ups</a>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
|
95
|
+
</div>
|
96
|
+
|
97
|
+
|
98
|
+
<!-- if includes -->
|
99
|
+
|
100
|
+
<div id="section">
|
101
|
+
|
102
|
+
|
103
|
+
<div id="constants-list">
|
104
|
+
<h3 class="section-bar">Constants</h3>
|
105
|
+
|
106
|
+
<div class="name-list">
|
107
|
+
<table summary="Constants">
|
108
|
+
<tr class="top-aligned-row context-row">
|
109
|
+
<td class="context-item-name">STATES</td>
|
110
|
+
<td>=</td>
|
111
|
+
<td class="context-item-value">{"al" => "alabama", "ne" => "nebraska", "ak" => "alaska", "nv" => "nevada", "az" => "arizona", "nh" => "new hampshire", "ar" => "arkansas", "nj" => "new jersey", "ca" => "california", "nm" => "new mexico", "co" => "colorado", "ny" => "new york", "ct" => "connecticut", "nc" => "north carolina", "de" => "delaware", "nd" => "north dakota", "fl" => "florida", "oh" => "ohio", "ga" => "georgia", "ok" => "oklahoma", "hi" => "hawaii", "or" => "oregon", "id" => "idaho", "pa" => "pennsylvania", "il" => "illinois", "pr" => "puerto rico", "in" => "indiana", "ri" => "rhode island", "ia" => "iowa", "sc" => "south carolina", "ks" => "kansas", "sd" => "south dakota", "ky" => "kentucky", "tn" => "tennessee", "la" => "louisiana", "tx" => "texas", "me" => "maine", "ut" => "utah", "md" => "maryland", "vt" => "vermont", "ma" => "massachusetts", "va" => "virginia", "mi" => "michigan", "wa" => "washington", "mn" => "minnesota", "dc" => "district of columbia", "ms" => "mississippi", "wv" => "west virginia", "mo" => "missouri", "wi" => "wisconsin", "mt" => "montana", "wy" => "wyoming"}</td>
|
112
|
+
</tr>
|
113
|
+
</table>
|
114
|
+
</div>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<div id="attribute-list">
|
120
|
+
<h3 class="section-bar">Attributes</h3>
|
121
|
+
|
122
|
+
<div class="name-list">
|
123
|
+
<table>
|
124
|
+
<tr class="top-aligned-row context-row">
|
125
|
+
<td class="context-item-name">city</td>
|
126
|
+
<td class="context-item-value"> [RW] </td>
|
127
|
+
<td class="context-item-desc"></td>
|
128
|
+
</tr>
|
129
|
+
<tr class="top-aligned-row context-row">
|
130
|
+
<td class="context-item-name">country</td>
|
131
|
+
<td class="context-item-value"> [RW] </td>
|
132
|
+
<td class="context-item-desc"></td>
|
133
|
+
</tr>
|
134
|
+
<tr class="top-aligned-row context-row">
|
135
|
+
<td class="context-item-name">data</td>
|
136
|
+
<td class="context-item-value"> [R] </td>
|
137
|
+
<td class="context-item-desc"></td>
|
138
|
+
</tr>
|
139
|
+
<tr class="top-aligned-row context-row">
|
140
|
+
<td class="context-item-name">declared_value</td>
|
141
|
+
<td class="context-item-value"> [RW] </td>
|
142
|
+
<td class="context-item-desc"></td>
|
143
|
+
</tr>
|
144
|
+
<tr class="top-aligned-row context-row">
|
145
|
+
<td class="context-item-name">fedex_account</td>
|
146
|
+
<td class="context-item-value"> [W] </td>
|
147
|
+
<td class="context-item-desc"></td>
|
148
|
+
</tr>
|
149
|
+
<tr class="top-aligned-row context-row">
|
150
|
+
<td class="context-item-name">fedex_meter</td>
|
151
|
+
<td class="context-item-value"> [W] </td>
|
152
|
+
<td class="context-item-desc"></td>
|
153
|
+
</tr>
|
154
|
+
<tr class="top-aligned-row context-row">
|
155
|
+
<td class="context-item-name">fedex_url</td>
|
156
|
+
<td class="context-item-value"> [W] </td>
|
157
|
+
<td class="context-item-desc"></td>
|
158
|
+
</tr>
|
159
|
+
<tr class="top-aligned-row context-row">
|
160
|
+
<td class="context-item-name">insured_value</td>
|
161
|
+
<td class="context-item-value"> [RW] </td>
|
162
|
+
<td class="context-item-desc"></td>
|
163
|
+
</tr>
|
164
|
+
<tr class="top-aligned-row context-row">
|
165
|
+
<td class="context-item-name">package_total</td>
|
166
|
+
<td class="context-item-value"> [RW] </td>
|
167
|
+
<td class="context-item-desc"></td>
|
168
|
+
</tr>
|
169
|
+
<tr class="top-aligned-row context-row">
|
170
|
+
<td class="context-item-name">packaging_type</td>
|
171
|
+
<td class="context-item-value"> [RW] </td>
|
172
|
+
<td class="context-item-desc"></td>
|
173
|
+
</tr>
|
174
|
+
<tr class="top-aligned-row context-row">
|
175
|
+
<td class="context-item-name">required</td>
|
176
|
+
<td class="context-item-value"> [R] </td>
|
177
|
+
<td class="context-item-desc"></td>
|
178
|
+
</tr>
|
179
|
+
<tr class="top-aligned-row context-row">
|
180
|
+
<td class="context-item-name">response</td>
|
181
|
+
<td class="context-item-value"> [R] </td>
|
182
|
+
<td class="context-item-desc"></td>
|
183
|
+
</tr>
|
184
|
+
<tr class="top-aligned-row context-row">
|
185
|
+
<td class="context-item-name">sender_city</td>
|
186
|
+
<td class="context-item-value"> [RW] </td>
|
187
|
+
<td class="context-item-desc"></td>
|
188
|
+
</tr>
|
189
|
+
<tr class="top-aligned-row context-row">
|
190
|
+
<td class="context-item-name">sender_country</td>
|
191
|
+
<td class="context-item-value"> [RW] </td>
|
192
|
+
<td class="context-item-desc"></td>
|
193
|
+
</tr>
|
194
|
+
<tr class="top-aligned-row context-row">
|
195
|
+
<td class="context-item-name">sender_state</td>
|
196
|
+
<td class="context-item-value"> [RW] </td>
|
197
|
+
<td class="context-item-desc"></td>
|
198
|
+
</tr>
|
199
|
+
<tr class="top-aligned-row context-row">
|
200
|
+
<td class="context-item-name">sender_zip</td>
|
201
|
+
<td class="context-item-value"> [RW] </td>
|
202
|
+
<td class="context-item-desc"></td>
|
203
|
+
</tr>
|
204
|
+
<tr class="top-aligned-row context-row">
|
205
|
+
<td class="context-item-name">service_type</td>
|
206
|
+
<td class="context-item-value"> [RW] </td>
|
207
|
+
<td class="context-item-desc"></td>
|
208
|
+
</tr>
|
209
|
+
<tr class="top-aligned-row context-row">
|
210
|
+
<td class="context-item-name">state</td>
|
211
|
+
<td class="context-item-value"> [RW] </td>
|
212
|
+
<td class="context-item-desc"></td>
|
213
|
+
</tr>
|
214
|
+
<tr class="top-aligned-row context-row">
|
215
|
+
<td class="context-item-name">transaction_type</td>
|
216
|
+
<td class="context-item-value"> [RW] </td>
|
217
|
+
<td class="context-item-desc"></td>
|
218
|
+
</tr>
|
219
|
+
<tr class="top-aligned-row context-row">
|
220
|
+
<td class="context-item-name">ups_account</td>
|
221
|
+
<td class="context-item-value"> [W] </td>
|
222
|
+
<td class="context-item-desc"></td>
|
223
|
+
</tr>
|
224
|
+
<tr class="top-aligned-row context-row">
|
225
|
+
<td class="context-item-name">ups_password</td>
|
226
|
+
<td class="context-item-value"> [W] </td>
|
227
|
+
<td class="context-item-desc"></td>
|
228
|
+
</tr>
|
229
|
+
<tr class="top-aligned-row context-row">
|
230
|
+
<td class="context-item-name">ups_user</td>
|
231
|
+
<td class="context-item-value"> [W] </td>
|
232
|
+
<td class="context-item-desc"></td>
|
233
|
+
</tr>
|
234
|
+
<tr class="top-aligned-row context-row">
|
235
|
+
<td class="context-item-name">weight</td>
|
236
|
+
<td class="context-item-value"> [RW] </td>
|
237
|
+
<td class="context-item-desc"></td>
|
238
|
+
</tr>
|
239
|
+
<tr class="top-aligned-row context-row">
|
240
|
+
<td class="context-item-name">weight_units</td>
|
241
|
+
<td class="context-item-value"> [RW] </td>
|
242
|
+
<td class="context-item-desc"></td>
|
243
|
+
</tr>
|
244
|
+
<tr class="top-aligned-row context-row">
|
245
|
+
<td class="context-item-name">zip</td>
|
246
|
+
<td class="context-item-value"> [RW] </td>
|
247
|
+
<td class="context-item-desc"></td>
|
248
|
+
</tr>
|
249
|
+
</table>
|
250
|
+
</div>
|
251
|
+
</div>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
<!-- if method_list -->
|
256
|
+
<div id="methods">
|
257
|
+
<h3 class="section-bar">Public Class methods</h3>
|
258
|
+
|
259
|
+
<div id="method-M000005" class="method-detail">
|
260
|
+
<a name="M000005"></a>
|
261
|
+
|
262
|
+
<div class="method-heading">
|
263
|
+
<a href="Base.src/M000005.html" target="Code" class="method-signature"
|
264
|
+
onclick="popupCode('Base.src/M000005.html');return false;">
|
265
|
+
<span class="method-name">new</span><span class="method-args">(options = {})</span>
|
266
|
+
</a>
|
267
|
+
</div>
|
268
|
+
|
269
|
+
<div class="method-description">
|
270
|
+
</div>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
274
|
+
|
275
|
+
<div id="method-M000006" class="method-detail">
|
276
|
+
<a name="M000006"></a>
|
277
|
+
|
278
|
+
<div class="method-heading">
|
279
|
+
<a href="Base.src/M000006.html" target="Code" class="method-signature"
|
280
|
+
onclick="popupCode('Base.src/M000006.html');return false;">
|
281
|
+
<span class="method-name">fedex</span><span class="method-args">()</span>
|
282
|
+
</a>
|
283
|
+
</div>
|
284
|
+
|
285
|
+
<div class="method-description">
|
286
|
+
<p>
|
287
|
+
Initializes an instance of <a href="FedEx.html">Shipping::FedEx</a> with
|
288
|
+
the same instance variables as the base object
|
289
|
+
</p>
|
290
|
+
</div>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
<div id="method-M000007" class="method-detail">
|
294
|
+
<a name="M000007"></a>
|
295
|
+
|
296
|
+
<div class="method-heading">
|
297
|
+
<a href="Base.src/M000007.html" target="Code" class="method-signature"
|
298
|
+
onclick="popupCode('Base.src/M000007.html');return false;">
|
299
|
+
<span class="method-name">ups</span><span class="method-args">()</span>
|
300
|
+
</a>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div class="method-description">
|
304
|
+
<p>
|
305
|
+
Initializes an instance of <a href="UPS.html">Shipping::UPS</a> with the
|
306
|
+
same instance variables as the base object
|
307
|
+
</p>
|
308
|
+
</div>
|
309
|
+
</div>
|
310
|
+
|
311
|
+
|
312
|
+
</div>
|
313
|
+
|
314
|
+
|
315
|
+
</div>
|
316
|
+
|
317
|
+
|
318
|
+
<div id="validator-badges">
|
319
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
320
|
+
</div>
|
321
|
+
|
322
|
+
</body>
|
323
|
+
</html>
|
@@ -0,0 +1,26 @@
|
|
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 20</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>
|
@@ -0,0 +1,18 @@
|
|
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 33</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>
|
@@ -0,0 +1,18 @@
|
|
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 38</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>
|