shutl_resource 1.5.2 → 1.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MzQzZjljYzZjYmY0MjVkMmEzZTFmODIyMDU2N2UyMzQwN2I3YmVkOA==
4
+ MGEwZDkwNmM0YzExYmFjYTc1ZGFmMmE3Y2JhOWQzYzFkODk2MmYyMQ==
5
5
  data.tar.gz: !binary |-
6
- ZDRmODZkZTMxMWI1MjA5NWUxMzEwN2U4ZDRjODE3OGIyOWZjMGYxZA==
6
+ Zjg2NzY5YjU0NTYyMWRmZjM5YTg5MDQ1NTIxZWU5ZjVkNmNlNDljOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZTgwMDY2ODUyN2E4ZGM1Y2ZkNGRjNGRkYzcxNmM4ZTAwMDRmYjhlMDI4OWUz
10
- MmRjMDc3MGYyMzFhN2I3ZWVlOTkzYmFlNTQ1NDZjNjc3NjQ3ZWEyNzk3ZWNh
11
- ZTEwYjdhNDc2OTgwMTkxOGRiNDAwYmJlYjhlZjkwOTY5NWYwZjY=
9
+ MjY2ZTk3ZmY4NWJhYzk2YjE0NThiNzFiYTkyOTBmMTQ3ODk4YjBhYzcxYWFl
10
+ Yzk2MTJkNWVjYWE2YTM0N2FlMTkwYmUyZjMyODkwOWM2NzI5MWY2ZGY0N2Ri
11
+ ZjcxZGQ1ODFmNjU4Y2I5MDk5YzI5OTgwZjNhOGY3MTFiNGQ4MDM=
12
12
  data.tar.gz: !binary |-
13
- OGZhMDY5NDZkMDA2MDAzMDAyNTBiYTIzZWQyZGFiZWM1N2QyZTY1MzQzNDI5
14
- OTZjOWE0Mjg4N2I5NjNjNTM2ZjYyNGExODcxZGQ1OTExNzU2NThlNWJjYmVk
15
- Zjk1MTY0NGNhMDhjM2QyYTkwYWI2NTQ5Y2JkZTdlOGU1YTk5MjE=
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::NoQuotesGenerated = Class.new Shutl::Resource::Error
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}"
@@ -1,5 +1,5 @@
1
1
  module Shutl
2
2
  module Resource
3
- VERSION = '1.5.2'
3
+ VERSION = '1.5.3'
4
4
  end
5
5
  end
@@ -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)
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shutl_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Rouchy