simple_shipping 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.metrics +6 -0
  4. data/.rspec +4 -0
  5. data/.ruby-gemset +1 -0
  6. data/.ruby-version +1 -0
  7. data/.simplecov +43 -0
  8. data/Gemfile +26 -0
  9. data/Gemfile.lock +201 -0
  10. data/LICENSE.txt +21 -0
  11. data/README.markdown +207 -0
  12. data/Rakefile +68 -0
  13. data/VERSION +1 -0
  14. data/coverage/.resultset.json +1579 -0
  15. data/lib/colorized_text.rb +34 -0
  16. data/lib/simple_shipping.rb +27 -0
  17. data/lib/simple_shipping/abstract.rb +11 -0
  18. data/lib/simple_shipping/abstract/builder.rb +47 -0
  19. data/lib/simple_shipping/abstract/client.rb +111 -0
  20. data/lib/simple_shipping/abstract/model.rb +40 -0
  21. data/lib/simple_shipping/abstract/request.rb +27 -0
  22. data/lib/simple_shipping/abstract/response.rb +26 -0
  23. data/lib/simple_shipping/address.rb +22 -0
  24. data/lib/simple_shipping/contact.rb +24 -0
  25. data/lib/simple_shipping/demo.rb +9 -0
  26. data/lib/simple_shipping/demo/base.rb +71 -0
  27. data/lib/simple_shipping/demo/fedex.rb +46 -0
  28. data/lib/simple_shipping/demo/ups.rb +68 -0
  29. data/lib/simple_shipping/exceptions.rb +40 -0
  30. data/lib/simple_shipping/fedex.rb +14 -0
  31. data/lib/simple_shipping/fedex/client.rb +41 -0
  32. data/lib/simple_shipping/fedex/package_builder.rb +24 -0
  33. data/lib/simple_shipping/fedex/party_builder.rb +50 -0
  34. data/lib/simple_shipping/fedex/request.rb +54 -0
  35. data/lib/simple_shipping/fedex/response.rb +5 -0
  36. data/lib/simple_shipping/fedex/shipment_builder.rb +123 -0
  37. data/lib/simple_shipping/fedex/shipment_request.rb +14 -0
  38. data/lib/simple_shipping/fedex/shipment_response.rb +12 -0
  39. data/lib/simple_shipping/package.rb +43 -0
  40. data/lib/simple_shipping/party.rb +21 -0
  41. data/lib/simple_shipping/shipment.rb +42 -0
  42. data/lib/simple_shipping/ups.rb +24 -0
  43. data/lib/simple_shipping/ups/client.rb +46 -0
  44. data/lib/simple_shipping/ups/package_builder.rb +101 -0
  45. data/lib/simple_shipping/ups/party_builder.rb +38 -0
  46. data/lib/simple_shipping/ups/request.rb +27 -0
  47. data/lib/simple_shipping/ups/response.rb +63 -0
  48. data/lib/simple_shipping/ups/ship_accept_request.rb +21 -0
  49. data/lib/simple_shipping/ups/ship_accept_response.rb +6 -0
  50. data/lib/simple_shipping/ups/ship_client.rb +70 -0
  51. data/lib/simple_shipping/ups/ship_confirm_request.rb +22 -0
  52. data/lib/simple_shipping/ups/ship_confirm_response.rb +6 -0
  53. data/lib/simple_shipping/ups/shipment_builder.rb +66 -0
  54. data/lib/simple_shipping/ups/shipment_request.rb +22 -0
  55. data/lib/simple_shipping/ups/shipment_response.rb +6 -0
  56. data/lib/simple_shipping/ups/void_client.rb +50 -0
  57. data/lib/simple_shipping/ups/void_request.rb +42 -0
  58. data/lib/simple_shipping/ups/void_response.rb +6 -0
  59. data/lib/tasks/demo.rake +58 -0
  60. data/script/ups_certification.rb +140 -0
  61. data/simple_shipping.gemspec +168 -0
  62. data/spec/fixtures/fedex_shipment_request.soap.xml.erb +85 -0
  63. data/spec/fixtures/fedex_shipment_response.soap.xml.erb +182 -0
  64. data/spec/fixtures/ups_shipment_request.soap.xml.erb +88 -0
  65. data/spec/fixtures/ups_shipment_response.soap.xml.erb +58 -0
  66. data/spec/fixtures/ups_shipment_response_with_faked_label_data.soap.xml.erb +54 -0
  67. data/spec/fixtures/ups_void_request.soap.xml.erb +29 -0
  68. data/spec/fixtures/ups_void_response.soap.xml.erb +21 -0
  69. data/spec/lib/simple_shipping/address_spec.rb +19 -0
  70. data/spec/lib/simple_shipping/contact_spec.rb +28 -0
  71. data/spec/lib/simple_shipping/exceptions_spec.rb +58 -0
  72. data/spec/lib/simple_shipping/fedex/package_builder_spec.rb +5 -0
  73. data/spec/lib/simple_shipping/fedex/party_builder_spec.rb +5 -0
  74. data/spec/lib/simple_shipping/fedex/response/shipment_reponse_spec.rb +5 -0
  75. data/spec/lib/simple_shipping/fedex/response_spec.rb +5 -0
  76. data/spec/lib/simple_shipping/fedex/shipment_builder_spec.rb +23 -0
  77. data/spec/lib/simple_shipping/package_spec.rb +32 -0
  78. data/spec/lib/simple_shipping/party_spec.rb +18 -0
  79. data/spec/lib/simple_shipping/shipment_spec.rb +35 -0
  80. data/spec/lib/simple_shipping/ups/package_builder_spec.rb +26 -0
  81. data/spec/lib/simple_shipping/ups/party_builder_spec.rb +47 -0
  82. data/spec/lib/simple_shipping/ups/response/shipment_response_spec.rb +5 -0
  83. data/spec/lib/simple_shipping/ups/response_spec.rb +33 -0
  84. data/spec/lib/simple_shipping/ups/shipment_builder_spec.rb +19 -0
  85. data/spec/requests/fedex_spec.rb +47 -0
  86. data/spec/requests/ups_spec.rb +75 -0
  87. data/spec/spec_helper.rb +47 -0
  88. data/spec/support/custom_matchers/basic_matcher.rb +13 -0
  89. data/spec/support/custom_matchers/have_attribute_matcher.rb +22 -0
  90. data/spec/support/custom_matchers/have_default_value_matcher.rb +26 -0
  91. data/spec/support/custom_matchers/have_errors_on_matcher.rb +23 -0
  92. data/spec/support/custom_matchers/validate_inclusion_of_matcher.rb +37 -0
  93. data/spec/support/custom_matchers/validate_presence_of_matcher.rb +24 -0
  94. data/spec/support/custom_matchers/validate_submodel_matcher.rb +44 -0
  95. data/spec/support/shared_behaviours/builders_behaviour.rb +9 -0
  96. data/spec/support/shared_behaviours/responses_behaviour.rb +10 -0
  97. data/tmp/metric_fu/_data/20131210.yml +9964 -0
  98. data/wsdl/fedex/ship_service_v10.wsdl +5566 -0
  99. data/wsdl/ups/Ship.wsdl +120 -0
  100. data/wsdl/ups/Void.wsdl +58 -0
  101. metadata +308 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 69f676b90043220ffa380e7792e4fb651744ed50
