right_aws_api 0.3.4 → 0.3.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70504cc6fa36ede740358a16562cd1df06e2726f
4
- data.tar.gz: af7971a58c4ef781e66c44ea14aeb22818dbf10d
3
+ metadata.gz: 6492aa023c1c1ebd6bd48364935b1e3c7f06252a
4
+ data.tar.gz: b0ad4720da8e079270f04307a2096ea0a5ad69d1
5
5
  SHA512:
6
- metadata.gz: ba205723733d46d6befcc751a67c02ad08fa95dcae7ab78e53f0921718efb300f8f68601ad99e99fb145ffa2909ea0aea7fa17c25d393d0c6fd082889fc0022e
7
- data.tar.gz: 84001e30b3103ec1baea2b566bf387e3dbe46626f9d379d3dabd996df304a741b5cb3704c3cb66ae390016a2ac7397096b662b6a7a3cf1e8bf1aab3a7c085fa5
6
+ metadata.gz: 55ef622a2fa9f2baa1315af3e6c4d380038f9f1c8f47f50ade5c79bdabfdc7fef6d434eedfe7b42ffd5ecd9950c2d2d59177c941087f93e4f8ae0fe194ff7c0c
7
+ data.tar.gz: b1ba2b1e5d6c0474152c048510263fbacbe0da034cebeb23f91257e61315889ddf006756bf5959e95c0026dfab7fc468a6a87ccf4abc804d806b4f5496625895
data/HISTORY CHANGED
@@ -1,4 +1,7 @@
1
1
  == current (not released as a gem yet)
2
+ == 2016-10-18, v0.3.5
3
+ - Fixed a bug in MWS error parsing
4
+ - Bumped right_cloud_api_base version to not use net-http-persistent 3.0+
2
5
  == 2015-11-11, v0.3.4
3
6
  - Add LimitRateExceeded to the retryable error types
4
7
  == 2015-09-24, v0.3.3
@@ -45,4 +48,4 @@
45
48
  == 2014-10-30, v0.2.1
46
49
  - Added support for AWS v4 signature and make it the default
47
50
 
48
- == 2013-06-28, pre-release
51
+ == 2013-06-28, pre-release
@@ -327,7 +327,7 @@ module RightScale
327
327
  #
328
328
  # @example
329
329
  # # Do not use DNS-like bucket hosts but put buckets into path
330
- # link = RightScale::CloudApi::AWS::S3::Link::Manager::new(key, secret, endpoint, :no_dns_buckets => true)
330
+ # link = RightScale::CloudApi::AWS::S3::Link::Manager::new(key, secret, endpoint, :cloud => { :no_dns_buckets => true })
331
331
  # link.GetObject('Bucket' => 'foo', 'Object' => 'bar') #=>
332
332
  # 'https://s3.amazonaws.com/foo/bar?AWSAccessKeyId=AK...TA&Expires=1436557118&
333
333
  # Signature=hg...%3D&response-content-type=image%2Fpeg'
@@ -407,4 +407,4 @@ module RightScale
407
407
  end
408
408
  end
409
409
  end
410
- end
410
+ end
@@ -283,7 +283,7 @@ module RightScale
283
283
  :params => { 'uploads' => '' }
284
284
 
285
285
 
286
- base.query_api_pattern 'UploadPart', :post, '{:Bucket}/{:Object}',
286
+ base.query_api_pattern 'UploadPart', :put, '{:Bucket}/{:Object}',
287
287
  :params => { 'partNumber' => :PartNumber,
288
288
  'uploadId' => :UploadId },
289
289
  :headers => { 'content-type' => 'binary/octet-stream' }
@@ -298,7 +298,7 @@ module RightScale
298
298
  base.query_api_pattern 'CompleteMultipartUpload', :post, '{:Bucket}/{:Object}',
299
299
  :params => { 'uploadId' => :UploadId },
300
300
  :body => { 'CompleteMultipartUpload' => :CompleteMultipartUpload },
301
- :headers => { 'x-amz-acl' => :Acl, 'content-type' => 'application/xml'}
301
+ :headers => { 'content-type' => 'application/xml'}
302
302
 
303
303
 
304
304
  base.query_api_pattern 'AbortMultipartUpload', :delete, '{:Bucket}/{:Object}',
@@ -22,6 +22,7 @@
22
22
  #++
23
23
 
24
24
  require "cloud/mws/base/routines/request_signer"
25
+ require "cloud/mws/base/parsers/response_error"
25
26
 
26
27
  module RightScale
27
28
  module CloudApi
@@ -51,6 +52,8 @@ module RightScale
51
52
  set_routine ResponseParser
