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 +4 -0
- data/VERSION.yml +1 -1
- data/lib/shippinglogic/fedex/enumerations.rb +61 -0
- data/lib/shippinglogic/fedex/request.rb +5 -1
- data/shippinglogic.gemspec +1 -1
- data/spec/fedex/request_spec.rb +6 -0
- metadata +1 -1
data/CHANGELOG.rdoc
CHANGED
data/VERSION.yml
CHANGED
@@ -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
|
data/shippinglogic.gemspec
CHANGED
data/spec/fedex/request_spec.rb
CHANGED
@@ -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
|