shutl_resource 1.5.2 → 1.5.3
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.
- checksums.yaml +8 -8
- data/lib/shutl/resource/errors.rb +12 -13
- data/lib/shutl/resource/rest_class_methods.rb +1 -1
- data/lib/shutl/resource/version.rb +1 -1
- data/spec/remote_url_spec.rb +18 -0
- data/spec/rest_resource_spec.rb +0 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGEwZDkwNmM0YzExYmFjYTc1ZGFmMmE3Y2JhOWQzYzFkODk2MmYyMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
Zjg2NzY5YjU0NTYyMWRmZjM5YTg5MDQ1NTIxZWU5ZjVkNmNlNDljOQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MjY2ZTk3ZmY4NWJhYzk2YjE0NThiNzFiYTkyOTBmMTQ3ODk4YjBhYzcxYWFl
|
10
|
+
Yzk2MTJkNWVjYWE2YTM0N2FlMTkwYmUyZjMyODkwOWM2NzI5MWY2ZGY0N2Ri
|
11
|
+
ZjcxZGQ1ODFmNjU4Y2I5MDk5YzI5OTgwZjNhOGY3MTFiNGQ4MDM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZDNiYjg1YzM0ZTM5NDBjZTI0ODE5ZjIyZTU5NTFmZjgxMjFlMmJhYjM3MTY0
|
14
|
+
N2U2MjAwNTg4NjVkZTlkNzM0YzhkODg5MmFjMTVjZjg0YWIxOGIwZDNiMmJl
|
15
|
+
ZmFkMDNmZTQyNzBjMDllMDhiMjYzMDllZDdmNmNjZmEwODVjODQ=
|
@@ -10,16 +10,15 @@ end
|
|
10
10
|
# The correct solution to this would be to remove this exception from the gem
|
11
11
|
# and handle specifically in a QuoteCollection resource in for example the
|
12
12
|
# 'shutl' gem.
|
13
|
-
Shutl
|
14
|
-
|
15
|
-
Shutl::BadRequest = Class.new Shutl::Resource::Error
|
16
|
-
Shutl::UnauthorizedAccess = Class.new Shutl::Resource::Error
|
17
|
-
Shutl::ForbiddenAccess = Class.new Shutl::Resource::Error
|
18
|
-
Shutl::ResourceNotFound = Class.new Shutl::Resource::Error
|
19
|
-
Shutl::ResourceConflict = Class.new Shutl::Resource::Error
|
20
|
-
Shutl::ResourceGone = Class.new Shutl::Resource::Error
|
21
|
-
Shutl::ResourceInvalid = Class.new Shutl::Resource::Error
|
22
|
-
Shutl::ServerError = Class.new Shutl::Resource::Error
|
23
|
-
Shutl::ServiceUnavailable = Class.new Shutl::Resource::Error
|
24
|
-
|
25
|
-
|
13
|
+
unless Shutl.const_defined?('NoQuotesGenerated')
|
14
|
+
Shutl::NoQuotesGenerated = Class.new Shutl::Resource::Error
|
15
|
+
Shutl::BadRequest = Class.new Shutl::Resource::Error
|
16
|
+
Shutl::UnauthorizedAccess = Class.new Shutl::Resource::Error
|
17
|
+
Shutl::ForbiddenAccess = Class.new Shutl::Resource::Error
|
18
|
+
Shutl::ResourceNotFound = Class.new Shutl::Resource::Error
|
19
|
+
Shutl::ResourceConflict = Class.new Shutl::Resource::Error
|
20
|
+
Shutl::ResourceGone = Class.new Shutl::Resource::Error
|
21
|
+
Shutl::ResourceInvalid = Class.new Shutl::Resource::Error
|
22
|
+
Shutl::ServerError = Class.new Shutl::Resource::Error
|
23
|
+
Shutl::ServiceUnavailable = Class.new Shutl::Resource::Error
|
24
|
+
end
|
@@ -323,7 +323,7 @@ module Shutl::Resource
|
|
323
323
|
args, url = replace_args_from_pattern! args, url
|
324
324
|
|
325
325
|
url = URI.escape url
|
326
|
-
params = params.except(:headers, :auth, :from)
|
326
|
+
params = params.except(:headers, :auth, :from, 'headers', 'auth', 'from')
|
327
327
|
unless params.empty?
|
328
328
|
url += '?' + params.entries.map do |key, value|
|
329
329
|
URI::encode "#{key}=#{value}"
|
data/spec/remote_url_spec.rb
CHANGED
@@ -80,6 +80,24 @@ describe Shutl::Resource::Rest do
|
|
80
80
|
request.should have_been_requested
|
81
81
|
end
|
82
82
|
|
83
|
+
it 'should not send the auth param' do
|
84
|
+
request = stub_request(:get, 'http://host/nested/10/resources?arg1=val1&arg2=val2').
|
85
|
+
to_return(body: '{"nested_resources": []}', headers: headers)
|
86
|
+
|
87
|
+
NestedResource.all(parent_id: 10, arg1: 'val1', arg2: 'val2', auth: 'token')
|
88
|
+
|
89
|
+
request.should have_been_requested
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'should not send the auth param with an indexed by string hash' do
|
93
|
+
request = stub_request(:get, 'http://host/nested/10/resources?arg1=val1&arg2=val2').
|
94
|
+
to_return(body: '{"nested_resources": []}', headers: headers)
|
95
|
+
|
96
|
+
NestedResource.all('parent_id' => 10, 'arg1' => 'val1', 'arg2' => 'val2', 'auth' => 'token')
|
97
|
+
|
98
|
+
request.should have_been_requested
|
99
|
+
end
|
100
|
+
|
83
101
|
it 'should support the params with invalid uri name' do
|
84
102
|
request = stub_request(:get, 'http://host/nested/10/resources?arg1=val1&arg%2B2=val2').
|
85
103
|
to_return(body: '{"nested_resources": []}', headers: headers)
|
data/spec/rest_resource_spec.rb
CHANGED
@@ -485,14 +485,4 @@ describe Shutl::Resource::Rest do
|
|
485
485
|
subject.respond_to?(:foo).should be_false
|
486
486
|
end
|
487
487
|
end
|
488
|
-
|
489
|
-
describe 'parses successfuly a quote' do
|
490
|
-
let(:attrs) do
|
491
|
-
{"id"=>"5283836fe4b074c20bb4f4e1-1384351475", "created_at"=>"2013-11-13T13:49+00:00", "valid_until"=>"2013-11-13T14:15+00:00", "basket_value"=>999, "distance"=>12.1, "total_weight"=>nil, "time_zone"=>"America/Chicago", "merchant"=>{"id"=>"ebay_us", "name"=>"eBay US", "shutl_account_number"=>"", "notify_updates"=>true, "notification_endpoint"=>"https://triton-alpha.ebay.com/delivery-events-qa/shutl", "hide_customer_phone_from_carrier"=>false}, "pickup_location"=>{"notes"=>"", "address"=>{"company_name"=>"eBay US", "name"=>"", "line_1"=>"929 W Belmont Ave", "line_2"=>"", "county_or_state"=>"IL", "city"=>"Chicago", "postcode"=>"60657", "country"=>"US"}, "contact"=>{"name"=>"eBay US", "email"=>"email@example.com", "phone"=>"+1 7734720500"}}, "delivery_location"=>{"address"=>{"company_name"=>"", "name"=>"Dean Chen", "line_1"=>"500 S Central Ave", "line_2"=>"", "county_or_state"=>"IL", "city"=>"Chicago", "postcode"=>"60644", "country"=>"US"}, "contact"=>{"name"=>"Dean Chen", "email"=>"zhuichen@ebay.com", "phone"=>"+1 7840536666"}}, "carrier"=>{"id"=>"united_express_systems", "name"=>"United Express Systems", "shutl_account_number"=>"", "time_zone"=>"America/Chicago", "booking_api"=>{"manual"=>false, "url"=>"http://localhost:5000", "client_key"=>"4B91C40C7480A75069790A69AE97A56A", "client_id"=>"674611e57f"}, "vehicle"=>{"id"=>"small_van", "name"=>"Small van", "reference"=>"MiniVan"}, "out_of_hours_notification"=>{}}, "times"=>{"pickup_start"=>"2013-11-13T14:15+00:00", "pickup_finish"=>"2013-11-13T17:00+00:00", "delivery_start"=>"2013-11-13T17:00+00:00", "delivery_finish"=>"2013-11-13T18:00+00:00", "delivery_sla_buffer"=>900, "sliding_amount"=>0}, "prices"=>{"merchant"=>3075, "customer"=>3075, "carrier"=>2563}, "products"=>[]}
|
492
|
-
end
|
493
|
-
|
494
|
-
subject { TestRest.new attrs }
|
495
|
-
|
496
|
-
its(:prices) { should_not be_empty }
|
497
|
-
end
|
498
488
|
end
|