52
53
  set_routine ResultWrapper
53
54
 
55
+ set :response_error_parser => Parser::MWS::ResponseError
56
+
54
57
  def api(action, params={}, &block)
55
58
  params['Action'] ||= action.to_s._snake_case._camelize
56
59
  opts = {}
@@ -0,0 +1,75 @@
1
+ #--
2
+ # Copyright (c) 2016 RightScale, Inc.
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 NONINFRINGEMENT.
18
+ # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19
+ # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20
+ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21
+ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+
24
+
25
+ module RightScale
26
+ module CloudApi
27
+ module Parser
28
+ # MWS namespace
29
+ module MWS
30
+
31
+ class ResponseError
32
+
33
+ # Parse HTTP error message from a response body
34
+ #
35
+ # @param [RightScale::CloudApi::HTTPResponse] response
36
+ # @param [Hash] options
37
+ # @option options [Class] :xml_parser
38
+ #
39
+ # @return [String]
40
+ #
41
+ # @example
42
+ # <?xml version="1.0" encoding="UTF-8"?>
43
+ # <ErrorResponse xmlns="http://mws.amazonaws.com/FulfillmentInboundShipment/2010-10-01/">
44
+ # <Error>
45
+ # <Type>Sender</Type>
46
+ # <Code>InvalidRequestException</Code>
47
+ # <Message>Reason: Cannot change Status of Shipment.</Message>
48
+ # </Error>
49
+ # <RequestId>dc32b07f-0ffb-4a4b-aab4-9f5fbb8d8797</RequestId>
50
+ # </ErrorResponse>
51
+ # # And the method parse all above into:
52
+ # 400: InvalidRequestException: Reason: Cannot change Status of Shipment. (RequestID: dc32b07f-0ffb-4a4b-aab4-9f5fbb8d8797)
53
+ #
54
+ def self.parse(response, options={})
55
+ result = "#{response.code}: "
56
+ body = response.body.to_s
57
+ if response['content-type'].to_s[/xml/] || body[/\A<\?xml /]
58
+ hash = Utils::get_xml_parser_class(options[:xml_parser]).parse(body)
59
+ if hash["ErrorResponse"]
60
+ error = hash["ErrorResponse"]["Error"]
61
+ result = "#{error['Code']}: #{error['Message']}"
62
+ # Add RequestId
63
+ result << " (RequestID: #{hash["ErrorResponse"]["RequestId"]})"
64
+ end
65
+ else
66
+ result << "#{body}" unless body._blank?
67
+ end
68
+ result
69
+ end
70
+
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -33,7 +33,7 @@ module RightScale
33
33
  # Gem version namespace
34
34
  module VERSION
35
35
  # Current version
36
- STRING = '0.3.4'
36
+ STRING = '0.3.5'
37
37
  end
38
38
  end
39
39
  end
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.require_path = 'lib'
36
36
  spec.required_ruby_version = '>= 1.8.7'
37
37
 
38
- spec.add_dependency 'right_cloud_api_base', '>= 0.2.2'
38
+ spec.add_dependency 'right_cloud_api_base', '>= 0.2.6'
39
39
 
40
40
  spec.add_development_dependency 'rake'
41
41
  spec.add_development_dependency 'rspec', '>= 3.0.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_aws_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - RightScale, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-17 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: right_cloud_api_base
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.2.2
19
+ version: 0.2.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.2
26
+ version: 0.2.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -121,6 +121,7 @@ files:
121
121
  - lib/cloud/ecs/pa/parsers/response_error.rb
122
122
  - lib/cloud/ecs/pa/routines/request_signer.rb
123
123
  - lib/cloud/mws/base/manager.rb
124
+ - lib/cloud/mws/base/parsers/response_error.rb
124
125
  - lib/cloud/mws/base/routines/request_signer.rb
125
126
  - lib/cloud/mws/cart_information/manager.rb
126
127
  - lib/cloud/mws/customer_information/manager.rb
@@ -165,12 +166,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
166
  version: '0'
166
167
  requirements: []
167
168
  rubyforge_project:
168
- rubygems_version: 2.4.3
169
+ rubygems_version: 2.2.2
169
170
  signing_key:
170
171
  specification_version: 4
171
172
  summary: The gem provides interface to AWS cloud services.
172
173
  test_files:
173
- - spec/describe_calls.rb
174
- - spec/cloud/aws/s3/routines/request_signer_spec.rb
175
174
  - spec/cloud/aws/base/helpers/utils_spec.rb
175
+ - spec/cloud/aws/s3/routines/request_signer_spec.rb
176
+ - spec/describe_calls.rb
176
177
  has_rdoc: