auction_inc 0.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.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/Rakefile +46 -0
- data/VERSION +1 -0
- data/lib/auction_inc/shipping/base.rb +107 -0
- data/lib/auction_inc/shipping/carriers.yml +56 -0
- data/lib/auction_inc/shipping/node/body.rb +7 -0
- data/lib/auction_inc/shipping/node/calc_method.rb +8 -0
- data/lib/auction_inc/shipping/node/carrier.rb +10 -0
- data/lib/auction_inc/shipping/node/carrier_calc_props.rb +16 -0
- data/lib/auction_inc/shipping/node/destination_address.rb +10 -0
- data/lib/auction_inc/shipping/node/envelope.rb +8 -0
- data/lib/auction_inc/shipping/node/error.rb +10 -0
- data/lib/auction_inc/shipping/node/get_item_ship_rate_xs.rb +13 -0
- data/lib/auction_inc/shipping/node/header.rb +7 -0
- data/lib/auction_inc/shipping/node/item.rb +9 -0
- data/lib/auction_inc/shipping/node/origin_address.rb +10 -0
- data/lib/auction_inc/shipping/node/package.rb +25 -0
- data/lib/auction_inc/shipping/node/pkg_item.rb +9 -0
- data/lib/auction_inc/shipping/node/service.rb +11 -0
- data/lib/auction_inc/shipping/node/ship_rate.rb +27 -0
- data/lib/auction_inc/shipping/node.rb +15 -0
- data/lib/auction_inc/shipping/xs.rb +37 -0
- data/lib/auction_inc.rb +28 -0
- data/spec/auction_inc/shipping/base_spec.rb +77 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +8 -0
- metadata +123 -0
data/.document
ADDED
data/.gitignore
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 pjkelly
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= auction_inc
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 pjkelly. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "auction_inc"
|
8
|
+
gem.summary = %Q{Ruby wrapper around Auction Inc's shipping API.}
|
9
|
+
gem.description = gem.summary
|
10
|
+
gem.email = "pj@crushlovely.com"
|
11
|
+
gem.homepage = "http://github.com/pjkelly/auction_inc"
|
12
|
+
gem.authors = ["pjkelly"]
|
13
|
+
gem.add_dependency "roxml", ">= 3.1.5"
|
14
|
+
gem.add_development_dependency "rspec", ">= 1.2.9"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'spec/rake/spectask'
|
23
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
24
|
+
spec.libs << 'lib' << 'spec'
|
25
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
+
end
|
27
|
+
|
28
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
29
|
+
spec.libs << 'lib' << 'spec'
|
30
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
31
|
+
spec.rcov = true
|
32
|
+
end
|
33
|
+
|
34
|
+
task :spec => :check_dependencies
|
35
|
+
|
36
|
+
task :default => :spec
|
37
|
+
|
38
|
+
require 'rake/rdoctask'
|
39
|
+
Rake::RDocTask.new do |rdoc|
|
40
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
41
|
+
|
42
|
+
rdoc.rdoc_dir = 'rdoc'
|
43
|
+
rdoc.title = "auction_inc #{version}"
|
44
|
+
rdoc.rdoc_files.include('README*')
|
45
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
46
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,107 @@
|
|
1
|
+
module AuctionInc
|
2
|
+
module Shipping
|
3
|
+
class LicenseError < StandardError; end
|
4
|
+
class ConfigurationError < StandardError; end
|
5
|
+
class ConnectionError < StandardError; end
|
6
|
+
class RequestError < StandardError; end
|
7
|
+
class ResponseError < StandardError; end
|
8
|
+
|
9
|
+
class Base
|
10
|
+
cattr_accessor :license_key, :base_url, :base_path, :carriers_yml, :api_version, :detail_level, :currency, :weight_unit, :dimension_unit
|
11
|
+
|
12
|
+
# self.license_key = 'ee2e0c20b21fe733c57dcc82e6d250ab'
|
13
|
+
self.base_url = 'api.auctioninc.com'
|
14
|
+
self.base_path = '/websvc/shire'
|
15
|
+
self.carriers_yml = File.join(File.dirname(__FILE__), 'carriers.yml')
|
16
|
+
self.api_version = '2.1'
|
17
|
+
self.detail_level = 1
|
18
|
+
self.currency = :usd
|
19
|
+
self.weight_unit = :lbs
|
20
|
+
self.dimension_unit = :in
|
21
|
+
|
22
|
+
attr_accessor :response
|
23
|
+
|
24
|
+
def self.carriers
|
25
|
+
@carriers ||= load_carriers
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.load_carriers
|
29
|
+
carrier_data = YAML::load(Pathname.new(carriers_yml).read)
|
30
|
+
result = []
|
31
|
+
carrier_data.each do |carrier|
|
32
|
+
# TODO allow for PkgMaxWeight and OnDemand values
|
33
|
+
services = carrier['services'].collect { |s| Service.new(:name => s['name'], :code => s['code'], :klass => s['klass']) }
|
34
|
+
result << Carrier.new(:name => carrier['name'], :code => carrier['code'], :entry_point => carrier['entry_point'], :service_list => services)
|
35
|
+
end
|
36
|
+
result
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.entry_points
|
40
|
+
self.carriers.collect { |carrier| carrier.entry_point }
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.services
|
44
|
+
self.carriers.collect { |carrier| carrier.service_list }.flatten
|
45
|
+
end
|
46
|
+
|
47
|
+
def parsed_response
|
48
|
+
self.response
|
49
|
+
end
|
50
|
+
|
51
|
+
def make_request
|
52
|
+
if license_key.nil?
|
53
|
+
raise AuctionInc::Shipping::LicenseError.new("License Key is missing")
|
54
|
+
end
|
55
|
+
|
56
|
+
uri = URI.parse(base_url)
|
57
|
+
|
58
|
+
begin
|
59
|
+
http_server = Net::HTTP.new(base_url, 80)
|
60
|
+
http_request = Net::HTTP::Post.new(base_path)
|
61
|
+
http_request.body = self.request_xml
|
62
|
+
|
63
|
+
self.response = http_server.start { |http| http.request(http_request) }.body
|
64
|
+
rescue EOFError => e
|
65
|
+
raise ConnectionError, "The remote server dropped the connection"
|
66
|
+
rescue Errno::ECONNRESET => e
|
67
|
+
raise ConnectionError, "The remote server reset the connection"
|
68
|
+
rescue Errno::ECONNREFUSED => e
|
69
|
+
raise ConnectionError, "The remote server refused the connection"
|
70
|
+
rescue Timeout::Error, Errno::ETIMEDOUT => e
|
71
|
+
raise ConnectionError, "The connection to the remote server timed out"
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def request_xml
|
76
|
+
<<-HERE
|
77
|
+
<?xml version="1.0 encoding=iso-8859-1" utf-8 ?>
|
78
|
+
<Envelope>
|
79
|
+
<Header>
|
80
|
+
<AccountId>#{license_key}</AccountId>
|
81
|
+
</Header>
|
82
|
+
<Body>
|
83
|
+
<GetTime version="2.0">
|
84
|
+
</GetTime>
|
85
|
+
</Body>
|
86
|
+
</Envelope>
|
87
|
+
HERE
|
88
|
+
end
|
89
|
+
|
90
|
+
def valid_response?
|
91
|
+
!self.response.blank?
|
92
|
+
end
|
93
|
+
|
94
|
+
def weight_unit
|
95
|
+
AuctionInc::Shipping::Base.weight_unit.to_s.upcase
|
96
|
+
end
|
97
|
+
|
98
|
+
def dimension_unit
|
99
|
+
AuctionInc::Shipping::Base.dimension_unit.to_s.upcase
|
100
|
+
end
|
101
|
+
|
102
|
+
def currency
|
103
|
+
AuctionInc::Shipping::Base.currency.to_s.upcase
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
- name: Fed Ex
|
2
|
+
code: FEDEX
|
3
|
+
entry_point: R
|
4
|
+
services:
|
5
|
+
# - name: First Overnight
|
6
|
+
# code: FDXFO
|
7
|
+
# klass: 1
|
8
|
+
# - name: Priority Overnight
|
9
|
+
# code: FDXPO
|
10
|
+
# klass: 1
|
11
|
+
# - name: Priority Overnight Saturday Delivery
|
12
|
+
# code: FDXPOS
|
13
|
+
# klass: 1
|
14
|
+
# - name: Standard Overnight
|
15
|
+
# code: FDXSO
|
16
|
+
# klass: 1
|
17
|
+
- name: Ground
|
18
|
+
code: FDXGND
|
19
|
+
klass: G
|
20
|
+
- name: Home Delivery
|
21
|
+
code: FDXHD
|
22
|
+
klass: G
|
23
|
+
- name: 2 Day
|
24
|
+
code: FDX2D
|
25
|
+
klass: 2
|
26
|
+
- name: Express Saver
|
27
|
+
code: FDXES
|
28
|
+
klass: 3
|
29
|
+
- name: UPS
|
30
|
+
code: UPS
|
31
|
+
entry_point: P
|
32
|
+
services:
|
33
|
+
# - name: Next Day Air
|
34
|
+
# code: UPSNDA
|
35
|
+
# klass: 1
|
36
|
+
# - name: Next Day Air Early AM
|
37
|
+
# code: UPSNDE
|
38
|
+
# klass: 1
|
39
|
+
# - name: Next Day Air Saturday Delivery
|
40
|
+
# code: UPSNDAS
|
41
|
+
# klass: 1
|
42
|
+
# - name: Next Day Air Saver
|
43
|
+
# code: UPSNDS
|
44
|
+
# klass: 1
|
45
|
+
# - name: 2 Day Air AM
|
46
|
+
# code: UPS2DE
|
47
|
+
# klass: 2
|
48
|
+
- name: Ground
|
49
|
+
code: UPSGND
|
50
|
+
klass: G
|
51
|
+
- name: 2nd Day Air
|
52
|
+
code: UPS2ND
|
53
|
+
klass: 2
|
54
|
+
- name: 3 Day Select
|
55
|
+
code: UPS3DS
|
56
|
+
klass: 3
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module AuctionInc
|
2
|
+
module Shipping
|
3
|
+
class CarrierCalcProps < Node
|
4
|
+
xml_accessor :weight
|
5
|
+
xml_accessor :weight_u_o_m
|
6
|
+
xml_accessor :length
|
7
|
+
xml_accessor :width
|
8
|
+
xml_accessor :height
|
9
|
+
xml_accessor :dim_u_o_m
|
10
|
+
xml_accessor :lot_size
|
11
|
+
xml_accessor :declared_value
|
12
|
+
xml_accessor :pack_method
|
13
|
+
xml_accessor :origin_code
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module AuctionInc
|
2
|
+
module Shipping
|
3
|
+
class GetItemShipRateXs < Node
|
4
|
+
xml_accessor :version, :from => "@version"
|
5
|
+
xml_accessor :detail_level
|
6
|
+
xml_accessor :currency
|
7
|
+
xml_accessor :carrier_list, :as => [Carrier]
|
8
|
+
xml_accessor :origin_address_list, :as => [OriginAddress]
|
9
|
+
xml_accessor :destination_address, :as => DestinationAddress
|
10
|
+
xml_accessor :item_list, :as => [Item]
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module AuctionInc
|
2
|
+
module Shipping
|
3
|
+
class Package < Node
|
4
|
+
xml_accessor :quantity
|
5
|
+
xml_accessor :pack_method
|
6
|
+
xml_accessor :carrier_service
|
7
|
+
xml_accessor :origin
|
8
|
+
xml_accessor :declared_value
|
9
|
+
xml_accessor :weight
|
10
|
+
xml_accessor :length
|
11
|
+
xml_accessor :width
|
12
|
+
xml_accessor :height
|
13
|
+
xml_accessor :oversize_code
|
14
|
+
xml_accessor :flat_rate_code
|
15
|
+
xml_accessor :carrier_rate
|
16
|
+
xml_accessor :fixed_rate
|
17
|
+
xml_accessor :surcharge
|
18
|
+
xml_accessor :fuel_surcharge
|
19
|
+
xml_accessor :insurance
|
20
|
+
xml_accessor :handling
|
21
|
+
xml_accessor :ship_rate
|
22
|
+
xml_accessor :pkg_item, :as => [PkgItem]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module AuctionInc
|
2
|
+
module Shipping
|
3
|
+
class ShipRate < Node
|
4
|
+
# Detail Level 1
|
5
|
+
xml_accessor :valid
|
6
|
+
xml_accessor :carrier_code
|
7
|
+
xml_accessor :service_code
|
8
|
+
xml_accessor :service_name
|
9
|
+
xml_accessor :calc_method
|
10
|
+
xml_accessor :rate
|
11
|
+
xml_accessor :error_list, :as => [Error]
|
12
|
+
# Detail Level 1
|
13
|
+
xml_accessor :carrier_rate
|
14
|
+
xml_accessor :fixed_rate
|
15
|
+
xml_accessor :surcharges
|
16
|
+
xml_accessor :fuel_surcharges
|
17
|
+
xml_accessor :handling_fees
|
18
|
+
xml_accessor :declared_value
|
19
|
+
xml_accessor :insurance_charges
|
20
|
+
xml_accessor :weight
|
21
|
+
xml_accessor :package_count
|
22
|
+
xml_accessor :flat_rate_code
|
23
|
+
# Detail Level 3
|
24
|
+
xml_accessor :package_detail, :as => [Package]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module AuctionInc
|
2
|
+
module Shipping
|
3
|
+
class Node
|
4
|
+
include ROXML
|
5
|
+
xml_convention :camelcase
|
6
|
+
|
7
|
+
def initialize(options = {})
|
8
|
+
options.each do |key, value|
|
9
|
+
setter = "#{key.to_s}=".to_sym
|
10
|
+
self.send(setter, value) if self.respond_to?(setter)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module AuctionInc
|
2
|
+
module Shipping
|
3
|
+
class Xs < Base
|
4
|
+
attr_accessor :origin_addresses, :destination_address, :items
|
5
|
+
|
6
|
+
def request_xml
|
7
|
+
doc = Nokogiri::XML::Document.new
|
8
|
+
doc.root = self.envelope.to_xml
|
9
|
+
doc
|
10
|
+
end
|
11
|
+
|
12
|
+
def envelope
|
13
|
+
Envelope.new(:header => self.header, :body => self.body)
|
14
|
+
end
|
15
|
+
|
16
|
+
def header
|
17
|
+
Header.new(:account_id => self.class.license_key)
|
18
|
+
end
|
19
|
+
|
20
|
+
def body
|
21
|
+
Body.new(:get_item_ship_rate_x_s => self.content)
|
22
|
+
end
|
23
|
+
|
24
|
+
def content
|
25
|
+
content = GetItemShipRateXs.new
|
26
|
+
content.version = self.class.api_version
|
27
|
+
content.detail_level = self.class.detail_level
|
28
|
+
content.currency = self.currency
|
29
|
+
content.carrier_list = self.class.carriers
|
30
|
+
content.origin_address_list = origin_addresses unless origin_addresses.blank?
|
31
|
+
content.destination_address = destination_address unless destination_address.blank?
|
32
|
+
content.item_list = items unless items.blank?
|
33
|
+
content
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/auction_inc.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'roxml'
|
5
|
+
|
6
|
+
require 'auction_inc/shipping/node'
|
7
|
+
|
8
|
+
# Nodes without dependencies
|
9
|
+
require 'auction_inc/shipping/node/carrier_calc_props'
|
10
|
+
require 'auction_inc/shipping/node/destination_address'
|
11
|
+
require 'auction_inc/shipping/node/error'
|
12
|
+
require 'auction_inc/shipping/node/header'
|
13
|
+
require 'auction_inc/shipping/node/origin_address'
|
14
|
+
require 'auction_inc/shipping/node/pkg_item'
|
15
|
+
require 'auction_inc/shipping/node/service'
|
16
|
+
|
17
|
+
# Nodes with dependencies in order
|
18
|
+
require 'auction_inc/shipping/node/package'
|
19
|
+
require 'auction_inc/shipping/node/ship_rate'
|
20
|
+
require 'auction_inc/shipping/node/calc_method'
|
21
|
+
require 'auction_inc/shipping/node/item'
|
22
|
+
require 'auction_inc/shipping/node/carrier'
|
23
|
+
require 'auction_inc/shipping/node/get_item_ship_rate_xs'
|
24
|
+
require 'auction_inc/shipping/node/body'
|
25
|
+
require 'auction_inc/shipping/node/envelope'
|
26
|
+
|
27
|
+
require 'auction_inc/shipping/base'
|
28
|
+
require 'auction_inc/shipping/xs'
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe AuctionInc::Shipping::Base do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
AuctionInc::Shipping::Base.license_key = nil
|
7
|
+
end
|
8
|
+
|
9
|
+
it "@@base_url should be api.auctioninc.com by default" do
|
10
|
+
AuctionInc::Shipping::Base.base_url.should == 'api.auctioninc.com'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "@@base_path should be /websvc/shire by default" do
|
14
|
+
AuctionInc::Shipping::Base.base_path.should == '/websvc/shire'
|
15
|
+
end
|
16
|
+
|
17
|
+
it "@@api_version should be 2.1 by default" do
|
18
|
+
AuctionInc::Shipping::Base.api_version.should == '2.1'
|
19
|
+
end
|
20
|
+
|
21
|
+
it "@@detail_level should be 1 by default" do
|
22
|
+
AuctionInc::Shipping::Base.detail_level.should == 1
|
23
|
+
end
|
24
|
+
|
25
|
+
it "@@currency should be :usd by default" do
|
26
|
+
AuctionInc::Shipping::Base.currency.should == :usd
|
27
|
+
end
|
28
|
+
|
29
|
+
it "@@weight_unit should be :lbs by default" do
|
30
|
+
AuctionInc::Shipping::Base.weight_unit.should == :lbs
|
31
|
+
end
|
32
|
+
|
33
|
+
it "@@dimension_unit should be :in by default" do
|
34
|
+
AuctionInc::Shipping::Base.dimension_unit.should == :in
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should have no license_key initially" do
|
38
|
+
AuctionInc::Shipping::Base.license_key.should == nil
|
39
|
+
end
|
40
|
+
|
41
|
+
describe ".carriers" do
|
42
|
+
it "should return an array of carriers" do
|
43
|
+
AuctionInc::Shipping::Base.carriers.each { |carrier| carrier.should be_an(AuctionInc::Shipping::Carrier) }
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
describe ".entry_points" do
|
48
|
+
it "should return an array of all entry points" do
|
49
|
+
AuctionInc::Shipping::Base.entry_points.should == AuctionInc::Shipping::Base.carriers.collect { |c| c.entry_point }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe ".services" do
|
54
|
+
it "should return an array of all services" do
|
55
|
+
AuctionInc::Shipping::Base.services.should == AuctionInc::Shipping::Base.carriers.collect { |carrier| carrier.service_list }.flatten
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "#make_request" do
|
60
|
+
context "when no license key is present" do
|
61
|
+
it "should raise a license error" do
|
62
|
+
lambda {
|
63
|
+
AuctionInc::Shipping::Base.new.make_request
|
64
|
+
}.should raise_error(AuctionInc::Shipping::LicenseError)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "when a license key is present" do
|
69
|
+
it "return set the response" do
|
70
|
+
AuctionInc::Shipping::Base.license_key = '123'
|
71
|
+
service = AuctionInc::Shipping::Base.new
|
72
|
+
service.make_request
|
73
|
+
service.response.should_not be_blank
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,123 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: auction_inc
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
version: 0.1.0
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- pjkelly
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-08-02 00:00:00 -07:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: roxml
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 3
|
30
|
+
- 1
|
31
|
+
- 5
|
32
|
+
version: 3.1.5
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: rspec
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
segments:
|
44
|
+
- 1
|
45
|
+
- 2
|
46
|
+
- 9
|
47
|
+
version: 1.2.9
|
48
|
+
type: :development
|
49
|
+
version_requirements: *id002
|
50
|
+
description: Ruby wrapper around Auction Inc's shipping API.
|
51
|
+
email: pj@crushlovely.com
|
52
|
+
executables: []
|
53
|
+
|
54
|
+
extensions: []
|
55
|
+
|
56
|
+
extra_rdoc_files:
|
57
|
+
- LICENSE
|
58
|
+
- README.rdoc
|
59
|
+
files:
|
60
|
+
- .document
|
61
|
+
- .gitignore
|
62
|
+
- LICENSE
|
63
|
+
- README.rdoc
|
64
|
+
- Rakefile
|
65
|
+
- VERSION
|
66
|
+
- lib/auction_inc.rb
|
67
|
+
- lib/auction_inc/shipping/base.rb
|
68
|
+
- lib/auction_inc/shipping/carriers.yml
|
69
|
+
- lib/auction_inc/shipping/node.rb
|
70
|
+
- lib/auction_inc/shipping/node/body.rb
|
71
|
+
- lib/auction_inc/shipping/node/calc_method.rb
|
72
|
+
- lib/auction_inc/shipping/node/carrier.rb
|
73
|
+
- lib/auction_inc/shipping/node/carrier_calc_props.rb
|
74
|
+
- lib/auction_inc/shipping/node/destination_address.rb
|
75
|
+
- lib/auction_inc/shipping/node/envelope.rb
|
76
|
+
- lib/auction_inc/shipping/node/error.rb
|
77
|
+
- lib/auction_inc/shipping/node/get_item_ship_rate_xs.rb
|
78
|
+
- lib/auction_inc/shipping/node/header.rb
|
79
|
+
- lib/auction_inc/shipping/node/item.rb
|
80
|
+
- lib/auction_inc/shipping/node/origin_address.rb
|
81
|
+
- lib/auction_inc/shipping/node/package.rb
|
82
|
+
- lib/auction_inc/shipping/node/pkg_item.rb
|
83
|
+
- lib/auction_inc/shipping/node/service.rb
|
84
|
+
- lib/auction_inc/shipping/node/ship_rate.rb
|
85
|
+
- lib/auction_inc/shipping/xs.rb
|
86
|
+
- spec/auction_inc/shipping/base_spec.rb
|
87
|
+
- spec/spec.opts
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
has_rdoc: true
|
90
|
+
homepage: http://github.com/pjkelly/auction_inc
|
91
|
+
licenses: []
|
92
|
+
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options:
|
95
|
+
- --charset=UTF-8
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
107
|
+
none: false
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
segments:
|
112
|
+
- 0
|
113
|
+
version: "0"
|
114
|
+
requirements: []
|
115
|
+
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.3.7
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: Ruby wrapper around Auction Inc's shipping API.
|
121
|
+
test_files:
|
122
|
+
- spec/auction_inc/shipping/base_spec.rb
|
123
|
+
- spec/spec_helper.rb
|