active_shipping 0.1.4 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. data/CHANGELOG +2 -0
  2. data/README.markdown +0 -3
  3. data/lib/active_merchant/common.rb +14 -0
  4. data/lib/{active_shipping/lib → active_merchant/common}/connection.rb +2 -0
  5. data/lib/{active_shipping/lib → active_merchant/common}/country.rb +0 -0
  6. data/lib/active_merchant/common/error.rb +26 -0
  7. data/lib/active_merchant/common/post_data.rb +24 -0
  8. data/lib/{active_shipping/lib → active_merchant/common}/posts_data.rb +0 -0
  9. data/lib/{active_shipping/lib → active_merchant/common}/requires_parameters.rb +0 -0
  10. data/lib/{active_shipping/lib → active_merchant/common}/utils.rb +0 -0
  11. data/lib/{active_shipping/lib → active_merchant/common}/validateable.rb +0 -0
  12. data/lib/active_shipping.rb +10 -22
  13. data/lib/active_shipping/shipping/base.rb +2 -1
  14. data/lib/active_shipping/shipping/carrier.rb +0 -5
  15. data/lib/active_shipping/shipping/carriers.rb +2 -1
  16. data/lib/active_shipping/shipping/carriers/fedex.rb +7 -191
  17. data/lib/active_shipping/shipping/carriers/kunaki.rb +165 -0
  18. data/lib/active_shipping/shipping/carriers/ups.rb +2 -1
  19. data/lib/active_shipping/shipping/carriers/usps.rb +0 -85
  20. data/lib/active_shipping/shipping/location.rb +1 -4
  21. data/lib/active_shipping/shipping/response.rb +1 -4
  22. data/lib/active_shipping/version.rb +3 -0
  23. data/lib/vendor/quantified/lib/quantified.rb +5 -3
  24. metadata +68 -102
  25. data/.gitignore +0 -8
  26. data/Rakefile +0 -51
  27. data/VERSION +0 -1
  28. data/active_shipping.gemspec +0 -152
  29. data/init.rb +0 -1
  30. data/lib/active_shipping/lib/error.rb +0 -4
  31. data/lib/active_shipping/lib/post_data.rb +0 -22
  32. data/lib/active_shipping/shipping/contact.rb +0 -18
  33. data/lib/active_shipping/shipping/label.rb +0 -31
  34. data/lib/active_shipping/shipping/location_response.rb +0 -14
  35. data/lib/active_shipping/shipping/party.rb +0 -15
  36. data/lib/active_shipping/shipping/return_label_response.rb +0 -14
  37. data/lib/active_shipping/shipping/return_shipment.rb +0 -14
  38. data/lib/active_shipping/shipping/shipment.rb +0 -73
  39. data/test/fixtures.example.yml +0 -13
  40. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_request.xml +0 -67
  41. data/test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_response.xml +0 -213
  42. data/test/fixtures/xml/fedex/tracking_request.xml +0 -27
  43. data/test/fixtures/xml/fedex/tracking_response.xml +0 -153
  44. data/test/fixtures/xml/shipwire/international_rates_response.xml +0 -17
  45. data/test/fixtures/xml/shipwire/invalid_credentials_response.xml +0 -4
  46. data/test/fixtures/xml/shipwire/new_carrier_rate_response.xml +0 -18
  47. data/test/fixtures/xml/shipwire/no_rates_response.xml +0 -7
  48. data/test/fixtures/xml/shipwire/rates_response.xml +0 -36
  49. data/test/fixtures/xml/ups/example_tracking_response.xml +0 -53
  50. data/test/fixtures/xml/ups/shipment_from_tiger_direct.xml +0 -222
  51. data/test/fixtures/xml/ups/test_real_home_as_residential_destination_response.xml +0 -1
  52. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_book_rate_response.xml +0 -85
  53. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_book_wii_rate_response.xml +0 -168
  54. data/test/fixtures/xml/usps/beverly_hills_to_ottawa_wii_rate_response.xml +0 -85
  55. data/test/fixtures/xml/usps/example_tracking_response.xml +0 -104
  56. data/test/fixtures/xml/usps/multi_tracking_example.xml +0 -105
  57. data/test/party_factory.rb +0 -29
  58. data/test/remote/fedex_test.rb +0 -160
  59. data/test/remote/shipwire_test.rb +0 -88
  60. data/test/remote/ups_test.rb +0 -207
  61. data/test/remote/usps_test.rb +0 -184
  62. data/test/shipment_factory.rb +0 -27
  63. data/test/test_helper.rb +0 -171
  64. data/test/unit/base_test.rb +0 -18
  65. data/test/unit/carriers/fedex_test.rb +0 -78
  66. data/test/unit/carriers/shipwire_test.rb +0 -130
  67. data/test/unit/carriers/ups_test.rb +0 -81
  68. data/test/unit/carriers/usps_test.rb +0 -206
  69. data/test/unit/location_test.rb +0 -46
  70. data/test/unit/package_test.rb +0 -65
  71. data/test/unit/party_test.rb +0 -20
  72. data/test/unit/response_test.rb +0 -10
  73. data/test/unit/shipment_test.rb +0 -43
data/VERSION DELETED
@@ -1 +0,0 @@
1
- 0.1.4
@@ -1,152 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{active_shipping}
8
- s.version = "0.1.4"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["James MacAulay", "Tobias Luetke", "Cody Fauser", "Jimmy Baker"]
12
- s.date = %q{2010-04-20}
13
- s.description = %q{Shipping API extension for Active Merchant.}
14
- s.email = %q{jmacaulay@gmail.com}
15
- s.extra_rdoc_files = [
16
- "README.markdown"
17
- ]
18
- s.files = [
19
- ".gitignore",
20
- "CHANGELOG",
21
- "MIT-LICENSE",
22
- "README.markdown",
23
- "Rakefile",
24
- "VERSION",
25
- "active_shipping.gemspec",
26
- "init.rb",
27
- "lib/active_shipping.rb",
28
- "lib/active_shipping/lib/connection.rb",
29
- "lib/active_shipping/lib/country.rb",
30
- "lib/active_shipping/lib/error.rb",
31
- "lib/active_shipping/lib/post_data.rb",
32
- "lib/active_shipping/lib/posts_data.rb",
33
- "lib/active_shipping/lib/requires_parameters.rb",
34
- "lib/active_shipping/lib/utils.rb",
35
- "lib/active_shipping/lib/validateable.rb",
36
- "lib/active_shipping/shipping/base.rb",
37
- "lib/active_shipping/shipping/carrier.rb",
38
- "lib/active_shipping/shipping/carriers.rb",
39
- "lib/active_shipping/shipping/carriers/bogus_carrier.rb",
40
- "lib/active_shipping/shipping/carriers/fedex.rb",
41
- "lib/active_shipping/shipping/carriers/shipwire.rb",
42
- "lib/active_shipping/shipping/carriers/ups.rb",
43
- "lib/active_shipping/shipping/carriers/usps.rb",
44
- "lib/active_shipping/shipping/contact.rb",
45
- "lib/active_shipping/shipping/label.rb",
46
- "lib/active_shipping/shipping/location.rb",
47
- "lib/active_shipping/shipping/location_response.rb",
48
- "lib/active_shipping/shipping/package.rb",
49
- "lib/active_shipping/shipping/party.rb",
50
- "lib/active_shipping/shipping/rate_estimate.rb",
51
- "lib/active_shipping/shipping/rate_response.rb",
52
- "lib/active_shipping/shipping/response.rb",
53
- "lib/active_shipping/shipping/return_label_response.rb",
54
- "lib/active_shipping/shipping/return_shipment.rb",
55
- "lib/active_shipping/shipping/shipment.rb",
56
- "lib/active_shipping/shipping/shipment_event.rb",
57
- "lib/active_shipping/shipping/tracking_response.rb",
58
- "lib/certs/cacert.pem",
59
- "lib/vendor/quantified/MIT-LICENSE",
60
- "lib/vendor/quantified/README.markdown",
61
- "lib/vendor/quantified/Rakefile",
62
- "lib/vendor/quantified/init.rb",
63
- "lib/vendor/quantified/lib/quantified.rb",
64
- "lib/vendor/quantified/lib/quantified/attribute.rb",
65
- "lib/vendor/quantified/lib/quantified/length.rb",
66
- "lib/vendor/quantified/lib/quantified/mass.rb",
67
- "lib/vendor/quantified/test/length_test.rb",
68
- "lib/vendor/quantified/test/mass_test.rb",
69
- "lib/vendor/quantified/test/test_helper.rb",
70
- "lib/vendor/test_helper.rb",
71
- "lib/vendor/xml_node/README",
72
- "lib/vendor/xml_node/Rakefile",
73
- "lib/vendor/xml_node/benchmark/bench_generation.rb",
74
- "lib/vendor/xml_node/init.rb",
75
- "lib/vendor/xml_node/lib/xml_node.rb",
76
- "lib/vendor/xml_node/test/test_generating.rb",
77
- "lib/vendor/xml_node/test/test_parsing.rb",
78
- "test/fixtures.example.yml",
79
- "test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_request.xml",
80
- "test/fixtures/xml/fedex/ottawa_to_beverly_hills_rate_response.xml",
81
- "test/fixtures/xml/fedex/tracking_request.xml",
82
- "test/fixtures/xml/fedex/tracking_response.xml",
83
- "test/fixtures/xml/shipwire/international_rates_response.xml",
84
- "test/fixtures/xml/shipwire/invalid_credentials_response.xml",
85
- "test/fixtures/xml/shipwire/new_carrier_rate_response.xml",
86
- "test/fixtures/xml/shipwire/no_rates_response.xml",
87
- "test/fixtures/xml/shipwire/rates_response.xml",
88
- "test/fixtures/xml/ups/example_tracking_response.xml",
89
- "test/fixtures/xml/ups/shipment_from_tiger_direct.xml",
90
- "test/fixtures/xml/ups/test_real_home_as_residential_destination_response.xml",
91
- "test/fixtures/xml/usps/beverly_hills_to_ottawa_book_rate_response.xml",
92
- "test/fixtures/xml/usps/beverly_hills_to_ottawa_book_wii_rate_response.xml",
93
- "test/fixtures/xml/usps/beverly_hills_to_ottawa_wii_rate_response.xml",
94
- "test/fixtures/xml/usps/example_tracking_response.xml",
95
- "test/fixtures/xml/usps/multi_tracking_example.xml",
96
- "test/party_factory.rb",
97
- "test/remote/fedex_test.rb",
98
- "test/remote/shipwire_test.rb",
99
- "test/remote/ups_test.rb",
100
- "test/remote/usps_test.rb",
101
- "test/shipment_factory.rb",
102
- "test/test_helper.rb",
103
- "test/unit/base_test.rb",
104
- "test/unit/carriers/fedex_test.rb",
105
- "test/unit/carriers/shipwire_test.rb",
106
- "test/unit/carriers/ups_test.rb",
107
- "test/unit/carriers/usps_test.rb",
108
- "test/unit/location_test.rb",
109
- "test/unit/package_test.rb",
110
- "test/unit/party_test.rb",
111
- "test/unit/response_test.rb",
112
- "test/unit/shipment_test.rb"
113
- ]
114
- s.homepage = %q{http://github.com/Shopify/active_shipping}
115
- s.rdoc_options = ["--charset=UTF-8"]
116
- s.require_paths = ["lib"]
117
- s.rubygems_version = %q{1.3.6}
118
- s.summary = %q{Shipping API extension for Active Merchant.}
119
- s.test_files = [
120
- "test/party_factory.rb",
121
- "test/remote/fedex_test.rb",
122
- "test/remote/shipwire_test.rb",
123
- "test/remote/ups_test.rb",
124
- "test/remote/usps_test.rb",
125
- "test/shipment_factory.rb",
126
- "test/test_helper.rb",
127
- "test/unit/base_test.rb",
128
- "test/unit/carriers/fedex_test.rb",
129
- "test/unit/carriers/shipwire_test.rb",
130
- "test/unit/carriers/ups_test.rb",
131
- "test/unit/carriers/usps_test.rb",
132
- "test/unit/location_test.rb",
133
- "test/unit/package_test.rb",
134
- "test/unit/party_test.rb",
135
- "test/unit/response_test.rb",
136
- "test/unit/shipment_test.rb"
137
- ]
138
-
139
- if s.respond_to? :specification_version then
140
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
141
- s.specification_version = 3
142
-
143
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
144
- s.add_runtime_dependency(%q<activesupport>, [">= 0"])
145
- else
146
- s.add_dependency(%q<activesupport>, [">= 0"])
147
- end
148
- else
149
- s.add_dependency(%q<activesupport>, [">= 0"])
150
- end
151
- end
152
-
data/init.rb DELETED
@@ -1 +0,0 @@
1
- require 'active_shipping'
@@ -1,4 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- class ActiveMerchantError < StandardError #:nodoc:
3
- end
4
- end
@@ -1,22 +0,0 @@
1
- require 'cgi'
2
-
3
- class PostData < Hash
4
- class_inheritable_accessor :required_fields, :instance_writer => false
5
- self.required_fields = []
6
-
7
- def []=(key, value)
8
- return if value.blank? && !required?(key)
9
- super
10
- end
11
-
12
- def to_post_data
13
- collect { |key, value| "#{key}=#{CGI.escape(value.to_s)}" }.join("&")
14
- end
15
-
16
- alias_method :to_s, :to_post_data
17
-
18
- private
19
- def required?(key)
20
- required_fields.include?(key)
21
- end
22
- end
@@ -1,18 +0,0 @@
1
- module ActiveMerchant
2
- module Shipping
3
- class Contact
4
- attr_accessor :name
5
- attr_accessor :title
6
- attr_accessor :company_name
7
- attr_accessor :phone_number
8
- attr_accessor :fax_number
9
- attr_accessor :email_address
10
-
11
- def initialize(attrs = {})
12
- attrs.each do |key, value|
13
- self.send("#{key}=", value) if self.respond_to?("#{key}=")
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,31 +0,0 @@
1
- module ActiveMerchant
2
- module Shipping
3
- class Label
4
- FEDEX_FORMATS = [
5
- 'COMMON2D',
6
- 'LABEL_DATA_ONLY'
7
- ]
8
-
9
- FEDEX_IMAGE_TYPES = [
10
- 'DPL',
11
- 'EPL2',
12
- 'PDF',
13
- 'PNG',
14
- 'ZPLII'
15
- ]
16
-
17
- attr_accessor :format_type
18
- attr_accessor :image_type
19
- attr_accessor :image
20
-
21
- def initialize(attrs = {})
22
- attrs.each do |key, value|
23
- self.send("#{key}=", value) if self.respond_to?("#{key}=")
24
- end
25
-
26
- self.image_type ||= 'PNG'
27
- end
28
-
29
- end
30
- end
31
- end
@@ -1,14 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Shipping
3
-
4
- class LocationResponse < Response
5
- attr_reader :location
6
-
7
- def initialize(success, message, params = {}, options = {})
8
- @location = options[:location]
9
- super
10
- end
11
- end
12
-
13
- end
14
- end
@@ -1,15 +0,0 @@
1
- module ActiveMerchant
2
- module Shipping
3
- class Party
4
- attr_accessor :location
5
- attr_accessor :contact
6
- attr_accessor :account_number
7
-
8
- def initialize(attrs = {})
9
- attrs.each do |key, value|
10
- self.send("#{key}=", value) if self.respond_to?("#{key}=")
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,14 +0,0 @@
1
- module ActiveMerchant #:nodoc:
2
- module Shipping
3
-
4
- class ReturnLabelResponse < Response
5
- attr_reader :shipment
6
-
7
- def initialize(success, message, params = {}, options = {})
8
- @shipment = options[:shipment]
9
- super
10
- end
11
- end
12
-
13
- end
14
- end
@@ -1,14 +0,0 @@
1
- module ActiveMerchant
2
- module Shipping
3
- class ReturnShipment < Shipment
4
- attr_accessor :rma_number
5
- attr_reader :return_type
6
- def initialize(opts = {})
7
- super
8
- self.rma_number = opts[:rma_number]
9
- self.payment_type ||= 'RECIPIENT'
10
- @return_type = opts[:return_type] || 'PRINT_RETURN_LABEL'
11
- end
12
- end
13
- end
14
- end
@@ -1,73 +0,0 @@
1
- module ActiveMerchant
2
- module Shipping
3
- class Shipment
4
- include ActiveMerchant::Shipping
5
-
6
- FEDEX_PAYMENT_TYPES = [
7
- 'COLLECT',
8
- 'RECIPIENT',
9
- 'SENDER',
10
- 'THIRD_PARTY'
11
- ]
12
-
13
- FEDEX_DROPOFF_TYPES = [
14
- "REGULAR_PICKUP",
15
- "REQUEST_COURIER",
16
- "DROP_BOX",
17
- "BUSINESS_SERVICE_CENTER",
18
- "STATION"
19
- ]
20
-
21
- FEDEX_RATE_REQUEST_TYPES = [
22
- "ACCOUNT",
23
- "LIST"
24
- ]
25
-
26
- attr_accessor :ship_at
27
- attr_accessor :service
28
- attr_accessor :packaging_type
29
- attr_accessor :shipper
30
- attr_accessor :total_insured_amount
31
- attr_accessor :total_insured_currency
32
- attr_accessor :recipient
33
- attr_accessor :payment_type
34
- attr_accessor :special_services
35
- attr_accessor :label
36
- attr_accessor :requested_packages
37
- attr_accessor :dropoff_type
38
- attr_accessor :rate_request_type
39
- attr_accessor :package_count
40
- attr_accessor :total_weight_value
41
- attr_accessor :total_weight_units
42
- attr_accessor :payor_account_number
43
-
44
- attr_accessor :tracking_number
45
- attr_accessor :transit_time
46
-
47
- attr_reader :payor_account_country
48
-
49
- def initialize(attrs = {})
50
- attrs.each do |key, value|
51
- self.send("#{key}=", value) if self.respond_to?("#{key}=")
52
- end
53
-
54
- self.label ||= Label.new(:format_type => 'COMMON2D')
55
- self.requested_packages ||= 1
56
- self.dropoff_type ||= 'REGULAR_PICKUP'
57
- self.service ||= 'FEDEX_GROUND'
58
- self.packaging_type ||= 'YOUR_PACKAGING'
59
- self.ship_at ||= Time.now
60
- self.package_count ||= 1
61
- self.rate_request_type ||= 'ACCOUNT'
62
- self.total_insured_currency ||= 'USD' if self.total_insured_amount
63
- self.total_weight_units ||= 'LB' if self.total_weight_value
64
- end
65
- end
66
-
67
- def payor_account_country=(c)
68
- @payor_account_country = (c.nil? || c.is_a?(ActiveMerchant::Country)) ?
69
- c : ActiveMerchant::Country.find(c)
70
- @payor_account_country
71
- end
72
- end
73
- end
@@ -1,13 +0,0 @@
1
- usps:
2
- login: APIKey
3
- ups:
4
- key: XmlAccessKey
5
- login: UPSDotComLogin
6
- password: UPSDotComPassword
7
- fedex:
8
- login: FEDEXAccountNumber
9
- password: FEDEXMeterNumber
10
- test: true
11
- shipwire:
12
- login: EmailAddress
13
- password: Password
@@ -1,67 +0,0 @@
1
- <?xml version="1.0"?>
2
- <RateRequest xmlns="http://fedex.com/ws/rate/v6">
3
- <WebAuthenticationDetail>
4
- <UserCredential>
5
- <Key>1111</Key>
6
- <Password>2222</Password>
7
- </UserCredential>
8
- </WebAuthenticationDetail>
9
- <ClientDetail>
10
- <AccountNumber>3333</AccountNumber>
11
- <MeterNumber>4444</MeterNumber>
12
- </ClientDetail>
13
- <TransactionDetail>
14
- <CustomerTransactionId>ActiveShipping</CustomerTransactionId>
15
- </TransactionDetail>
16
- <Version>
17
- <ServiceId>crs</ServiceId>
18
- <Major>6</Major>
19
- <Intermediate>0</Intermediate>
20
- <Minor>0</Minor>
21
- </Version>
22
- <ReturnTransitAndCommit>true</ReturnTransitAndCommit>
23
- <VariableOptions>SATURDAY_DELIVERY</VariableOptions>
24
- <RequestedShipment>
25
- <ShipTimestamp>2009-07-20T12:01:55-04:00</ShipTimestamp>
26
- <DropoffType>REGULAR_PICKUP</DropoffType>
27
- <PackagingType>YOUR_PACKAGING</PackagingType>
28
- <Shipper>
29
- <Address>
30
- <PostalCode>K1P 1J1</PostalCode>
31
- <CountryCode>CA</CountryCode>
32
- </Address>
33
- </Shipper>
34
- <Recipient>
35
- <Address>
36
- <PostalCode>90210</PostalCode>
37
- <CountryCode>US</CountryCode>
38
- </Address>
39
- </Recipient>
40
- <RateRequestTypes>ACCOUNT</RateRequestTypes>
41
- <PackageCount>2</PackageCount>
42
- <RequestedPackages>
43
- <Weight>
44
- <Units>KG</Units>
45
- <Value>0.25</Value>
46
- </Weight>
47
- <Dimensions>
48
- <Length>19</Length>
49
- <Width>14</Width>
50
- <Height>2</Height>
51
- <Units>CM</Units>
52
- </Dimensions>
53
- </RequestedPackages>
54
- <RequestedPackages>
55
- <Weight>
56
- <Units>KG</Units>
57
- <Value>3.402</Value>
58
- </Weight>
59
- <Dimensions>
60
- <Length>39</Length>
61
- <Width>26</Width>
62
- <Height>12</Height>
63
- <Units>CM</Units>
64
- </Dimensions>
65
- </RequestedPackages>
66
- </RequestedShipment>
67
- </RateRequest>