4
+ data.tar.gz: 47469efeb1e360ec1bda3cd31267177145f6821c
5
+ SHA512:
6
+ metadata.gz: 1d9531870e2266597f74e160954cc9910bfb7a7e6aa44bd76b80b54840263debdf0ae684c0e0346d197a9f8c2263220c97d9aa5339d5828446eebb178cda329f
7
+ data.tar.gz: aec31ce585327a223c565b1704b0e552d774555327f488c1e836cf3dbe4cf8cdffeaf7ddd725a16d78e145d7d6498342d7577980a4769f872cb289cf3a417d40
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.metrics ADDED
@@ -0,0 +1,6 @@
1
+ MetricFu::Configuration.run do |config|
2
+ coverage_file = File.expand_path("coverage/rcov/rcov.txt", Dir.pwd)
3
+ config.add_metric(:rcov)
4
+ config.add_graph(:rcov)
5
+ config.configure_metric(:rcov, {:external => coverage_file})
6
+ end
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --color
2
+ --format nested
3
+ --backtrace
4
+ --profile
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ simple_shipping
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p429
data/.simplecov ADDED
@@ -0,0 +1,43 @@
1
+ require "simplecov-rcov-text"
2
+ require "colorized_text"
3
+ include ColorizedText
4
+
5
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
6
+ SimpleCov::Formatter::RcovTextFormatter,
7
+ SimpleCov::Formatter::HTMLFormatter
8
+ ]
9
+ SimpleCov.start do
10
+ add_filter "/spec/"
11
+ add_filter "/config/"
12
+
13
+ # Fail the build when coverage is weak:
14
+ at_exit do
15
+ SimpleCov.result.format!
16
+ threshold, actual = 95.121, SimpleCov.result.covered_percent
17
+ if actual < threshold
18
+ msg = "\nLow coverage: "
19
+ msg << red("#{actual}%")
20
+ msg << " is #{red 'under'} the threshold: "
21
+ msg << green("#{threshold}%.")
22
+ msg << "\n"
23
+ $stderr.puts msg
24
+ exit 1
25
+ else
26
+ # Precision: three decimal places:
27
+ actual_trunc = (actual * 1000).floor / 1000.0
28
+ msg = "\nCoverage: "
29
+ msg << green("#{actual}%")
30
+ msg << " is #{green 'over'} the threshold: "
31
+ if actual_trunc > threshold
32
+ msg << bold(yellow("#{threshold}%. "))
33
+ msg << "Please update the threshold to: "
34
+ msg << bold(green("#{actual_trunc}% "))
35
+ msg << "in ./.simplecov."
36
+ else
37
+ msg << green("#{threshold}%.")
38
+ end
39
+ msg << "\n"
40
+ $stdout.puts msg
41
+ end
42
+ end
43
+ end
data/Gemfile ADDED
@@ -0,0 +1,26 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem "activesupport" , "~> 3.1"
4
+ gem "activemodel" , "~> 3.1"
5
+ gem "savon", "~> 2.2.0"
6
+
7
+ group :development do
8
+ gem "rspec", "~> 2.14.0"
9
+ gem "yard"
10
+ gem "bundler"
11
+ gem "jeweler"
12
+ gem "json_pure"
13
+ gem "forgery"
14
+ gem "rmagick"
15
+
16
+ gem "metric_fu"
17
+ end
18
+
19
+ group :test do
20
+ gem "webmock"
21
+ gem "timecop"
22
+ gem "erubis"
23
+ gem "equivalent-xml"
24
+ gem "simplecov", :require => false
25
+ gem "simplecov-rcov-text", :require => false
26
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,201 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activemodel (3.2.16)
5
+ activesupport (= 3.2.16)
6
+ builder (~> 3.0.0)
7
+ activesupport (3.2.16)
8
+ i18n (~> 0.6, >= 0.6.4)
9
+ multi_json (~> 1.0)
10
+ addressable (2.3.5)
11
+ akami (1.2.0)
12
+ gyoku (>= 0.4.0)
13
+ nokogiri (>= 1.4.0)
14
+ arrayfields (4.9.0)
15
+ awesome_print (1.2.0)
16
+ builder (3.0.4)
17
+ cane (2.6.1)
18
+ parallel
19
+ chronic (0.10.2)
20
+ churn (0.0.35)
21
+ chronic (>= 0.2.3)
22
+ hirb
23
+ json_pure
24
+ main
25
+ rest-client (>= 1.6.0)
26
+ ruby_parser (~> 3.0)
27
+ sexp_processor (~> 4.1)
28
+ code_analyzer (0.4.4)
29
+ sexp_processor
30
+ code_metrics (0.1.3)
31
+ coderay (1.1.0)
32
+ colored (1.2)
33
+ crack (0.4.1)
34
+ safe_yaml (~> 0.9.0)
35
+ descendants_tracker (0.0.3)
36
+ diff-lcs (1.2.5)
37
+ docile (1.1.2)
38
+ equivalent-xml (0.4.0)
39
+ nokogiri (>= 1.4.3)
40
+ erubis (2.7.0)
41
+ faraday (0.8.9)
42
+ multipart-post (~> 1.2.0)
43
+ fattr (2.2.1)
44
+ flay (2.4.0)
45
+ ruby_parser (~> 3.0)
46
+ sexp_processor (~> 4.0)
47
+ flog (4.2.0)
48
+ ruby_parser (~> 3.1, > 3.1.0)
49
+ sexp_processor (~> 4.4)
50
+ forgery (0.5.0)
51
+ git (1.2.6)
52
+ github_api (0.11.1)
53
+ addressable (~> 2.3)
54
+ descendants_tracker (~> 0.0.1)
55
+ faraday (~> 0.8, < 0.10)
56
+ hashie (>= 1.2)
57
+ multi_json (>= 1.7.5, < 2.0)
58
+ nokogiri (~> 1.6.0)
59
+ oauth2
60
+ gyoku (1.0.0)
61
+ builder (>= 2.1.2)
62
+ hashie (2.0.5)
63
+ highline (1.6.20)
64
+ hirb (0.7.1)
65
+ httpauth (0.2.0)
66
+ httpi (2.0.2)
67
+ rack
68
+ i18n (0.6.9)
69
+ jeweler (2.0.0)
70
+ builder
71
+ bundler (>= 1.0)
72
+ git (>= 1.2.5)
73
+ github_api
74
+ highline (>= 1.6.15)
75
+ nokogiri (>= 1.5.10)
76
+ rake
77
+ rdoc
78
+ json (1.8.1)
79
+ json_pure (1.8.1)
80
+ jwt (0.1.8)
81
+ multi_json (>= 1.5)
82
+ main (5.2.0)
83
+ arrayfields (>= 4.7.4)
84
+ chronic (>= 0.6.2)
85
+ fattr (>= 2.2.0)
86
+ map (>= 5.1.0)
87
+ map (6.5.1)
88
+ metric_fu (4.7.1)
89
+ cane (~> 2.5, >= 2.5.2)
90
+ churn (~> 0.0.28)
91
+ code_metrics (~> 0.1)
92
+ coderay
93
+ flay (~> 2.1, >= 2.0.1)
94
+ flog (~> 4.1, >= 4.1.1)
95
+ metric_fu-Saikuro (>= 1.1.1.0)
96
+ multi_json
97
+ rails_best_practices (~> 1.14, >= 1.14.3)
98
+ redcard
99
+ reek (~> 1.3, >= 1.3.4)
100
+ roodi (~> 3.1)
101
+ metric_fu-Saikuro (1.1.1.0)
102
+ mime-types (2.0)
103
+ mini_portile (0.5.2)
104
+ multi_json (1.8.3)
105
+ multi_xml (0.5.5)
106
+ multipart-post (1.2.0)
107
+ nokogiri (1.6.1)
108
+ mini_portile (~> 0.5.0)
109
+ nori (2.1.0)
110
+ oauth2 (0.9.2)
111
+ faraday (~> 0.8)
112
+ httpauth (~> 0.2)
113
+ jwt (~> 0.1.4)
114
+ multi_json (~> 1.0)
115
+ multi_xml (~> 0.5)
116
+ rack (~> 1.2)
117
+ parallel (0.9.1)
118
+ rack (1.5.2)
119
+ rails_best_practices (1.14.4)
120
+ activesupport
121
+ awesome_print
122
+ code_analyzer (>= 0.4.3)
123
+ colored
124
+ erubis
125
+ i18n
126
+ require_all
127
+ ruby-progressbar
128
+ rake (10.1.1)
129
+ rdoc (4.1.1)
130
+ json (~> 1.4)
131
+ redcard (1.1.0)
132
+ reek (1.3.6)
133
+ ruby2ruby (~> 2.0.7)
134
+ ruby_parser (~> 3.2)
135
+ sexp_processor
136
+ require_all (1.3.2)
137
+ rest-client (1.6.7)
138
+ mime-types (>= 1.16)
139
+ rmagick (2.13.2)
140
+ roodi (3.3.1)
141
+ ruby_parser (~> 3.2, >= 3.2.2)
142
+ rspec (2.14.1)
143
+ rspec-core (~> 2.14.0)
144
+ rspec-expectations (~> 2.14.0)
145
+ rspec-mocks (~> 2.14.0)
146
+ rspec-core (2.14.7)
147
+ rspec-expectations (2.14.4)
148
+ diff-lcs (>= 1.1.3, < 2.0)
149
+ rspec-mocks (2.14.4)
150
+ ruby-progressbar (1.4.0)
151
+ ruby2ruby (2.0.7)
152
+ ruby_parser (~> 3.1)
153
+ sexp_processor (~> 4.0)
154
+ ruby_parser (3.2.2)
155
+ sexp_processor (~> 4.1)
156
+ safe_yaml (0.9.7)
157
+ savon (2.2.0)
158
+ akami (~> 1.2.0)
159
+ builder (>= 2.1.2)
160
+ gyoku (~> 1.0.0)
161
+ httpi (~> 2.0.2)
162
+ nokogiri (>= 1.4.0)
163
+ nori (~> 2.1.0)
164
+ wasabi (~> 3.1.0)
165
+ sexp_processor (4.4.1)
166
+ simplecov (0.8.2)
167
+ docile (~> 1.1.0)
168
+ multi_json
169
+ simplecov-html (~> 0.8.0)
170
+ simplecov-html (0.8.0)
171
+ simplecov-rcov-text (0.0.2)
172
+ timecop (0.7.1)
173
+ wasabi (3.1.0)
174
+ httpi (~> 2.0)
175
+ nokogiri (>= 1.4.0)
176
+ webmock (1.16.1)
177
+ addressable (>= 2.2.7)
178
+ crack (>= 0.3.2)
179
+ yard (0.8.7.3)
180
+
181
+ PLATFORMS
182
+ ruby
183
+
184
+ DEPENDENCIES
185
+ activemodel (~> 3.1)
186
+ activesupport (~> 3.1)
187
+ bundler
188
+ equivalent-xml
189
+ erubis
190
+ forgery
191
+ jeweler
192
+ json_pure
193
+ metric_fu
194
+ rmagick
195
+ rspec (~> 2.14.0)
196
+ savon (~> 2.2.0)
197
+ simplecov
198
+ simplecov-rcov-text
199
+ timecop
200
+ webmock
201
+ yard
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2011 TMX Credit
2
+ Author Potapov, Sergey
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.markdown ADDED
@@ -0,0 +1,207 @@
1
+ # Simple Shipping
2
+
3
+ [![Build Status](https://travis-ci.org/TMXCredit/simple_shipping.png?branch=master)](https://travis-ci.org/TMXCredit/simple_shipping)
4
+
5
+ Provides a common simple API to build labels for the following shipping services:
6
+
7
+ * FedEx (http://fedex.com)
8
+ * UPS (http://ups.com) API (https://www.ups.com/upsdeveloperkit)
9
+
10
+ ## Usage
11
+ ```ruby
12
+ # Build shipper
13
+ shipper_address = SimpleShipping::Address.new(
14
+ :country_code => 'US',
15
+ :state_code => 'TX',
16
+ :city => 'Texas',
17
+ :street_line => 'SN2000 Test Meter 8',
18
+ :postal_code => '73301'
19
+ )
20
+ shipper_contact = SimpleShipping::Contact.new(
21
+ :person_name => 'Mister Someone',
22
+ :phone_number => '1234567890'
23
+ )
24
+ shipper = SimpleShipping::Party.new(
25
+ :address => shipper_address,
26
+ :contact => shipper_contact
27
+ )
28
+
29
+ # Build recipient
30
+ recipient_address = SimpleShipping::Address.new(
31
+ :country_code => 'US',
32
+ :state_code => 'MN',
33
+ :city => 'Minneapolis',
34
+ :street_line => 'Nightmare Avenue 13',
35
+ :postal_code => '55411'
36
+ )
37
+ recipient_contact = SimpleShipping::Contact.new(
38
+ :person_name => "John Recipient Smith",
39
+ :phone_number => "1234567890"
40
+ )
41
+ recipient = SimpleShipping::Party.new(
42
+ :address => recipient_address,
43
+ :contact => recipient_contact,
44
+ # optional, but required if party is payor
45
+ :account_number => ACCOUNT_NUMBER
46
+ )
47
+
48
+ package = SimpleShipping::Package.new(
49
+ :weight => 1,
50
+ :length => 2,
51
+ :height => 3,
52
+ :dimension_units => :in, # you can use :kg as well
53
+ :weight_units => :lb, # you can use :cm as well
54
+ :width => 4,
55
+ :packaging_type => :your
56
+ )
57
+
58
+ # Create clients
59
+ fedex = SimpleShipping::Fedex::Client.new(
60
+ :credentials => {
61
+ :key => KEY,
62
+ :password => PASSWORD,
63
+ :account_number => ACCOUNT_NUMBER,
64
+ :meter_number => METER_NUMBER
65
+ })
66
+ ups = SimpleShipping::Ups::ShipClient.new(
67
+ :credentials => {
68
+ :username => USERNAME,
69
+ :password => PASSWORD,
70
+ :access_license_number => ACCESS_LICENSE_NUMBER
71
+ }
72
+ )
73
+
74
+ # Do request
75
+ # Default payor is :shipper
76
+ ups_resp = ups.shipment_request(shipper, recipient, package)
77
+ fedex_resp = fedex.request(shipper, recipient, package, :payor => :recipient)
78
+ ```
79
+
80
+ ## Specific extra options
81
+ You can customize the request using specific options for the service by passing an options hash:
82
+
83
+ ### FedEx extra options
84
+ * *:dropoff_type* (see `SimpleShipping::Fedex::ShipmentBuilder::DROPOFF_TYPES` for available values)
85
+ * *:service_type* (see `SimpleShipping::Fedex::ShipmentBuilder::SERVICE_TYPES` for available values)
86
+
87
+ *Example:*
88
+ ```ruby
89
+ fedex_client.request(shipper, recipient, package, :dropoff_type => :drop_box)
90
+ ```
91
+
92
+ ## UPS extra options
93
+ * *service_type* (see `SimpleShipping::Ups::ShipmentBuilder::SERVICE_TYPES` for available values)
94
+
95
+ *Example*
96
+ ```ruby
97
+ ups_client.shipment_request(shipper, recipient, package, :service_type => :express)
98
+ ```
99
+
100
+ ## Requirements
101
+
102
+ You must have ImageMagick installed to run the demos.
103
+
104
+ ### Linux
105
+ #### Gentoo
106
+
107
+ emerge -pv imagemagick
108
+ emerge imagemagick
109
+
110
+ #### Ubuntu
111
+
112
+ sudo apt-get install imagemagick libmagic-dev libmagicwand-dev
113
+
114
+ ### OS X
115
+
116
+ #### Homebrew
117
+
118
+ brew install imagemagick
119
+
120
+ #### MacPorts
121
+
122
+ sudo port install imagemagick
123
+
124
+ #### Fink
125
+
126
+ fink install imagemagick
127
+
128
+ ## Developers information
129
+
130
+ SimpleShipping provides the following models which inherit SimpleShipping::Abstract::Model:
131
+ * Shipment
132
+ * Package
133
+ * Party
134
+ * Address
135
+ * Contact
136
+
137
+ Every service adapter has its own builders which know how to represent every
138
+ separated model to build SOAP request for a specific service. For example to represent
139
+ Package model, the FedEx adapter has Fedex::PackageBuilder and the UPS adapter has
140
+ Ups::PackageBuilder. All these model builders inherit SimpleShipping::Abstract::Builder.
141
+
142
+ Request builders are used to build whole request for the service. They inherit
143
+ Abstract::RequestBuilder.
144
+
145
+ Client is a facade which provides a public API to the user.
146
+ Every service has its own client but they all inherit Abstract::Client.
147
+ All clients provide the same interface:
148
+ * .new(credentials_hash)
149
+ * #request(shipper, recipient, package, opts)
150
+
151
+
152
+ ## Demo rake tasks
153
+
154
+ You can test the library against real remote requests.
155
+ For this you need to have a yaml file with your private
156
+ credentials, for example `credentials.yml` wich looks this way:
157
+
158
+ ```yaml
159
+ fedex:
160
+ key: "KEY"
161
+ password: "SECRET"
162
+ account_number: "ACCOUNT NUM"
163
+ meter_number: "METER NUM"
164
+
165
+ ups:
166
+ username: "USER"
167
+ account_number: "ACCOUNT NUM"
168
+ password: "SECRET"
169
+ :access_license_number: "LICENSE NUM"
170
+ ```
171
+
172
+ To run demo tasks:
173
+ ```
174
+ rake demo:fedex:shipment_request[credentials.yml]
175
+ rake demo:ups:shipment_request[credentials.yml]
176
+ rake demo:ups:void_request[credentials.yml]
177
+ ```
178
+
179
+ ## UPS certification
180
+
181
+ To run UPS certification:
182
+
183
+ ```
184
+ ./script/ups_certification.rb ./credentials.yml
185
+ ```
186
+
187
+ Where `credentials.yml` is file with format described above.
188
+
189
+ ## TODO
190
+
191
+ * Validation for country codes and states?
192
+ * Refactor
193
+ * Ability to get more information from response object than just a label(tracking number, etc)
194
+
195
+ ## Contributing to simple_shipping
196
+
197
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
198
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
199
+ * Fork the project
200
+ * Start a feature/bugfix branch
201
+ * Commit and push until you are happy with your contribution
202
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
203
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
204
+
205
+ ## Copyright
206
+
207
+ Copyright (c) 2011 TMX Credit. Author Potapov Sergey. See LICENSE.txt for further details.