binarylogic-shippinglogic 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.rdoc CHANGED
@@ -1,3 +1,7 @@
1
+ == 1.0.4 released 2009-07-08
2
+
3
+ * Added state code mapping so that we can pass full state names and have it convert it to a FedEx friendly code behind the scenes.
4
+
1
5
  == 1.0.3 released 2009-07-08
2
6
 
3
7
  * Rails uses United States not United State of America
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :minor: 0
3
- :patch: 3
3
+ :patch: 4
4
4
  :major: 1
@@ -264,6 +264,67 @@ module Shippinglogic
264
264
  RAILS_COUNTRY_CODES = {
265
265
  "United States" => "US"
266
266
  }
267
+
268
+ STATE_CODES = {
269
+ "Alabama" => "AL",
270
+ "Alaska" => "AK",
271
+ "America Samoa" => "AS",
272
+ "Arizona" => "AZ",
273
+ "Arkansas" => "AR",
274
+ "California" => "CA",
275
+ "Colorado" => "CO",
276
+ "Connecticut" => "CT",
277
+ "Delaware" => "DE",
278
+ "District of Columbia" => "DC",
279
+ "Florida" => "FL",
280
+ "Georgia" => "GA",
281
+ "Guam" => "GU",
282
+ "Hawaii" => "HI",
283
+ "Idaho" => "ID",
284
+ "Illinois" => "IL",
285
+ "Indiana" => "IN",
286
+ "Iowa" => "IA",
287
+ "Islands1" => "MH",
288
+ "Kansas" => "KS",
289
+ "Kentucky" => "KY",
290
+ "Louisiana" => "LA",
291
+ "Maine" => "ME",
292
+ "Maryland" => "MD",
293
+ "Massachusetts" => "MA",
294
+ "Michigan" => "MI",
295
+ "Micronesia1" => "FM",
296
+ "Minnesota" => "MN",
297
+ "Mississippi" => "MS",
298
+ "Missouri" => "MO",
299
+ "Montana" => "MT",
300
+ "Nebraska" => "NE",
301
+ "Nevada" => "NV",
302
+ "New Hampshire" => "NH",
303
+ "New Jersey" => "NJ",
304
+ "New Mexico" => "NM",
305
+ "New York" => "NY",
306
+ "North Carolina" => "NC",
307
+ "North Dakota" => "ND",
308
+ "Ohio" => "OH",
309
+ "Oklahoma" => "OK",
310
+ "Oregon" => "OR",
311
+ "Palau" => "PW",
312
+ "Pennsylvania" => "PA",
313
+ "Puerto Rico" => "PR",
314
+ "Rhode Island" => "RI",
315
+ "South Carolina" => "SC",
316
+ "South Dakota" => "SD",
317
+ "Tennessee" => "TN",
318
+ "Texas" => "TX",
319
+ "Utah" => "UT",
320
+ "Vermont" => "VT",
321
+ "Virgin Island" => "VI",
322
+ "Virginia" => "VA",
323
+ "Washington" => "WA",
324
+ "West Virginia" => "WV",
325
+ "Wisconsin" => "WI",
326
+ "Wyoming" => "WY",
327
+ }
267
328
  end
268
329
  end
269
330
  end
@@ -57,7 +57,7 @@ module Shippinglogic
57
57
  b.Address do
58
58
  b.StreetLines send("#{type}_streets") if send("#{type}_streets")
59
59
  b.City send("#{type}_city") if send("#{type}_city")
60
- b.StateOrProvinceCode send("#{type}_state") if send("#{type}_state")
60
+ b.StateOrProvinceCode state_code(send("#{type}_state")) if send("#{type}_state")
61
61
  b.PostalCode send("#{type}_postal_code") if send("#{type}_postal_code")
62
62
  b.CountryCode country_code(send("#{type}_country")) if send("#{type}_country")
63
63
  b.Residential send("#{type}_residential")
@@ -94,6 +94,10 @@ module Shippinglogic
94
94
  def country_code(value)
95
95
  Enumerations::FEDEX_COUNTRY_CODES[value.to_s] || Enumerations::RAILS_COUNTRY_CODES[value.to_s] || value.to_s
96
96
  end
97
+
98
+ def state_code(value)
99
+ Enumerations::STATE_CODES[value.to_s] || value.to_s
100
+ end
97
101
  end
98
102
  end
99
103
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shippinglogic}
8
- s.version = "1.0.3"
8
+ s.version = "1.0.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ben Johnson of Binary Logic"]
@@ -6,4 +6,10 @@ describe "FedEx Attributes" do
6
6
  rates = fedex.rate
7
7
  rates.send(:country_code, "United States").should == "US"
8
8
  end
9
+
10
+ it "should convert full state names to state codes" do
11
+ fedex = new_fedex
12
+ rates = fedex.rate
13
+ rates.send(:state_code, "Texas").should == "TX"
14
+ end
9
15
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: binarylogic-shippinglogic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Johnson of Binary Logic