copious-fedex 1.1.0

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.
@@ -0,0 +1,4 @@
1
+ # We do this because the newer versions of the Fedex API are secured using a chained certificate
2
+ # This just tells SSL not to verify the certificate
3
+ # See http://stackoverflow.com/questions/1555006/how-do-i-tell-rubys-openssl-library-to-ignore-a-self-signed-certificate-error
4
+ client.protocol.http.ssl_config.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -0,0 +1,27 @@
1
+ # Copyright (c) 2007 Joseph Jaramillo
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ $:.unshift(File.dirname(__FILE__))
22
+
23
+ require 'soap/wsdlDriver'
24
+ require 'cgi'
25
+ require 'base64'
26
+
27
+ require 'fedex'
@@ -0,0 +1 @@
1
+ integration.yml
@@ -0,0 +1,11 @@
1
+ require 'test/integration_test_runner'
2
+
3
+ test_label :shipper => fake_address("Portland", "OR", "97211"),
4
+ :recipient => fake_address("Portland", "OR", "97214"),
5
+ :weight => 5,
6
+ :service_type => Fedex::ServiceTypes::FEDEX_GROUND
7
+
8
+ test_label :shipper => fake_address("Portland", "OR", "97211"),
9
+ :recipient => fake_address("Provincetown", "MA", "02657"),
10
+ :weight => 15,
11
+ :service_type => Fedex::ServiceTypes::PRIORITY_OVERNIGHT
@@ -0,0 +1,73 @@
1
+ #!ruby
2
+
3
+ require 'rubygems'
4
+ require 'faker'
5
+ require 'activesupport'
6
+ require 'digest/md5'
7
+
8
+ require 'init'
9
+
10
+ YAML_SOURCE = "test/integration.yml"
11
+ begin
12
+ fedex_info = YAML.load(File.read YAML_SOURCE)
13
+ rescue => err
14
+ $stderr.puts "This test requires test/integration.yml to be populated with FedEx testing information."
15
+ if File.exist?(YAML_SOURCE)
16
+ $stderr.puts "That file exists, but there's something wrong with it."
17
+ raise err
18
+ else
19
+ $stderr.puts "I'll create the file for you. Edit it and enter your own information and then re-run this script."
20
+ File.open(YAML_SOURCE, "w") do |out|
21
+ out << ":auth_key: AUTH_KEY\n:security_code: CODE\n:account_number: ACCT\n:meter_number: METER\n"
22
+ end
23
+ exit 1
24
+ end
25
+ end
26
+ @fedex = Fedex::Base.new fedex_info
27
+ @report = []
28
+
29
+ def test_label(fields)
30
+ price, label, tracking_number = @fedex.label(fields)
31
+ @report << {
32
+ :in => fields,
33
+ :out => { :price => price, :label => label, :tracking_number => tracking_number }
34
+ }
35
+ end
36
+
37
+ # Name, phone number, etc. are faked; city, state and zip are germane so they can't be.
38
+ def fake_address(city, state, zip)
39
+ return {
40
+ :contact => {
41
+ :name => Faker::Name.name,
42
+ :phone_number => Faker::PhoneNumber.phone_number,
43
+ },
44
+ :address => {
45
+ :country => "US",
46
+ :street => Faker::Address.street_address,
47
+ :city => city,
48
+ :state => state,
49
+ :zip => zip,
50
+ }
51
+ }
52
+ end
53
+
54
+ def make_report
55
+ report_id = Time.now.strftime "%Y%m%d%H%M%S"
56
+ dest = "tmp/test-out-#{report_id}"
57
+ Dir.mkdir(dest)
58
+ puts "Generating test output for #{dest}:"
59
+ @report.each do |report|
60
+ output_id = Digest::MD5.hexdigest(report[:in].inspect)
61
+ label_data = report[:out].delete(:label)
62
+ File.open("#{dest}/#{output_id}.txt", "w") do |out|
63
+ out << report.to_yaml
64
+ end
65
+ puts ".. #{output_id}.txt"
66
+ File.open("#{dest}/#{output_id}.pdf", "w") do |out|
67
+ out << label_data
68
+ end
69
+ puts ".. #{output_id}.pdf"
70
+ end
71
+ end
72
+
73
+ at_exit { make_report }
@@ -0,0 +1,2 @@
1
+ *
2
+ !/.gitignore
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: copious-fedex
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Joseph Jamarillo
8
+ - Elliot Winkler
9
+ - Laurence A. Lee
10
+ - Matthew Boeh
11
+ autorequire:
12
+ bindir: bin
13
+ cert_chain: []
14
+
15
+ date: 2010-06-07 00:00:00 -07:00
16
+ default_executable:
17
+ dependencies: []
18
+
19
+ description: Retrieve shipping quotes, generate labels, and cancel shipments with the FedEx v8 web service.
20
+ email: matt@copiousinc.com
21
+ executables: []
22
+
23
+ extensions: []
24
+
25
+ extra_rdoc_files:
26
+ - README.rdoc
27
+ files:
28
+ - .gitignore
29
+ - MIT-LICENSE
30
+ - README.rdoc
31
+ - Rakefile
32
+ - VERSION
33
+ - lib/fedex.rb
34
+ - lib/fedex/rate_constants.rb
35
+ - lib/fedex/ship_constants.rb
36
+ - lib/soap/property
37
+ - rails/init.rb
38
+ - test/.gitignore
39
+ - test/integration_test.rb
40
+ - test/integration_test_runner.rb
41
+ - tmp/.gitignore
42
+ has_rdoc: true
43
+ homepage: http://github.com/copious/fedex
44
+ post_install_message:
45
+ rdoc_options:
46
+ - --charset=UTF-8
47
+ require_paths:
48
+ - lib
49
+ required_ruby_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: "0"
60
+ version:
61
+ requirements: []
62
+
63
+ rubyforge_project:
64
+ rubygems_version: 1.3.1
65
+ signing_key:
66
+ specification_version: 2
67
+ summary: Retrieve shipping quotes, generate labels, and cancel shipments with the FedEx v8 web service.
68
+ test_files:
69
+ - test/integration_test_runner.rb
70
+ - test/integration_test.rb