aws-sdk 1.5.8 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/aws.rb +2 -0
- data/lib/aws/api_config/Route53-2012-02-29.yml +348 -0
- data/lib/aws/auto_scaling/client.rb +362 -588
- data/lib/aws/cloud_formation/client.rb +155 -224
- data/lib/aws/cloud_watch/client.rb +156 -229
- data/lib/aws/core.rb +67 -52
- data/lib/aws/core/client.rb +81 -82
- data/lib/aws/core/collection/with_limit_and_next_token.rb +2 -2
- data/lib/aws/core/configuration.rb +75 -72
- data/lib/aws/core/http/net_http_handler.rb +3 -3
- data/lib/aws/core/http/request.rb +107 -138
- data/lib/aws/core/inflection.rb +3 -3
- data/lib/aws/core/json_client.rb +106 -0
- data/lib/aws/core/option_grammar.rb +10 -1
- data/lib/aws/core/options/validator.rb +140 -0
- data/lib/aws/core/options/xml_serializer.rb +98 -0
- data/lib/aws/core/query_client.rb +131 -0
- data/lib/aws/core/rest_client.rb +90 -0
- data/lib/aws/core/rest_client/input_handler.rb +145 -0
- data/lib/aws/core/rest_client/output_handler.rb +43 -0
- data/lib/aws/core/signature/version_2.rb +7 -7
- data/lib/aws/core/signature/version_3.rb +5 -1
- data/lib/aws/core/signature/version_3_https.rb +51 -0
- data/lib/aws/core/signature/version_4.rb +5 -22
- data/lib/aws/core/signer.rb +1 -1
- data/lib/aws/core/uri_escape.rb +2 -0
- data/lib/aws/core/xml/frame.rb +8 -8
- data/lib/aws/core/xml/grammar.rb +8 -3
- data/lib/aws/dynamo_db/client.rb +600 -662
- data/lib/aws/ec2/client.rb +2688 -3492
- data/lib/aws/ec2/request.rb +0 -1
- data/lib/aws/elb/client.rb +280 -407
- data/lib/aws/emr/client.rb +7 -7
- data/lib/aws/iam/client.rb +822 -1268
- data/lib/aws/route_53.rb +71 -0
- data/lib/aws/route_53/client.rb +272 -0
- data/lib/aws/route_53/config.rb +18 -0
- data/lib/aws/route_53/errors.rb +22 -0
- data/lib/aws/route_53/request.rb +23 -0
- data/lib/aws/s3/object_version_collection.rb +6 -6
- data/lib/aws/s3/paginated_collection.rb +1 -1
- data/lib/aws/s3/request.rb +10 -5
- data/lib/aws/simple_db/client.rb +184 -234
- data/lib/aws/simple_email_service/client.rb +147 -238
- data/lib/aws/simple_workflow/client.rb +997 -1191
- data/lib/aws/sns/client.rb +176 -264
- data/lib/aws/sqs/client.rb +162 -253
- data/lib/aws/sqs/queue.rb +1 -1
- data/lib/aws/sqs/request.rb +4 -0
- data/lib/aws/sts/client.rb +57 -66
- metadata +95 -71
- data/lib/aws/core/client/query_json.rb +0 -112
- data/lib/aws/core/client/query_xml.rb +0 -122
data/lib/aws/sqs/queue.rb
CHANGED
data/lib/aws/sqs/request.rb
CHANGED
data/lib/aws/sts/client.rb
CHANGED
@@ -19,7 +19,7 @@ module AWS
|
|
19
19
|
|
20
20
|
API_VERSION = '2011-06-15'
|
21
21
|
|
22
|
-
extend Core::
|
22
|
+
extend Core::QueryClient
|
23
23
|
|
24
24
|
REGION_US_E1 = 'sts.amazonaws.com'
|
25
25
|
|
@@ -39,77 +39,68 @@ module AWS
|
|
39
39
|
|
40
40
|
# Calls the GetFederationToken API operation.
|
41
41
|
# @method get_federation_token(options = {})
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
#
|
52
|
-
#
|
53
|
-
#
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
# hours) as the default.
|
59
|
-
#
|
60
|
-
# === Response Structure:
|
61
|
-
#
|
62
|
-
# * +:credentials+ - (Hash)
|
63
|
-
# * +:access_key_id+ - (String)
|
64
|
-
# * +:secret_access_key+ - (String)
|
65
|
-
# * +:session_token+ - (String)
|
66
|
-
# * +:expiration+ - (Time)
|
67
|
-
# * +:federated_user+ - (Hash)
|
68
|
-
# * +:federated_user_id+ - (String)
|
69
|
-
# * +:arn+ - (String)
|
70
|
-
# * +:packed_policy_size+ - (Integer)
|
71
|
-
#
|
42
|
+
# @param [Hash] options
|
43
|
+
# * +:name+ - *required* - (String) The name of the federated user
|
44
|
+
# associated with the credentials. For information about limitations
|
45
|
+
# on user names, go to Limitations on IAM Entities in Using AWS
|
46
|
+
# Identity and Access Management.
|
47
|
+
# * +:policy+ - (String) A policy specifying the permissions to
|
48
|
+
# associate with the credentials. The caller can delegate their own
|
49
|
+
# permissions by specifying a policy, and both policies will be
|
50
|
+
# checked when a service call is made. For more information about how
|
51
|
+
# permissions work in the context of temporary credentials, see
|
52
|
+
# Controlling Permissions in Temporary Credentials in Using AWS
|
53
|
+
# Identity and Access Management.
|
54
|
+
# * +:duration_seconds+ - (Integer) The duration, in seconds, that the
|
55
|
+
# session should last. Acceptable durations for federation sessions
|
56
|
+
# range from 3600s (one hour) to 129600s (36 hours), with 43200s (12
|
57
|
+
# hours) as the default.
|
72
58
|
# @return [Core::Response]
|
73
|
-
#
|
59
|
+
# The #data method of the response object returns
|
60
|
+
# a hash with the following structure:
|
61
|
+
# * +:credentials+ - (Hash)
|
62
|
+
# * +:access_key_id+ - (String)
|
63
|
+
# * +:secret_access_key+ - (String)
|
64
|
+
# * +:session_token+ - (String)
|
65
|
+
# * +:expiration+ - (Time)
|
66
|
+
# * +:federated_user+ - (Hash)
|
67
|
+
# * +:federated_user_id+ - (String)
|
68
|
+
# * +:arn+ - (String)
|
69
|
+
# * +:packed_policy_size+ - (Integer)
|
74
70
|
define_client_method :get_federation_token, 'GetFederationToken'
|
75
71
|
|
76
72
|
# Calls the GetSessionToken API operation.
|
77
73
|
# @method get_session_token(options = {})
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
# For more information, see Using Multi-Factor Authentication (MFA)
|
101
|
-
# Devices with AWS in Using IAM.
|
102
|
-
#
|
103
|
-
# === Response Structure:
|
104
|
-
#
|
105
|
-
# * +:credentials+ - (Hash)
|
106
|
-
# * +:access_key_id+ - (String)
|
107
|
-
# * +:secret_access_key+ - (String)
|
108
|
-
# * +:session_token+ - (String)
|
109
|
-
# * +:expiration+ - (Time)
|
110
|
-
#
|
74
|
+
# @param [Hash] options
|
75
|
+
# * +:duration_seconds+ - (Integer) The duration, in seconds, that the
|
76
|
+
# credentials should remain valid. Acceptable durations for IAM user
|
77
|
+
# sessions range from 3600s (one hour) to 129600s (36 hours), with
|
78
|
+
# 43200s (12 hours) as the default. Sessions for AWS account owners
|
79
|
+
# are restricted to a maximum of 3600s (one hour).
|
80
|
+
# * +:serial_number+ - (String) The identification number of the
|
81
|
+
# Multi-Factor Authentication (MFA) device for the user. If the user
|
82
|
+
# has an access policy requiring MFA to access resources, provide the
|
83
|
+
# value here. The number is in the Security Credentials tab of the
|
84
|
+
# user's details pane in the IAM console. If the user has an active
|
85
|
+
# MFA device, the details pane displays a Multi-Factor Authentication
|
86
|
+
# Device value such as arn:aws:iam::123456789012:mfa/user for a
|
87
|
+
# virtual device or the device serial number for a hardware device.
|
88
|
+
# * +:token_code+ - (String) The value provided by the MFA device. If
|
89
|
+
# the user has an access policy requiring an MFA code, provide the
|
90
|
+
# value here to get permission to resources as specified in the
|
91
|
+
# access policy. If MFA is required, and a code not provided while
|
92
|
+
# requesting a set of temporary security credentials, the user will
|
93
|
+
# receive an "access denied" response when requesting resources that
|
94
|
+
# require MFA. For more information, see Using Multi-Factor
|
95
|
+
# Authentication (MFA) Devices with AWS in Using IAM.
|
111
96
|
# @return [Core::Response]
|
112
|
-
#
|
97
|
+
# The #data method of the response object returns
|
98
|
+
# a hash with the following structure:
|
99
|
+
# * +:credentials+ - (Hash)
|
100
|
+
# * +:access_key_id+ - (String)
|
101
|
+
# * +:secret_access_key+ - (String)
|
102
|
+
# * +:session_token+ - (String)
|
103
|
+
# * +:expiration+ - (Time)
|
113
104
|
define_client_method :get_session_token, 'GetSessionToken'
|
114
105
|
|
115
106
|
## end client methods ##
|
metadata
CHANGED
@@ -1,86 +1,92 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: aws-sdk
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 15
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 6
|
9
|
+
- 0
|
10
|
+
version: 1.6.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Amazon Web Services
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
+
|
18
|
+
date: 2012-07-30 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
17
22
|
none: false
|
18
|
-
requirements:
|
23
|
+
requirements:
|
19
24
|
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
hash: 1
|
27
|
+
segments:
|
28
|
+
- 2
|
29
|
+
- 1
|
30
|
+
version: "2.1"
|
31
|
+
name: uuidtools
|
22
32
|
type: :runtime
|
23
33
|
prerelease: false
|
24
|
-
|
34
|
+
requirement: *id001
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
25
37
|
none: false
|
26
|
-
requirements:
|
38
|
+
requirements:
|
27
39
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
hash: 5
|
42
|
+
segments:
|
43
|
+
- 0
|
44
|
+
- 7
|
45
|
+
version: "0.7"
|
31
46
|
name: httparty
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ~>
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0.7'
|
38
47
|
type: :runtime
|
39
48
|
prerelease: false
|
40
|
-
|
49
|
+
requirement: *id002
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
41
52
|
none: false
|
42
|
-
requirements:
|
43
|
-
- -
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
hash: 15
|
57
|
+
segments:
|
58
|
+
- 1
|
59
|
+
- 4
|
60
|
+
- 4
|
53
61
|
version: 1.4.4
|
62
|
+
name: nokogiri
|
54
63
|
type: :runtime
|
55
64
|
prerelease: false
|
56
|
-
|
65
|
+
requirement: *id003
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
57
68
|
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 1.4.4
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: json
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
69
|
+
requirements:
|
67
70
|
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
hash: 7
|
73
|
+
segments:
|
74
|
+
- 1
|
75
|
+
- 4
|
76
|
+
version: "1.4"
|
77
|
+
name: json
|
70
78
|
type: :runtime
|
71
79
|
prerelease: false
|
72
|
-
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '1.4'
|
80
|
+
requirement: *id004
|
78
81
|
description: AWS SDK for Ruby
|
79
82
|
email:
|
80
83
|
executables: []
|
84
|
+
|
81
85
|
extensions: []
|
86
|
+
|
82
87
|
extra_rdoc_files: []
|
83
|
-
|
88
|
+
|
89
|
+
files:
|
84
90
|
- ca-bundle.crt
|
85
91
|
- rails/init.rb
|
86
92
|
- lib/aws/auto_scaling/activity.rb
|
@@ -137,8 +143,6 @@ files:
|
|
137
143
|
- lib/aws/core/async_handle.rb
|
138
144
|
- lib/aws/core/autoloader.rb
|
139
145
|
- lib/aws/core/cacheable.rb
|
140
|
-
- lib/aws/core/client/query_json.rb
|
141
|
-
- lib/aws/core/client/query_xml.rb
|
142
146
|
- lib/aws/core/client.rb
|
143
147
|
- lib/aws/core/collection/simple.rb
|
144
148
|
- lib/aws/core/collection/with_limit_and_next_token.rb
|
@@ -155,21 +159,29 @@ files:
|
|
155
159
|
- lib/aws/core/http/response.rb
|
156
160
|
- lib/aws/core/indifferent_hash.rb
|
157
161
|
- lib/aws/core/inflection.rb
|
162
|
+
- lib/aws/core/json_client.rb
|
158
163
|
- lib/aws/core/lazy_error_classes.rb
|
159
164
|
- lib/aws/core/log_formatter.rb
|
160
165
|
- lib/aws/core/meta_utils.rb
|
161
166
|
- lib/aws/core/model.rb
|
162
167
|
- lib/aws/core/naming.rb
|
163
168
|
- lib/aws/core/option_grammar.rb
|
169
|
+
- lib/aws/core/options/validator.rb
|
170
|
+
- lib/aws/core/options/xml_serializer.rb
|
164
171
|
- lib/aws/core/page_result.rb
|
165
172
|
- lib/aws/core/policy.rb
|
173
|
+
- lib/aws/core/query_client.rb
|
166
174
|
- lib/aws/core/resource.rb
|
167
175
|
- lib/aws/core/resource_cache.rb
|
168
176
|
- lib/aws/core/response.rb
|
169
177
|
- lib/aws/core/response_cache.rb
|
178
|
+
- lib/aws/core/rest_client/input_handler.rb
|
179
|
+
- lib/aws/core/rest_client/output_handler.rb
|
180
|
+
- lib/aws/core/rest_client.rb
|
170
181
|
- lib/aws/core/service_interface.rb
|
171
182
|
- lib/aws/core/signature/version_2.rb
|
172
183
|
- lib/aws/core/signature/version_3.rb
|
184
|
+
- lib/aws/core/signature/version_3_https.rb
|
173
185
|
- lib/aws/core/signature/version_4.rb
|
174
186
|
- lib/aws/core/signer.rb
|
175
187
|
- lib/aws/core/uri_escape.rb
|
@@ -362,6 +374,11 @@ files:
|
|
362
374
|
- lib/aws/record/validators/numericality.rb
|
363
375
|
- lib/aws/record/validators/presence.rb
|
364
376
|
- lib/aws/record.rb
|
377
|
+
- lib/aws/route_53/client.rb
|
378
|
+
- lib/aws/route_53/config.rb
|
379
|
+
- lib/aws/route_53/errors.rb
|
380
|
+
- lib/aws/route_53/request.rb
|
381
|
+
- lib/aws/route_53.rb
|
365
382
|
- lib/aws/s3/access_control_list.rb
|
366
383
|
- lib/aws/s3/acl_object.rb
|
367
384
|
- lib/aws/s3/acl_options.rb
|
@@ -491,6 +508,7 @@ files:
|
|
491
508
|
- lib/aws/api_config/ELB-2011-08-15.yml
|
492
509
|
- lib/aws/api_config/EMR-2009-03-31.yml
|
493
510
|
- lib/aws/api_config/IAM-2010-05-08.yml
|
511
|
+
- lib/aws/api_config/Route53-2012-02-29.yml
|
494
512
|
- lib/aws/api_config/SimpleDB-2009-04-15.yml
|
495
513
|
- lib/aws/api_config/SimpleEmailService-2010-12-01.yml
|
496
514
|
- lib/aws/api_config/SimpleWorkflow-2012-01-25.yml
|
@@ -503,31 +521,37 @@ files:
|
|
503
521
|
- NOTICE.txt
|
504
522
|
- LICENSE.txt
|
505
523
|
homepage: http://aws.amazon.com/sdkforruby
|
506
|
-
licenses:
|
524
|
+
licenses:
|
507
525
|
- Apache 2.0
|
508
526
|
post_install_message:
|
509
527
|
rdoc_options: []
|
510
|
-
|
528
|
+
|
529
|
+
require_paths:
|
511
530
|
- lib
|
512
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
531
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
513
532
|
none: false
|
514
|
-
requirements:
|
515
|
-
- -
|
516
|
-
- !ruby/object:Gem::Version
|
517
|
-
|
518
|
-
segments:
|
533
|
+
requirements:
|
534
|
+
- - ">="
|
535
|
+
- !ruby/object:Gem::Version
|
536
|
+
hash: 3
|
537
|
+
segments:
|
519
538
|
- 0
|
520
|
-
|
521
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
539
|
+
version: "0"
|
540
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
522
541
|
none: false
|
523
|
-
requirements:
|
524
|
-
- -
|
525
|
-
- !ruby/object:Gem::Version
|
526
|
-
|
542
|
+
requirements:
|
543
|
+
- - ">="
|
544
|
+
- !ruby/object:Gem::Version
|
545
|
+
hash: 3
|
546
|
+
segments:
|
547
|
+
- 0
|
548
|
+
version: "0"
|
527
549
|
requirements: []
|
550
|
+
|
528
551
|
rubyforge_project:
|
529
|
-
rubygems_version: 1.8.
|
552
|
+
rubygems_version: 1.8.21
|
530
553
|
signing_key:
|
531
554
|
specification_version: 3
|
532
555
|
summary: AWS SDK for Ruby
|
533
556
|
test_files: []
|
557
|
+
|
@@ -1,112 +0,0 @@
|
|
1
|
-
# Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
2
|
-
#
|
3
|
-
# Licensed under the Apache License, Version 2.0 (the "License"). You
|
4
|
-
# may not use this file except in compliance with the License. A copy of
|
5
|
-
# the License is located at
|
6
|
-
#
|
7
|
-
# http://aws.amazon.com/apache2.0/
|
8
|
-
#
|
9
|
-
# or in the "license" file accompanying this file. This file is
|
10
|
-
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
11
|
-
# ANY KIND, either express or implied. See the License for the specific
|
12
|
-
# language governing permissions and limitations under the License.
|
13
|
-
|
14
|
-
require 'json'
|
15
|
-
|
16
|
-
module AWS
|
17
|
-
module Core
|
18
|
-
class Client
|
19
|
-
|
20
|
-
# When a client class extends this module, its API configuration is
|
21
|
-
# parsed. For each operation in the API configuration, one client
|
22
|
-
# method is added.
|
23
|
-
#
|
24
|
-
# Clients extending QueryJSON all have in common their method of
|
25
|
-
# serializing request (input) parameters and parsing response
|
26
|
-
# (output) JSON.
|
27
|
-
#
|
28
|
-
module QueryJSON
|
29
|
-
|
30
|
-
def self.extended base
|
31
|
-
base.send(:include, ErrorParser)
|
32
|
-
base.send(:define_client_methods)
|
33
|
-
end
|
34
|
-
|
35
|
-
# @return [Hash<Symbol,OptionGrammar>] Returns a hash option
|
36
|
-
# parsers. Hash keys are client method names and hash
|
37
|
-
# values are {OptionGrammar} objects.
|
38
|
-
# @private
|
39
|
-
def option_parsers
|
40
|
-
@option_parsers ||= {}
|
41
|
-
end
|
42
|
-
|
43
|
-
protected
|
44
|
-
|
45
|
-
# Enumerates through the operations specified in the API
|
46
|
-
# configuration (yaml configuration file found in lib/api_config/)
|
47
|
-
# and defines one request method per operation.
|
48
|
-
def define_client_methods
|
49
|
-
api_config[:operations].each do |op|
|
50
|
-
|
51
|
-
method_name = op[:method]
|
52
|
-
|
53
|
-
option_parsers[method_name] = OptionGrammar.customize(op[:inputs])
|
54
|
-
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
def define_client_method method_name, operation
|
59
|
-
add_client_request_method(method_name) do
|
60
|
-
|
61
|
-
configure_request do |request, options|
|
62
|
-
|
63
|
-
parser = self.class.option_parsers[method_name]
|
64
|
-
x_amz_target = self.class::TARGET_PREFIX + operation
|
65
|
-
|
66
|
-
request.headers["content-type"] = "application/x-amz-json-1.0"
|
67
|
-
request.headers["x-amz-target"] = x_amz_target
|
68
|
-
request.body = parser.to_json(options)
|
69
|
-
|
70
|
-
end
|
71
|
-
|
72
|
-
process_response do |response|
|
73
|
-
response_body = response.http_response.body
|
74
|
-
response_body = "{}" if response_body == ""
|
75
|
-
data = JSON.load(response_body)
|
76
|
-
MetaUtils.extend_method(response, :data) { data }
|
77
|
-
end
|
78
|
-
|
79
|
-
simulate_response do |response|
|
80
|
-
data = {}
|
81
|
-
MetaUtils.extend_method(response, :data) { data }
|
82
|
-
end
|
83
|
-
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
|
-
module ErrorParser
|
88
|
-
|
89
|
-
def extract_error_details response
|
90
|
-
if
|
91
|
-
response.http_response.status >= 300 and
|
92
|
-
body = response.http_response.body and
|
93
|
-
json = (JSON.load(body) rescue nil) and
|
94
|
-
type = json["__type"] and
|
95
|
-
matches = type.match(/\#(.*)$/)
|
96
|
-
then
|
97
|
-
code = matches[1]
|
98
|
-
if code == 'RequestEntityTooLarge'
|
99
|
-
message = 'Request body must be less than 1 MB'
|
100
|
-
else
|
101
|
-
message = json['message']
|
102
|
-
end
|
103
|
-
[code, message]
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|