awesome_usps 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -2,3 +2,12 @@
2
2
 
3
3
  * 1 major enhancement:
4
4
  * Initial release
5
+
6
+ == 0.6.0 18/8/2008
7
+
8
+ * 2 major improvement
9
+ * Shipping parse fixed
10
+ * Documentation added
11
+ * 1 bug fixes
12
+ * Shipping canned tests fixed
13
+
data/License.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008 FIXME full name
1
+ Copyright (c) 2008 Matthew Bergman
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/PostInstall.txt CHANGED
@@ -1,7 +1,7 @@
1
+ To use Awesome! USPS in your app use require 'awesome_USPS' in your environment.rb or production.rb
1
2
 
2
3
  For more information on awesome_usps, see http://awesome_usps.rubyforge.org
3
4
 
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
5
+
6
6
 
7
7
 
data/README.txt CHANGED
@@ -26,7 +26,7 @@ FIX (describe your package)
26
26
 
27
27
  (The MIT License)
28
28
 
29
- Copyright (c) 2008 FIXME full name
29
+ Copyright (c) 2008 Matthew Bergman
30
30
 
31
31
  Permission is hereby granted, free of charge, to any person obtaining
32
32
  a copy of this software and associated documentation files (the
data/lib/awesome_usps.rb CHANGED
@@ -12,8 +12,7 @@ require 'awesome_usps/electric_merchandis_return'
12
12
  require 'awesome_usps/express_mail'
13
13
  require 'awesome_usps/address_verification'
14
14
  require 'awesome_usps/international_mail_labels'
15
-
16
-
15
+ include AwesomeUsps
17
16
 
18
17
  module AwesomeUsps
19
18
  class USPS
@@ -1,30 +1,17 @@
1
1
  module AwesomeUsps
2
2
  module Shipping
3
3
 
4
- MAX_RETRIES = 3
5
4
 
6
- ORIGIN_ZIP = "07024" #User should change this
5
+ MAX_RETRIES = 3
7
6
 
8
7
  LIVE_DOMAIN = 'production.shippingapis.com'
9
8
  LIVE_RESOURCE = '/ShippingAPI.dll'
10
9
 
11
- TEST_DOMAINS = { #indexed by security; e.g. TEST_DOMAINS[USE_SSL[:rates]]
12
- true => 'secure.shippingapis.com',
13
- false => 'testing.shippingapis.com'
14
- }
15
-
16
- TEST_RESOURCE = '/ShippingAPITest.dll'
17
-
18
10
  API_CODES = {
19
11
  :us_rates => 'RateV3',
20
12
  :world_rates => 'IntlRate',
21
- :test => 'CarrierPickupAvailability'
22
13
  }
23
14
 
24
- USE_SSL = {
25
- :tracking => false,
26
- :test => true
27
- }
28
15
  CONTAINERS = {
29
16
  :envelope => 'Flat Rate Envelope',
30
17
  :box => 'Flat Rate Box'
@@ -62,21 +49,12 @@ module AwesomeUsps
62
49
  :all => 'ALL'
63
50
  }
64
51
 
65
- #Determins size of package automatically. Taken from Active_Shipping
66
- def size_code_for(package)
67
- total = package.inches(:length) + package.inches(:girth)
68
- if total <= 84
69
- return 'REGULAR'
70
- elsif total <= 108
71
- return 'LARGE'
72
- else # <= 130
73
- return 'OVERSIZE'
74
- end
75
- end
76
52
 
77
53
  # options Are?
78
- def domestic_rates(destination_zip, packages, options={})
79
- @packages = Array(packages)
54
+ def domestic_rates(origin_zip, destination_zip, packages, options={})
55
+ @origin_zip = origin_zip
56
+ @packages = packages
57
+ Array(@packages) if not @packages.is_a? Array
80
58
  @destination_zip = destination_zip
81
59
  @options = options
82
60
  request = xml_for_us
@@ -85,14 +63,62 @@ module AwesomeUsps
85
63
 
86
64
  # options Are?
87
65
  def world_rates(country, packages, options={})
88
- @packages = Array(packages)
66
+ @packages = packages
67
+ Array(@packages) if not @packages.is_a? Array
89
68
  @country = country
90
69
  @options = options
91
70
  request = xml_for_world
92
71
  tracking_commit(:world_rates, request ,false)
93
72
  end
94
-
73
+
74
+ def canned_domestic_rates_test
75
+ @origin_zip = "07024"
76
+ @packages =[
77
+ Package.new( 100,
78
+ [93,10],
79
+ :cylinder => true),
80
+
81
+ Package.new( (7.5 * 16),
82
+ [15, 10, 4.5],
83
+ :units => :imperial)
84
+ ]
85
+ @destination_zip = "10010"
86
+ @options = {}
87
+ request = xml_for_us
88
+ tracking_commit(:us_rates, request ,false)
89
+ end
90
+
91
+
92
+ def canned_world_rates_test
93
+ @packages = [
94
+ Package.new( 100,
95
+ [93,10],
96
+ :cylinder => true),
97
+
98
+ Package.new( (7.5 * 16),
99
+ [15, 10, 4.5],
100
+ :units => :imperial)
101
+ ]
102
+ @country = "Japan"
103
+ @options ={}
104
+ request = xml_for_world
105
+ tracking_commit(:world_rates, request ,false)
106
+ end
107
+
95
108
  private
109
+
110
+ #Determins size of package automatically. Taken from Active_Shipping
111
+ def size_code_for(package)
112
+ total = package.inches(:length) + package.inches(:girth)
113
+ if total <= 84
114
+ return 'REGULAR'
115
+ elsif total <= 108
116
+ return 'LARGE'
117
+ else # <= 130
118
+ return 'OVERSIZE'
119
+ end
120
+ end
121
+
96
122
  # XML built with Build:XmlMarkup
97
123
  def xml_for_us
98
124
  xm = Builder::XmlMarkup.new
@@ -101,7 +127,7 @@ module AwesomeUsps
101
127
  p = @packages[id]
102
128
  xm.Package("ID" => "#{id}") {
103
129
  xm.Service("#{US_SERVICES[@options[:service]] || :all}")
104
- xm.ZipOrigination(ORIGIN_ZIP)
130
+ xm.ZipOrigination(@origin_zip)
105
131
  xm.ZipDestination(@destination_zip)
106
132
  xm.Pounds("0")
107
133
  xm.Ounces("#{'%0.1f' % [p.ounces,1].max}")
@@ -142,9 +168,10 @@ module AwesomeUsps
142
168
  # {Package1 =>{'First Class' => "1.90"}Package2 => {'First Class' => "26.90" }
143
169
 
144
170
  def parse_us(xml)
145
- domestic_rate_hash = Hash.new
146
- i= 0
171
+ i=0
172
+ domestic_rate_array = []
147
173
  Hpricot.parse(xml).search('package').each do |package|
174
+ h = {}
148
175
  i+=1
149
176
  #This will return the first error description found in response xml.
150
177
  #TODO find way to return all errors.
@@ -153,26 +180,27 @@ module AwesomeUsps
153
180
 
154
181
  return "package number #{i} has the error #{package.search("description").inner_html} please fix before continuing"
155
182
  end
156
- #Initializing hash for each package. Is there a better way I wonder.
157
- domestic_rate_hash["Package#{i}"] = {}
158
183
  #Going through each package and finding the rate.
159
184
  package.search("postage").each do |services|
185
+
160
186
  mailservice=services.search("mailservice")
161
187
  rate = services.search("rate")
162
- domestic_rate_hash["Package#{i}"][mailservice.inner_html] = rate.inner_html
188
+ h[mailservice.inner_html] = rate.inner_html
163
189
  end
190
+ domestic_rate_array << h
164
191
  end
165
- if domestic_rate_hash == {}
166
- domestic_rate_hash = Hpricot.parse(xml).search('description').inner_html
192
+ if domestic_rate_array == []
193
+ return Hpricot.parse(xml).search('description').inner_html
167
194
  end
168
- return domestic_rate_hash
195
+ return domestic_rate_array
169
196
  end
170
-
197
+
171
198
  def parse_world(xml)
172
- international_rate_hash = Hash.new
199
+ international_rate_array = []
173
200
  i= 0
174
201
  Hpricot.parse(xml).search('package').each do |package|
175
202
  i+=1
203
+ h = {}
176
204
  #This will return the first error description found in response xml.
177
205
  #TODO find way to return all errors.
178
206
  if package.search("error") != []
@@ -180,19 +208,20 @@ module AwesomeUsps
180
208
 
181
209
  return "package number #{i} has the error #{package.search("description").inner_html} please fix before continuing"
182
210
  end
183
- #Initializing hash for each package. Is there a better way I wonder.
184
- international_rate_hash["Package#{i}"] = {}
185
211
  #Going through each package and finding the rate.
186
212
  package.search("service").each do |services|
213
+
187
214
  svcdescription=services.search("svcdescription")
188
215
  rate = services.search("postage")
189
- international_rate_hash["Package#{i}"][svcdescription.inner_html] = rate.inner_html
216
+ h[svcdescription.inner_html] = rate.inner_html
217
+
190
218
  end
219
+ international_rate_array << h
191
220
  end
192
- if international_rate_hash == {}
193
- international_rate_hash = Hpricot.parse(xml).search('description').inner_html
221
+ if international_rate_array == []
222
+ return Hpricot.parse(xml).search('description').inner_html
194
223
  end
195
- return international_rate_hash
224
+ return international_rate_array
196
225
  end
197
226
 
198
227
  def tracking_commit(action, request, test = false)
@@ -202,8 +231,8 @@ module AwesomeUsps
202
231
  req = Net::HTTP::Post.new(url.path)
203
232
  req.set_form_data({'API' => API_CODES[action], 'XML' => request})
204
233
  response = Net::HTTP.new(url.host, url.port)
205
- response.open_timeout = 5
206
- response.read_timeout = 5
234
+ response.open_timeout = 2
235
+ response.read_timeout = 2
207
236
  response.start
208
237
  rescue Timeout::Error
209
238
  if retries > 0
@@ -233,4 +262,3 @@ module AwesomeUsps
233
262
  end
234
263
  end
235
264
  end
236
-
@@ -1,7 +1,7 @@
1
1
  module AwesomeUsps
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 5
4
+ MINOR = 6
5
5
  TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1></h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/awesome_usps"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/awesome_usps" class="numbers">0.5.0</a>
36
+ <a href="http://rubyforge.org/projects/awesome_usps" class="numbers">0.6.0</a>
37
37
  </div>
38
38
  <h1>Awesome! <span class="caps">USPS</span> <br/> &#x2192; &#8216;awesome_usps&#8217;</h1>
39
39
 
@@ -41,7 +41,7 @@
41
41
  <h2>What</h2>
42
42
 
43
43
 
44
- <p>A Ruby Wrapper for a variety of <span class="caps">USPS</span> APIs. Including Tracking and Rate calculation.</p>
44
+ <p>This library is meant to interface with the web services of <span class="caps">USPS</span>. It grew out of early dabbling of the <span class="caps">USPS</span>_Tracker plugin. The goal is to abstract the features that are most frequently used into a pleasant and consistent Ruby <span class="caps">API</span>. Awesome <span class="caps">USPS</span> started as an extension of Active Shipping but at the moment I am still struggling with how best to accomplish integration. While working on the problem I decided to release my current work as a gem for all to enjoy.</p>
45
45
 
46
46
 
47
47
  <h2>Installing</h2>
@@ -66,47 +66,406 @@
66
66
  <p>From there use how you like in your controllers.</p>
67
67
 
68
68
 
69
- <h2>Demonstration of usage</h2>
69
+ <h2>Prerequisites</h2>
70
70
 
71
71
 
72
- <h2>Forum</h2>
72
+ <p><a href="http://code.whytheluckystiff.net/hpricot/">Hrpicot</a> for parsing the <span class="caps">XML</span>. To install run sudo gem install Hpricot</p>
73
73
 
74
74
 
75
- <p><a href="http://groups.google.com/group/awesome_usps">http://groups.google.com/group/awesome_usps</a></p>
75
+ <p><a href="http://mocha.rubyforge.org/">Mocha</a> for the tests</p>
76
76
 
77
77
 
78
- <p><span class="caps">TODO</span> &#8211; create Google Group &#8211; awesome_usps</p>
78
+ <h2>Notice about using the <span class="caps">USPS</span> APIs</h2>
79
79
 
80
80
 
81
- <h2>How to submit patches</h2>
81
+ <p><span class="caps">USPS</span> can be a bit frustrating when starting working with them. First you must apply for a <span class="caps">USPS</span> web tools account
82
+ This will net you a <span class="caps">USPS</span> user name assigned by them and a password. The password is for older versions of their api so you do not need to concern yourself with it.
83
+ Secondly you only have accesses to the Testing Server. You should run one of the canned response to make sure everything is setup up correctly.</p>
82
84
 
83
85
 
84
- <p>You can fetch the source from either:</p>
86
+ <p>usps.canned_tracking</p>
87
+
88
+
89
+ <p>You should receive an array as a response.
90
+ From there you need to email <span class="caps">USPS</span> for your account to be changed over to production so you can send live data. This does not hold true for all their Api some of which require and additional level of clearance. See Below</p>
91
+
92
+
93
+ <h2>Notice on <span class="caps">USPS</span> Label APIs</h2>
94
+
95
+
96
+ <p><span class="caps">USPS</span> is kinda&#8230; bad with how they handle their various label creation APIs. Except for their Priority Mail&#174; Open and Distribute <span class="caps">API</span> you must make an additional email or call to their customer care center to have your permission turned on to send live data to the server. It is even more complicated if you wish to create your own labels with your company logo from their response xml. See their <span class="caps">API</span> documentation located at
97
+ for details on the procedure.</p>
98
+
99
+
100
+ <h2>Notice on Address Information APIs</h2>
101
+
102
+
103
+ <p>These APIs; Specifically Address Verify, Zip Lookup, and City State Lookup also need separate permission for use of live data.</p>
104
+
105
+
106
+ <h2>Canned Tests</h2>
107
+
108
+
109
+ <p>Because most of the <span class="caps">API</span>&#8217;s require an additional level of permission to use with live data every method has a canned test. They are both useful for integrating the returned data with your system and for testing that the library has not been compromised. A canned method follow this format. canned_method_name_test.</p>
110
+
111
+
112
+ <h2>Awesome <span class="caps">USPS</span> methods</h2>
113
+
114
+
115
+ <p><span class="caps">API</span> methods are as follow</p>
85
116
 
86
117
 
87
118
  <ul>
88
- <li>rubyforge: <span class="caps">MISSING IN ACTION</span></li>
119
+ <li>track</li>
120
+ <li>veryify_address</li>
121
+ <li>zip_lookup</li>
122
+ <li>city_state_lookup</li>
123
+ <li>delivery_confirmation_label</li>
124
+ <li>signature_confirmation_label</li>
125
+ <li>merch_return</li>
126
+ <li>express_mail</li>
127
+ <li>express_mail_international_label</li>
128
+ <li>priority_mail_international_label</li>
129
+ <li>first_class_international_label</li>
130
+ <li>open_distrubute_priority_label</li>
131
+ <li>priority_mail_estimated_time</li>
132
+ <li>standard_mail_estimated_time</li>
133
+ <li>domestic_rates</li>
134
+ <li>world_rates</li>
89
135
  </ul>
90
136
 
91
137
 
92
- <p><span class="caps">TODO</span> &#8211; You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
93
- yet to refresh your local rubyforge data with this projects&#8217; id information.</p>
138
+ <p>Object Methods are as follow</p>
139
+
140
+
141
+ <p>Package.new
142
+ Location.new
143
+ International Location #Only used in conjunction with international labels <span class="caps">API</span></p>
144
+
145
+
146
+ <h1 class="smallish">Sample Usage</h1>
147
+
148
+
149
+ <p>In your environment.rb or production.rb</p>
150
+
151
+
152
+ <pre>require 'active_shipping'</pre>
153
+
154
+ Then to access the plugin you much create an instance of <span class="caps">USPS</span> class
155
+
156
+ <pre> usps = USPS.new('Your user name')</pre>
157
+
158
+ <p>Package up a poster and a Wii for your nephew.<br/>
159
+ <small>Note the Package Module has been taken directly from Active Shipping. Thank you James MacAulay for developing such great code. </small></p>
160
+
161
+
162
+ <pre>packages = [
163
+ Package.new( 100, # 100 grams
164
+ [93,10], # 93 cm long, 10 cm diameter
165
+ :cylinder =&gt; true), # cylinders have different volume calculations
166
+ Package.new( (7.5 * 16), # 7.5 lbs, times 16 oz/lb.
167
+ [15, 10, 4.5], # 15x10x4.5 inches
168
+ :units =&gt; :imperial) # not grams, not centimetres
169
+ ]</pre>
170
+
171
+ <p>Create a location to use with the Api</p>
172
+
173
+
174
+ <pre>sender =Location.new(:name =&gt; "Matthew Bergman ",:first_name =&gt; "Matthew", :last_name =&gt; "Bergman",
175
+ :address1 =&gt; Apt 4m, :address2 =&gt; "1001 Pine Street",
176
+ :city =&gt; "New York", :state =&gt; "NY", :zip5 =&gt; "100010", :phone =&gt; "5555555555")</pre>
177
+
178
+ <p>International Item Class<br/>
179
+ <small>Only should be used in conjunction with the Internal Label Api </small>
180
+ <pre>
181
+ Items = [
182
+ InternationalItem.new(
183
+ :description =&gt; Pens",
184
+ :quantity =&gt; "50"
185
+ :value =&gt; 200.40, #Will be converted back to a float if entered as a string.
186
+ :ounces =&gt; "50",
187
+ :tariff_number =&gt; "Only use if known" #Optional input for the api.
188
+ :country =&gt; "United States")
189
+ InternationalItem.new(
190
+ :description =&gt; "Against The Day, Pynchon",
191
+ :quantity =&gt; "10"
192
+ :value =&gt; 100.25
193
+ :ounces =&gt; "250"
194
+ :country =&gt; "United States")
195
+ ]
196
+ </pre></p>
197
+
198
+
199
+ <h3>Note for working with Location Class</h3>
200
+
201
+
202
+ <p>The api is very quirky about how it handles addresses. :address1 is for inputing Apt or Suite numbers and nothing else.
203
+ Besides the obvious info, it can contain, :facility_type and :from_urbanization, which are used for specific APIs.</p>
204
+
205
+
206
+ <h2>To track a package</h2>
207
+
208
+
209
+ <pre>USPS.track("Tracking Number")
210
+ #This will return an array of tracking events example shown below
211
+
212
+ [{:eventzipcode=&gt;"33436", :event=&gt;"Arrival at Unit", :eventtime=&gt;"7:23 am", :eventdate=&gt;"June 14, 2008",
213
+ :eventcity=&gt;"BOYNTON BEACH", :eventstate=&gt;"FL"},
214
+ {:eventzipcode=&gt;"32862", :event=&gt;"Processed", :eventtime=&gt;"9:50 pm",
215
+ :eventdate=&gt;"June 13, 2008", :eventcity=&gt;"ORLANDO", :eventstate=&gt;"FL"},
216
+ {:eventzipcode=&gt;"07032", :event=&gt;"Processed", :eventtime=&gt;"1:19 am",
217
+ :eventdate=&gt;"June 13, 2008", :eventcity=&gt;"KEARNY", :eventstate=&gt;"NJ"},
218
+ {:eventzipcode=&gt;"07024", :event=&gt;"Acceptance", :eventtime=&gt;"3:03 pm", :eventdate=&gt;"June 12,
219
+ 2008", :eventcity=&gt;"FORT LEE", :eventstate=&gt;"NJ"}]
220
+
221
+ #Loop through and display as you wish
222
+ </pre>
223
+
224
+ <h2>To get rates for a single or group of packages.</h2>
225
+
226
+
227
+ <pre>#There are two APIs. One for domestic, the other for international packages.
228
+
229
+ USPS.domestic_rates(ZIP, Packages, options={})
230
+ USPS.world_rates(Country, Packages, options={})
231
+
232
+ #Both will return and array containg a hash of rates for each package.
233
+ #To access a rate hash for use you can do
234
+
235
+ array = USPS.world_rates(Country, Packages, options={})
236
+ array[0][Priority Mail International
237
+
238
+ #You can also loop through and sort
239
+ </pre>
94
240
 
241
+ <h2>Address Verification</h2>
95
242
 
96
- <p>When you do this, this message will magically disappear!</p>
97
243
 
244
+ <pre>#All methods here will take a location array of up to five address
98
245
 
99
- <p>Or you can hack website/index.txt and make it all go away!!</p>
246
+ #To verify an address and fill in missing information.
247
+ #If mulitple addresses were found for an address :verified =&gt; false
248
+
249
+ usps.veryify_address("locations array")
250
+
251
+ #Will fill in missing zip5 and zip4 for an address
252
+ usps.zipcode_lookup("location array")
253
+
254
+ #Will fill in missing City and State for an address
255
+ usps.city_state_lookup
256
+ </pre>
257
+
258
+ <h2>Service Standards</h2>
259
+
260
+
261
+ <pre>usps.priority_mail_estimated_time(origin, destination)
262
+
263
+ usps.standard_mail_estimated_time(origin, destination)
264
+
265
+ #Both of these methods returns a number for the amount of days a package will take to reach
266
+ #its destination.
267
+ </pre>
268
+
269
+ <h2>Express Mail Commitment</h2>
270
+
271
+
272
+ <pre>usps.express_mail_commitment(origin, destination, date=nil)
273
+
274
+ #returns a array of hashs containing commitment information. Example shown below
275
+ [{:state=&gt;"MD", :cutoff=&gt;"6:00 PM", :facility=&gt;"EXPRESS MAIL COLLECTION BOX", :zip=&gt;"20770",
276
+ :street=&gt;"119 CENTER WAY", :city=&gt;"GREENBELT"}, {:state=&gt;"MD", :cutoff=&gt;"3:00 PM",
277
+ :facility=&gt;"EXPRESS MAIL COLLECTION BOX", :zip=&gt;"20770", :street=&gt;"7500 GREENWAY CENTER DRIVE",
278
+ :city=&gt;"GREENBELT"}]
279
+ </pre>
280
+
281
+ <h1 class="smallish">Label APIs</h1>
282
+
283
+
284
+ <p>All label <span class="caps">API</span>&#8217;s generate a label image encoded via 64bit encryption. It must be decrypted by using
285
+ Base64.decode64(Image_file) to display correctly. The only choices for image_type right now are pdf and <span class="caps">TIFF</span>
286
+ An easy way to test and intergrate is to set up something along these lines in a controller.</p>
287
+
288
+
289
+ <pre>
290
+ def deliver_confirmation
291
+ image = USPS.new("XXXXXX").canned_delivery_confirmation_label_test
292
+ send_data Base64.decode64(image[:label]), :type =&gt; image[:image_type], :disposition =&gt; "inline"
293
+ end
294
+ </pre>
295
+
296
+ <p>All labels except for international labels take a straight name for their <span class="caps">XML</span>.
297
+ When using International label APIs you must include both a first and last name</p>
298
+
299
+
300
+ <h2>Delivery and Signature Label Creation</h2>
301
+
302
+
303
+ <pre>usps.delivery_confirmation_label(origin, destination, service_type, image_type, label_type=1, options={})
304
+ usps.signature_confirmation_label(origin, destination, service_type, image_type, label_type=1, options={})
305
+
306
+ #label_type can be set to 2 if you desire to create your own labels. No label will be generated for you,
307
+ #you simply will receive a confirmation label to use with the image you create.
308
+
309
+ #Option hash can contain
310
+
311
+ * :weight_in_ounces
312
+ * :seperate =&gt; puts the label directions on a seperate page.
313
+ * :po_zip_code =&gt; Post Offic zip code
314
+ * :label_date =&gt; Can be set up to four days in the future
315
+ * :customer_reference_number
316
+ * :address_service =&gt; ill be notified in the future if address has been changed
317
+ * :sender_name, :sender_email,
318
+ :recipient_name, :recipient_email =&gt; Used together to send an email to the recipient.
319
+
320
+ </pre>
321
+
322
+ <h2>Electronic Merchandise Return Label Creation</h2>
323
+
324
+
325
+ <pre>usps.merch_return(service_type, customer, retailer, permit_number,
326
+ post_office, postage_delivery_unit, ounces, image_type, options={})
327
+ #permit_number =&gt; Input permit number provided by your local post office.
328
+ #post_office =&gt; Location class of post office that issued the permit. Address not needed
329
+ #postage_delivery_unit =&gt; Location class for delivery unit you are sending the package to.
330
+
331
+ #Option hash can contain
332
+
333
+ * :confirmation =&gt; "Includes delivery confirmation with the label. To enable set to true"
334
+ * :insurance_value
335
+ * :rma =&gt; "Return Materials Authorization Number"
336
+ * :RMABarcode =&gt; "Will Render Barcode on Label if set to true and a RMA has been entered"
337
+ * :sender_name, :sender_email,
338
+ :recipient_name, :recipient_email =&gt; Used together to send an email to the recipient.
339
+
340
+ #Output hash contains postnet number and the cost for sending. Under :postnet and :cost respectively.
341
+ </pre>
342
+
343
+ <h2>Express Mail Label Creation</h2>
344
+
345
+
346
+ <pre>usps.express_mail_label(orgin, destination, ounces, image_type, options={})
347
+
348
+ #Option hash can contain
349
+
350
+ * :flat_rate =&gt; "Can be set to true if using flat rate envelopes"
351
+ * :standardize_address =&gt; "Verify Address"
352
+ * :waiver_signature =&gt; "No Signature Required for Delivery"
353
+ * :no_holiday =&gt; "Do not deliver on a holiday"
354
+ * :no_weekend
355
+ * :seperate =&gt; puts the label directions on a seperate page
356
+ * :po_zip_code
357
+ * :label_date =&gt; Can be set up to four days in the future
358
+ * :sender_name, :sender_email,
359
+ :recipient_name, :recipient_email =&gt; Used together to send an email to the recipient.
360
+
361
+ #Output hash contains postage cost for sending. Can be accessed by :postage
362
+ </pre>
363
+
364
+ <h2>International Mail Labels Creation</h2>
365
+
366
+
367
+ <pre>usps.express_mail_international_label(sender, receiver, items, image_type, po_box_flag ="N",
368
+ image_layout="ALLINONEFILE", label_type="1", options={})
369
+
370
+ usps.priority_mail_international_label(sender, receiver, items, image_type, po_box_flag ="N",
371
+ image_layout="ALLINONEFILE", label_type="1", options={})
372
+
373
+ usps.first_class_international_label(sender, receiver, items, image_type, po_box_flag ="N",
374
+ image_layout="ALLINONEFILE", label_type="1", options={})
375
+
376
+ #label_type can be set to 2 if you desire to create your own labels. No label will be generated for you,
377
+ #items =&gt; InternationalItem.new can be an array of objects or singular
378
+ #content_type =&gt; Options are "MERCHANDISE", "SAMPLE", "GIFT", "DOCUMENTS", "RETURN", "OTHER"
379
+ #If OTHER is selected content type must be described by :other =&gt; "Description" in the option hash.
380
+ #image_layout =&gt; "Allows for a few options"
381
+ #po_box_flag can be set to "Y" if items are being sent to a PO-Box
382
+
383
+ Option Hash for priority and express can contain
384
+
385
+ * :middle_initial =&gt; "middle initial of sender"
386
+ * :from_customs_reference
387
+ * :to_customs_reference
388
+ * :fax =&gt; "fax of receiver"
389
+ * :email =&gt; "email of receiver"
390
+ * :non_delivery_option =&gt; "Return, Reject, Abaddon. Defaults to abaddon."
391
+ * :alt_return_address1 =&gt; "used to explain where package goes
392
+ if delivery_option set to . Goes up to alt_return_address6"
393
+ * :alt_return_country
394
+ * :container =&gt; "VARIABLE or FLATRATEENV"
395
+ * :insurance_number
396
+ * :Postage =&gt; "If postage is already known. Will be caculated if left blank. "
397
+ * :other
398
+ * :comments
399
+ * :license_number
400
+ * :certificate_number
401
+ * :invoice_number
402
+ * :reference_number
403
+ * :po_zip_code
404
+ * :label_date =&gt; Can be set up to four days in the future
405
+ * :hold =&gt; "Hold for manifest"
406
+ Option Hash for first_class can contain
407
+ * :middle_initial =&gt; "middle initial of sender"
408
+ * :from_customs_reference
409
+ * :to_customs_reference
410
+ * :fax =&gt; "fax of receiver"
411
+ * :email =&gt; "email of receiver"
412
+ * :first_class_mail_type
413
+ * :machinable =&gt; "True or False"
414
+ * :other
415
+ * :comments
416
+ * :label_date =&gt; Can be set up to four days in the future
417
+ * :hold =&gt; "Hold for manifest"
418
+
419
+ #Output hash contains postage cost, total value of all items, SDRValue and the Bar code number.
420
+ #Can be access :postage, :totalvalue, :sdrvalue, and :barcodenumber respectively.
421
+ </pre>
422
+
423
+ <h2>Open Distribute Priority Label Creation</h2>
424
+
425
+
426
+ <pre>#TODO a good description for what Open Distribute Priority actually means
427
+ usps.open_distrubute_priority_label(orgin, destination,
428
+ package_weight_in_ounces, mail_type, image_type, label_type=1, options={})
429
+
430
+ #label_type can be set to 2 if you desire to create your own labels. No label will be generated for you,
431
+ #you simply will receive a confirmation label to use with the image you create.
432
+ #destination class must contain :facility_type, See API Document for explination of the different types
433
+ #mail_type can be be, "Letters", "Flats", "Parcels", "Mixed" or "Other"
434
+ #If other is chosen it must be described in the option hash via :other =&gt; "Description"
435
+
436
+ #Option has can contain
437
+ * :permit_number =&gt; "Issued by Post Office"
438
+ * :permit_zip =&gt; "Zip of Post Office that issued permit. Must be included if using :permit_number"
439
+ * :po_zip_code
440
+ * :other
441
+ * :no_weekend
442
+ * :seperate =&gt; puts the label directions on a seperate page
443
+ * :label_date =&gt; Can be set up to four days in the future
444
+ </pre>
445
+
446
+ <h2>Forum</h2>
447
+
448
+
449
+ <p><a href="http://groups.google.com/group/awesome_usps">http://groups.google.com/group/awesome_usps</a></p>
450
+
451
+
452
+ <p><span class="caps">TODO</span> &#8211; create Google Group &#8211; awesome_usps</p>
453
+
454
+
455
+ <h2>How to submit patches</h2>
456
+
457
+
458
+ <p>You can fetch the source from either:</p>
100
459
 
101
460
 
102
461
  <ul>
103
- <li>github: <a href="http://github.com/fotoverite/awesome_usps/tree/master">http://github.com/fotoverite/awesome_usps/tree/master</a></li>
462
+ <li>rubyforge: <a href="http://rubyforge.org/scm/?group_id=6811">http://rubyforge.org/scm/?group_id=6811</a></li>
104
463
  </ul>
105
464
 
106
465
 
107
- <pre>git clone git://github.com/fotoverite/awesome_usps.git</pre>
466
+ <pre>git clone git://rubyforge.org/awesome_usps.git</pre>
108
467
 
109
- <p><span class="caps">TODO</span> &#8211; add &#8220;github_username: username&#8221; to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.</p>
468
+ <p>or</p>
110
469
 
111
470
 
112
471
  <ul>
@@ -134,7 +493,7 @@ rake install_gem</pre>
134
493
 
135
494
  <p>Comments are welcome. Send an email to <a href="mailto:Fotoverite">Matthew Bergman</a> email via the <a href="http://groups.google.com/group/awesome_usps">forum</a></p>
136
495
  <p class="coda">
137
- <a href="FIXME email">FIXME full name</a>, 15th August 2008<br>
496
+ <a href="FotoVerite@gmail.com">Matthew Bergman</a>, 16th August 2008<br>
138
497
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
139
498
  </p>
140
499
  </div>
data/website/index.txt CHANGED
@@ -5,7 +5,7 @@ h1. Awesome! USPS <br/> &#x2192; 'awesome_usps'
5
5
 
6
6
  h2. What
7
7
 
8
- A Ruby Wrapper for a variety of USPS APIs. Including Tracking and Rate calculation.
8
+ This library is meant to interface with the web services of USPS. It grew out of early dabbling of the USPS_Tracker plugin. The goal is to abstract the features that are most frequently used into a pleasant and consistent Ruby API. Awesome USPS started as an extension of Active Shipping but at the moment I am still struggling with how best to accomplish integration. While working on the problem I decided to release my current work as a gem for all to enjoy.
9
9
 
10
10
  h2. Installing
11
11
 
@@ -23,46 +23,359 @@ Create an instance of the USPS class in your application.rb
23
23
 
24
24
  From there use how you like in your controllers.
25
25
 
26
- h2. Demonstration of usage
26
+ h2. Prerequisites
27
27
 
28
+ "Hrpicot":http://code.whytheluckystiff.net/hpricot/ for parsing the XML. To install run sudo gem install Hpricot
28
29
 
30
+ "Mocha":http://mocha.rubyforge.org/ for the tests
29
31
 
30
- h2. Forum
32
+ h2. Notice about using the USPS APIs
31
33
 
32
- "http://groups.google.com/group/awesome_usps":http://groups.google.com/group/awesome_usps
34
+ USPS can be a bit frustrating when starting working with them. First you must apply for a USPS web tools account
35
+ This will net you a USPS user name assigned by them and a password. The password is for older versions of their api so you do not need to concern yourself with it.
36
+ Secondly you only have accesses to the Testing Server. You should run one of the canned response to make sure everything is setup up correctly.
33
37
 
34
- TODO - create Google Group - awesome_usps
38
+ usps.canned_tracking
35
39
 
36
- h2. How to submit patches
40
+ You should receive an array as a response.
41
+ From there you need to email USPS for your account to be changed over to production so you can send live data. This does not hold true for all their Api some of which require and additional level of clearance. See Below
37
42
 
38
- You can fetch the source from either:
43
+ h2. Notice on USPS Label APIs
39
44
 
40
- <% if rubyforge_project_id %>
45
+ USPS is kinda... bad with how they handle their various label creation APIs. Except for their Priority Mail(R) Open and Distribute API you must make an additional email or call to their customer care center to have your permission turned on to send live data to the server. It is even more complicated if you wish to create your own labels with your company logo from their response xml. See their API documentation located at
46
+ [http://www.http://www.usps.com/webtools/htm/Delivery-Confirmation.htm]:http://www.usps.com/webtools/htm/Delivery-Confirmation.htm for details on the procedure.
41
47
 
42
- * rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
48
+ h2. Notice on Address Information APIs
43
49
 
44
- <pre>git clone git://rubyforge.org/awesome_usps.git</pre>
50
+ These APIs; Specifically Address Verify, Zip Lookup, and City State Lookup also need separate permission for use of live data.
51
+
52
+ h2. Canned Tests
53
+
54
+ Because most of the API's require an additional level of permission to use with live data every method has a canned test. They are both useful for integrating the returned data with your system and for testing that the library has not been compromised. A canned method follow this format. canned_method_name_test.
55
+
56
+ h2. Awesome USPS methods
57
+
58
+ API methods are as follow
59
+
60
+ * track
61
+ * veryify_address
62
+ * zip_lookup
63
+ * city_state_lookup
64
+ * delivery_confirmation_label
65
+ * signature_confirmation_label
66
+ * merch_return
67
+ * express_mail
68
+ * express_mail_international_label
69
+ * priority_mail_international_label
70
+ * first_class_international_label
71
+ * open_distrubute_priority_label
72
+ * priority_mail_estimated_time
73
+ * standard_mail_estimated_time
74
+ * domestic_rates
75
+ * world_rates
76
+
77
+ Object Methods are as follow
78
+
79
+ Package.new
80
+ Location.new
81
+ International Location #Only used in conjunction with international labels API
82
+
83
+ h1(smallish). Sample Usage
84
+
85
+ In your environment.rb or production.rb
86
+
87
+ <pre>require 'active_shipping'</pre>
88
+
89
+ Then to access the plugin you much create an instance of USPS class
90
+
91
+ <pre> usps = USPS.new('Your user name')</pre>
92
+
93
+ Package up a poster and a Wii for your nephew.<br/>
94
+ <small>Note the Package Module has been taken directly from Active Shipping. Thank you James MacAulay for developing such great code. </small>
95
+
96
+ <pre>packages = [
97
+ Package.new( 100, # 100 grams
98
+ [93,10], # 93 cm long, 10 cm diameter
99
+ :cylinder => true), # cylinders have different volume calculations
100
+ Package.new( (7.5 * 16), # 7.5 lbs, times 16 oz/lb.
101
+ [15, 10, 4.5], # 15x10x4.5 inches
102
+ :units => :imperial) # not grams, not centimetres
103
+ ]</pre>
104
+
105
+ Create a location to use with the Api
106
+
107
+ <pre>sender =Location.new(:name => "Matthew Bergman ",:first_name => "Matthew", :last_name => "Bergman",
108
+ :address1 => Apt 4m, :address2 => "1001 Pine Street",
109
+ :city => "New York", :state => "NY", :zip5 => "100010", :phone => "5555555555")</pre>
110
+
111
+ International Item Class<br/>
112
+ <small>Only should be used in conjunction with the Internal Label Api </small>
113
+ <pre>
114
+ Items = [
115
+ InternationalItem.new(
116
+ :description => Pens",
117
+ :quantity => "50"
118
+ :value => 200.40, #Will be converted back to a float if entered as a string.
119
+ :ounces => "50",
120
+ :tariff_number => "Only use if known" #Optional input for the api.
121
+ :country => "United States")
122
+ InternationalItem.new(
123
+ :description => "Against The Day, Pynchon",
124
+ :quantity => "10"
125
+ :value => 100.25
126
+ :ounces => "250"
127
+ :country => "United States")
128
+ ]
129
+ </pre>
45
130
 
46
- <% else %>
131
+ h3. Note for working with Location Class
47
132
 
48
- * rubyforge: MISSING IN ACTION
133
+ The api is very quirky about how it handles addresses. :address1 is for inputing Apt or Suite numbers and nothing else.
134
+ Besides the obvious info, it can contain, :facility_type and :from_urbanization, which are used for specific APIs.
49
135
 
50
- TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
51
- yet to refresh your local rubyforge data with this projects' id information.
136
+ h2. To track a package
52
137
 
53
- When you do this, this message will magically disappear!
138
+ <pre>USPS.track("Tracking Number")
139
+ #This will return an array of tracking events example shown below
54
140
 
55
- Or you can hack website/index.txt and make it all go away!!
141
+ [{:eventzipcode=>"33436", :event=>"Arrival at Unit", :eventtime=>"7:23 am", :eventdate=>"June 14, 2008",
142
+ :eventcity=>"BOYNTON BEACH", :eventstate=>"FL"},
143
+ {:eventzipcode=>"32862", :event=>"Processed", :eventtime=>"9:50 pm",
144
+ :eventdate=>"June 13, 2008", :eventcity=>"ORLANDO", :eventstate=>"FL"},
145
+ {:eventzipcode=>"07032", :event=>"Processed", :eventtime=>"1:19 am",
146
+ :eventdate=>"June 13, 2008", :eventcity=>"KEARNY", :eventstate=>"NJ"},
147
+ {:eventzipcode=>"07024", :event=>"Acceptance", :eventtime=>"3:03 pm", :eventdate=>"June 12,
148
+ 2008", :eventcity=>"FORT LEE", :eventstate=>"NJ"}]
56
149
 
57
- <% end %>
150
+ #Loop through and display as you wish
151
+ </pre>
58
152
 
59
- * github: "http://github.com/fotoverite/awesome_usps/tree/master":http://github.com/fotoverite/awesome_usps/tree/master
153
+ h2. To get rates for a single or group of packages.
60
154
 
61
- <pre>git clone git://github.com/fotoverite/awesome_usps.git</pre>
155
+ <pre>#There are two APIs. One for domestic, the other for international packages.
156
+
157
+ USPS.domestic_rates(ZIP, Packages, options={})
158
+ USPS.world_rates(Country, Packages, options={})
159
+
160
+ #Both will return and array containg a hash of rates for each package.
161
+ #To access a rate hash for use you can do
162
+
163
+ array = USPS.world_rates(Country, Packages, options={})
164
+ array[0][Priority Mail International
62
165
 
166
+ #You can also loop through and sort
167
+ </pre>
63
168
 
64
- TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
169
+ h2. Address Verification
65
170
 
171
+ <pre>#All methods here will take a location array of up to five address
172
+
173
+ #To verify an address and fill in missing information.
174
+ #If mulitple addresses were found for an address :verified => false
175
+
176
+ usps.veryify_address("locations array")
177
+
178
+ #Will fill in missing zip5 and zip4 for an address
179
+ usps.zipcode_lookup("location array")
180
+
181
+ #Will fill in missing City and State for an address
182
+ usps.city_state_lookup
183
+ </pre>
184
+
185
+ h2. Service Standards
186
+
187
+ <pre>usps.priority_mail_estimated_time(origin, destination)
188
+
189
+ usps.standard_mail_estimated_time(origin, destination)
190
+
191
+ #Both of these methods returns a number for the amount of days a package will take to reach
192
+ #its destination.
193
+ </pre>
194
+
195
+ h2. Express Mail Commitment
196
+
197
+ <pre>usps.express_mail_commitment(origin, destination, date=nil)
198
+
199
+ #returns a array of hashs containing commitment information. Example shown below
200
+ [{:state=>"MD", :cutoff=>"6:00 PM", :facility=>"EXPRESS MAIL COLLECTION BOX", :zip=>"20770",
201
+ :street=>"119 CENTER WAY", :city=>"GREENBELT"}, {:state=>"MD", :cutoff=>"3:00 PM",
202
+ :facility=>"EXPRESS MAIL COLLECTION BOX", :zip=>"20770", :street=>"7500 GREENWAY CENTER DRIVE",
203
+ :city=>"GREENBELT"}]
204
+ </pre>
205
+
206
+ h1(smallish). Label APIs
207
+
208
+ All label API's generate a label image encoded via 64bit encryption. It must be decrypted by using
209
+ Base64.decode64(Image_file) to display correctly. The only choices for image_type right now are pdf and TIFF
210
+ An easy way to test and intergrate is to set up something along these lines in a controller.
211
+
212
+ <pre>
213
+ def deliver_confirmation
214
+ image = USPS.new("XXXXXX").canned_delivery_confirmation_label_test
215
+ send_data Base64.decode64(image[:label]), :type => image[:image_type], :disposition => "inline"
216
+ end
217
+ </pre>
218
+
219
+ All labels except for international labels take a straight name for their XML.
220
+ When using International label APIs you must include both a first and last name
221
+
222
+ h2. Delivery and Signature Label Creation
223
+
224
+ <pre>usps.delivery_confirmation_label(origin, destination, service_type, image_type, label_type=1, options={})
225
+ usps.signature_confirmation_label(origin, destination, service_type, image_type, label_type=1, options={})
226
+
227
+ #label_type can be set to 2 if you desire to create your own labels. No label will be generated for you,
228
+ #you simply will receive a confirmation label to use with the image you create.
229
+
230
+ #Option hash can contain
231
+
232
+ * :weight_in_ounces
233
+ * :seperate => puts the label directions on a seperate page.
234
+ * :po_zip_code => Post Offic zip code
235
+ * :label_date => Can be set up to four days in the future
236
+ * :customer_reference_number
237
+ * :address_service => ill be notified in the future if address has been changed
238
+ * :sender_name, :sender_email,
239
+ :recipient_name, :recipient_email => Used together to send an email to the recipient.
240
+
241
+ </pre>
242
+
243
+ h2. Electronic Merchandise Return Label Creation
244
+
245
+ <pre>usps.merch_return(service_type, customer, retailer, permit_number,
246
+ post_office, postage_delivery_unit, ounces, image_type, options={})
247
+ #permit_number => Input permit number provided by your local post office.
248
+ #post_office => Location class of post office that issued the permit. Address not needed
249
+ #postage_delivery_unit => Location class for delivery unit you are sending the package to.
250
+
251
+ #Option hash can contain
252
+
253
+ * :confirmation => "Includes delivery confirmation with the label. To enable set to true"
254
+ * :insurance_value
255
+ * :rma => "Return Materials Authorization Number"
256
+ * :RMABarcode => "Will Render Barcode on Label if set to true and a RMA has been entered"
257
+ * :sender_name, :sender_email,
258
+ :recipient_name, :recipient_email => Used together to send an email to the recipient.
259
+
260
+ #Output hash contains postnet number and the cost for sending. Under :postnet and :cost respectively.
261
+ </pre>
262
+
263
+ h2. Express Mail Label Creation
264
+
265
+ <pre>usps.express_mail_label(orgin, destination, ounces, image_type, options={})
266
+
267
+ #Option hash can contain
268
+
269
+ * :flat_rate => "Can be set to true if using flat rate envelopes"
270
+ * :standardize_address => "Verify Address"
271
+ * :waiver_signature => "No Signature Required for Delivery"
272
+ * :no_holiday => "Do not deliver on a holiday"
273
+ * :no_weekend
274
+ * :seperate => puts the label directions on a seperate page
275
+ * :po_zip_code
276
+ * :label_date => Can be set up to four days in the future
277
+ * :sender_name, :sender_email,
278
+ :recipient_name, :recipient_email => Used together to send an email to the recipient.
279
+
280
+ #Output hash contains postage cost for sending. Can be accessed by :postage
281
+ </pre>
282
+
283
+ h2. International Mail Labels Creation
284
+
285
+ <pre>usps.express_mail_international_label(sender, receiver, items, image_type, po_box_flag ="N",
286
+ image_layout="ALLINONEFILE", label_type="1", options={})
287
+
288
+ usps.priority_mail_international_label(sender, receiver, items, image_type, po_box_flag ="N",
289
+ image_layout="ALLINONEFILE", label_type="1", options={})
290
+
291
+ usps.first_class_international_label(sender, receiver, items, image_type, po_box_flag ="N",
292
+ image_layout="ALLINONEFILE", label_type="1", options={})
293
+
294
+ #label_type can be set to 2 if you desire to create your own labels. No label will be generated for you,
295
+ #items => InternationalItem.new can be an array of objects or singular
296
+ #content_type => Options are "MERCHANDISE", "SAMPLE", "GIFT", "DOCUMENTS", "RETURN", "OTHER"
297
+ #If OTHER is selected content type must be described by :other => "Description" in the option hash.
298
+ #image_layout => "Allows for a few options"
299
+ #po_box_flag can be set to "Y" if items are being sent to a PO-Box
300
+
301
+ Option Hash for priority and express can contain
302
+
303
+ * :middle_initial => "middle initial of sender"
304
+ * :from_customs_reference
305
+ * :to_customs_reference
306
+ * :fax => "fax of receiver"
307
+ * :email => "email of receiver"
308
+ * :non_delivery_option => "Return, Reject, Abaddon. Defaults to abaddon."
309
+ * :alt_return_address1 => "used to explain where package goes
310
+ if delivery_option set to . Goes up to alt_return_address6"
311
+ * :alt_return_country
312
+ * :container => "VARIABLE or FLATRATEENV"
313
+ * :insurance_number
314
+ * :Postage => "If postage is already known. Will be caculated if left blank. "
315
+ * :other
316
+ * :comments
317
+ * :license_number
318
+ * :certificate_number
319
+ * :invoice_number
320
+ * :reference_number
321
+ * :po_zip_code
322
+ * :label_date => Can be set up to four days in the future
323
+ * :hold => "Hold for manifest"
324
+ Option Hash for first_class can contain
325
+ * :middle_initial => "middle initial of sender"
326
+ * :from_customs_reference
327
+ * :to_customs_reference
328
+ * :fax => "fax of receiver"
329
+ * :email => "email of receiver"
330
+ * :first_class_mail_type
331
+ * :machinable => "True or False"
332
+ * :other
333
+ * :comments
334
+ * :label_date => Can be set up to four days in the future
335
+ * :hold => "Hold for manifest"
336
+
337
+ #Output hash contains postage cost, total value of all items, SDRValue and the Bar code number.
338
+ #Can be access :postage, :totalvalue, :sdrvalue, and :barcodenumber respectively.
339
+ </pre>
340
+
341
+ h2. Open Distribute Priority Label Creation
342
+
343
+ <pre>#TODO a good description for what Open Distribute Priority actually means
344
+ usps.open_distrubute_priority_label(orgin, destination,
345
+ package_weight_in_ounces, mail_type, image_type, label_type=1, options={})
346
+
347
+ #label_type can be set to 2 if you desire to create your own labels. No label will be generated for you,
348
+ #you simply will receive a confirmation label to use with the image you create.
349
+ #destination class must contain :facility_type, See API Document for explination of the different types
350
+ #mail_type can be be, "Letters", "Flats", "Parcels", "Mixed" or "Other"
351
+ #If other is chosen it must be described in the option hash via :other => "Description"
352
+
353
+ #Option has can contain
354
+ * :permit_number => "Issued by Post Office"
355
+ * :permit_zip => "Zip of Post Office that issued permit. Must be included if using :permit_number"
356
+ * :po_zip_code
357
+ * :other
358
+ * :no_weekend
359
+ * :seperate => puts the label directions on a seperate page
360
+ * :label_date => Can be set up to four days in the future
361
+ </pre>
362
+
363
+
364
+ h2. Forum
365
+
366
+ "http://groups.google.com/group/awesome_usps":http://groups.google.com/group/awesome_usps
367
+
368
+ TODO - create Google Group - awesome_usps
369
+
370
+ h2. How to submit patches
371
+
372
+ You can fetch the source from either:
373
+
374
+ * rubyforge: "http://rubyforge.org/scm/?group_id=6811":http://rubyforge.org/scm/?group_id=6811
375
+
376
+ <pre>git clone git://rubyforge.org/awesome_usps.git</pre>
377
+
378
+ or
66
379
 
67
380
  * gitorious: "git://gitorious.org/awesome_usps/mainline.git":git://gitorious.org/awesome_usps/mainline.git
68
381
 
@@ -74,7 +387,6 @@ h3. Build and test instructions
74
387
  rake test
75
388
  rake install_gem</pre>
76
389
 
77
-
78
390
  h2. License
79
391
 
80
392
  This code is free to use under the terms of the MIT license.
@@ -1,13 +1,13 @@
1
1
  body {
2
- background-color: #E1D1F1;
2
+ background-color: #D8E2F9;
3
3
  font-family: "Georgia", sans-serif;
4
4
  font-size: 16px;
5
5
  line-height: 1.6em;
6
6
  padding: 1.6em 0 0 0;
7
- color: #333;
7
+ color: #000;
8
8
  }
9
9
  h1, h2, h3, h4, h5, h6 {
10
- color: #444;
10
+ color: #43324C;
11
11
  }
12
12
  h1 {
13
13
  font-family: sans-serif;
@@ -17,6 +17,17 @@ h1 {
17
17
  letter-spacing: -0.1ex;
18
18
  margin: 5px;
19
19
  }
20
+
21
+ small {
22
+
23
+ color:#0017FF;
24
+ }
25
+ .smallish
26
+ {
27
+ font-family: serif;
28
+ font-size:3em;
29
+ padding:5px 0 5px 0;
30
+ }
20
31
  li {
21
32
  padding: 0;
22
33
  margin: 0;
@@ -24,7 +35,7 @@ li {
24
35
  }
25
36
  a {
26
37
  color: #5E5AFF;
27
- background-color: #DAC;
38
+ background-color: #A5DDD2;
28
39
  font-weight: normal;
29
40
  text-decoration: underline;
30
41
  }
@@ -37,9 +48,12 @@ blockquote {
37
48
  .caps {
38
49
  font-size: 80%;
39
50
  }
51
+ span.caps, h2.caps, h3.caps {
52
+ font-size:100%;
53
+ }
40
54
 
41
55
  #main {
42
- width: 45em;
56
+ width: 900px;
43
57
  padding: 0;
44
58
  margin: 0 auto;
45
59
  }
@@ -81,9 +95,11 @@ pre, code {
81
95
  font-family: monospace;
82
96
  font-size: 90%;
83
97
  line-height: 1.4em;
84
- color: #ff8;
85
- background-color: #111;
98
+ color: #FFE26B;
99
+ background-color: #000;
86
100
  padding: 2px 10px 2px 10px;
101
+ border: 1px solid #ECDF2A;
102
+ padding:15px 5px 15px 10px;
87
103
  }
88
104
  .comment { color: #aaa; font-style: italic; }
89
105
  .keyword { color: #eff; font-weight: bold; }
@@ -101,12 +117,12 @@ pre, code {
101
117
  text-align: right;
102
118
  font-family: sans-serif;
103
119
  font-weight: normal;
104
- background-color: #B3ABFF;
120
+ background-color: #b3abff;
105
121
  color: #141331;
106
122
  padding: 15px 20px 10px 20px;
107
123
  margin: 0 auto;
108
124
  margin-top: 15px;
109
- border: 3px solid #141331;
125
+ border: 3px solid #F1C129;
110
126
  }
111
127
 
112
128
  #version .numbers {
@@ -37,7 +37,7 @@
37
37
  </div>
38
38
  <%= body %>
39
39
  <p class="coda">
40
- <a href="FIXME email">FIXME full name</a>, <%= modified.pretty %><br>
40
+ <a href="FotoVerite@gmail.com">Matthew Bergman</a>, <%= modified.pretty %><br>
41
41
  Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
42
42
  </p>
43
43
  </div>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awesome_usps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Bergman
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-08-15 00:00:00 -04:00
12
+ date: 2008-08-17 00:00:00 -04:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -77,11 +77,11 @@ files:
77
77
  has_rdoc: true
78
78
  homepage: http://awesome-usps.rubyforge.org
79
79
  post_install_message: |+
80
+ To use Awesome! USPS in your app use require 'awesome_USPS' in your environment.rb or production.rb
80
81
 
81
82
  For more information on awesome_usps, see http://awesome_usps.rubyforge.org
82
83
 
83
- NOTE: Change this information in PostInstall.txt
84
- You can also delete it if you don't want it.
84
+
85
85
 
86
86
 
87
87
  rdoc_options: