azure_mgmt_commerce 0.6.0 → 0.7.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cd430e6c1625b090a536f02523bcf242af86ac01
4
- data.tar.gz: c6d4bb6645e65074a6b483c4cc60b29f6e2946f7
3
+ metadata.gz: 0472cbc0dba0a808090e577da1ff59ba99e08a20
4
+ data.tar.gz: 013c281904a4b6f53748b43fb6aabbd906dfb3bb
5
5
  SHA512:
6
- metadata.gz: 4bf45061999c7c14c85d252bf1d9c564e175b247eda1d3c8dbd44b11b0ba80453e9ef07f71cd725dfe625b24ba841448fba2f90f94bd32c9aa622a3d44cfc900
7
- data.tar.gz: 33018fbbcd192784d514142b2a1feb8bd9969b9cae8dd266abaac08e399324a5596c8ae4c830d32fc18a7e0e89ca6247a387825deaf8be914e57423f9ed849c2
6
+ metadata.gz: 7fe5ee8e6df6884ca40c70204d0ad45efd28755f926125566a005346006c03d2b6a0b4e7c7826630ffb12132b1a970b2237e5bf7bcf8bfda1bdebb4084de276c
7
+ data.tar.gz: 441e372491c06a7d7d3d2a4478ec09cf3b7e8416f5fbcb198d2ae80c2937ce7dc1a428a0dc7da40deaca82153edaadd75e44b813d615eb9028b02fd4cd9acc88
@@ -102,30 +102,27 @@ module Azure::ARM::Commerce
102
102
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
103
103
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
104
104
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/RateCard'
105
+
106
+ request_url = @base_url || @client.base_url
107
+
105
108
  options = {
106
109
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
107
110
  path_params: {'subscriptionId' => @client.subscription_id},
108
111
  query_params: {'$filter' => filter,'api-version' => @client.api_version},
109
- headers: request_headers.merge(custom_headers || {})
112
+ headers: request_headers.merge(custom_headers || {}),
113
+ base_url: request_url
110
114
  }
115
+ promise = @client.make_request_async(:get, path_template, options)
111
116
 
112
- request_url = @base_url || @client.base_url
113
-
114
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
115
- promise = request.run_promise do |req|
116
- @client.credentials.sign_request(req) unless @client.credentials.nil?
117
- end
118
-
119
- promise = promise.then do |http_response|
117
+ promise = promise.then do |result|
118
+ http_response = result.response
120
119
  status_code = http_response.status
121
120
  response_content = http_response.body
122
121
  unless status_code == 200
123
122
  error_model = JSON.load(response_content)
124
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
123
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
125
124
  end
126
125
 
127
- # Create Result
128
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
129
126
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
130
127
  # Deserialize Response
131
128
  if status_code == 200
@@ -46,8 +46,8 @@ module Azure::ARM::Commerce
46
46
  response = list_async(reportedstart_time, reported_end_time, show_details, aggregation_granularity, continuation_token, custom_headers).value!
47
47
  unless response.nil?
48
48
  page = response.body
49
- page.next_method = Proc.new do |next_link|
50
- list_next_async(next_link, custom_headers)
49
+ page.next_method = Proc.new do |next_page_link|
50
+ list_next_async(next_page_link, custom_headers)
51
51
  end
52
52
  page
53
53
  end
@@ -132,30 +132,27 @@ module Azure::ARM::Commerce
132
132
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
133
133
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
134
134
  path_template = '/subscriptions/{subscriptionId}/providers/Microsoft.Commerce/UsageAggregates'
135
+
136
+ request_url = @base_url || @client.base_url
137
+
135
138
  options = {
136
139
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
137
140
  path_params: {'subscriptionId' => @client.subscription_id},
138
141
  query_params: {'reportedstartTime' => reportedstart_time,'reportedEndTime' => reported_end_time,'showDetails' => show_details,'aggregationGranularity' => aggregation_granularity,'continuationToken' => continuation_token,'api-version' => @client.api_version},
139
- headers: request_headers.merge(custom_headers || {})
142
+ headers: request_headers.merge(custom_headers || {}),
143
+ base_url: request_url
140
144
  }
145
+ promise = @client.make_request_async(:get, path_template, options)
141
146
 
142
- request_url = @base_url || @client.base_url
143
-
144
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
145
- promise = request.run_promise do |req|
146
- @client.credentials.sign_request(req) unless @client.credentials.nil?
147
- end
148
-
149
- promise = promise.then do |http_response|
147
+ promise = promise.then do |result|
148
+ http_response = result.response
150
149
  status_code = http_response.status
151
150
  response_content = http_response.body
152
151
  unless status_code == 200
153
152
  error_model = JSON.load(response_content)
154
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
153
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
155
154
  end
156
155
 
157
- # Create Result
158
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
159
156
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
160
157
  # Deserialize Response
161
158
  if status_code == 200
@@ -223,29 +220,26 @@ module Azure::ARM::Commerce
223
220
  request_headers['x-ms-client-request-id'] = SecureRandom.uuid
224
221
  request_headers['accept-language'] = @client.accept_language unless @client.accept_language.nil?
225
222
  path_template = '{nextLink}'
223
+
224
+ request_url = @base_url || @client.base_url
225
+
226
226
  options = {
227
227
  middlewares: [[MsRest::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]],
228
228
  skip_encoding_path_params: {'nextLink' => next_page_link},
229
- headers: request_headers.merge(custom_headers || {})
229
+ headers: request_headers.merge(custom_headers || {}),
230
+ base_url: request_url
230
231
  }
232
+ promise = @client.make_request_async(:get, path_template, options)
231
233
 
232
- request_url = @base_url || @client.base_url
233
-
234
- request = MsRest::HttpOperationRequest.new(request_url, path_template, :get, options)
235
- promise = request.run_promise do |req|
236
- @client.credentials.sign_request(req) unless @client.credentials.nil?
237
- end
238
-
239
- promise = promise.then do |http_response|
234
+ promise = promise.then do |result|
235
+ http_response = result.response
240
236
  status_code = http_response.status
241
237
  response_content = http_response.body
242
238
  unless status_code == 200
243
239
  error_model = JSON.load(response_content)
244
- fail MsRest::HttpOperationError.new(request, http_response, error_model)
240
+ fail MsRest::HttpOperationError.new(result.request, http_response, error_model)
245
241
  end
246
242
 
247
- # Create Result
248
- result = MsRestAzure::AzureOperationResponse.new(request, http_response)
249
243
  result.request_id = http_response['x-ms-request-id'] unless http_response['x-ms-request-id'].nil?
250
244
  # Deserialize Response
251
245
  if status_code == 200
@@ -35,10 +35,6 @@ module Azure::ARM::Commerce
35
35
  # is generated and included in each request. Default is true.
36
36
  attr_accessor :generate_client_request_id
37
37
 
38
- # @return Subscription credentials which uniquely identify client
39
- # subscription.
40
- attr_accessor :credentials
41
-
42
38
  # @return [UsageAggregates] usage_aggregates
43
39
  attr_reader :usage_aggregates
44
40
 
@@ -67,5 +63,60 @@ module Azure::ARM::Commerce
67
63
  @generate_client_request_id = true
68
64
  end
69
65
 
66
+ #
67
+ # Makes a request and returns the body of the response.
68
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
69
+ # @param path [String] the path, relative to {base_url}.
70
+ # @param options [Hash{String=>String}] specifying any request options like :body.
71
+ # @return [Hash{String=>String}] containing the body of the response.
72
+ # Example:
73
+ #
74
+ # request_content = "{'location':'westus','tags':{'tag1':'val1','tag2':'val2'}}"
75
+ # path = "/path"
76
+ # options = {
77
+ # body: request_content,
78
+ # query_params: {'api-version' => '2016-02-01'}
79
+ # }
80
+ # result = @client.make_request(:put, path, options)
81
+ #
82
+ def make_request(method, path, options = {})
83
+ result = make_request_with_http_info(method, path, options)
84
+ result.body unless result.nil?
85
+ end
86
+
87
+ #
88
+ # Makes a request and returns the operation response.
89
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
90
+ # @param path [String] the path, relative to {base_url}.
91
+ # @param options [Hash{String=>String}] specifying any request options like :body.
92
+ # @return [MsRestAzure::AzureOperationResponse] Operation response containing the request, response and status.
93
+ #
94
+ def make_request_with_http_info(method, path, options = {})
95
+ result = make_request_async(method, path, options).value!
96
+ result.body = result.response.body.to_s.empty? ? nil : JSON.load(result.response.body)
97
+ result
98
+ end
99
+
100
+ #
101
+ # Makes a request asynchronously.
102
+ # @param method [Symbol] with any of the following values :get, :put, :post, :patch, :delete.
103
+ # @param path [String] the path, relative to {base_url}.
104
+ # @param options [Hash{String=>String}] specifying any request options like :body.
105
+ # @return [Concurrent::Promise] Promise object which holds the HTTP response.
106
+ #
107
+ def make_request_async(method, path, options = {})
108
+ fail ArgumentError, 'method is nil' if method.nil?
109
+ fail ArgumentError, 'path is nil' if path.nil?
110
+
111
+ request_url = options[:base_url] || @base_url
112
+
113
+ request_headers = @request_headers
114
+ request_headers.merge!({'accept-language' => @accept_language}) unless @accept_language.nil?
115
+ options.merge!({headers: request_headers.merge(options[:headers] || {})})
116
+ options.merge!({credentials: @credentials}) unless @credentials.nil?
117
+
118
+ super(request_url, method, path, options)
119
+ end
120
+
70
121
  end
71
122
  end
@@ -4,5 +4,5 @@
4
4
  # regenerated.
5
5
 
6
6
  module Azure::ARM::Commerce
7
- VERSION = '0.6.0'
7
+ VERSION = '0.7.0'
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: azure_mgmt_commerce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Microsoft Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-15 00:00:00.000000000 Z
11
+ date: 2016-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.5.0
75
+ version: 0.6.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.5.0
82
+ version: 0.6.0
83
83
  description: Microsoft Azure Commerce Management Client Library for Ruby
84
84
  email: azrubyteam@microsoft.com
85
85
  executables: []
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
118
118
  requirements:
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: 1.9.3
121
+ version: 2.0.0
122
122
  required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  requirements:
124
124
  - - ">="