ms_rest2 0.7.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1 -1
- data/README.md +3 -3
- data/lib/{ms_rest → ms_rest2}/credentials/basic_authentication_credentials.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/credentials/service_client_credentials.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/credentials/string_token_provider.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/credentials/token_credentials.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/credentials/token_provider.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/deserialization_error.rb +3 -3
- data/lib/{ms_rest → ms_rest2}/http_operation_error.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/http_operation_request.rb +2 -2
- data/lib/{ms_rest → ms_rest2}/http_operation_response.rb +3 -3
- data/lib/{ms_rest → ms_rest2}/jsonable.rb +2 -2
- data/lib/{ms_rest → ms_rest2}/rest_error.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/retry_policy_middleware.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/serialization.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/service_client.rb +10 -10
- data/lib/{ms_rest → ms_rest2}/validation_error.rb +1 -1
- data/lib/{ms_rest → ms_rest2}/version.rb +2 -2
- data/lib/ms_rest2.rb +29 -0
- metadata +25 -25
- data/lib/ms_rest.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 051f6a8cc16d6b1340863025501c7f2c28d041c30a901fafe57d41d3750e4d6c
|
4
|
+
data.tar.gz: 24358c3ec06d8f232c22722d8be3f1eee3bd85eba1a9cc9a718260e010820d28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a002cd0b41c2995ac1ed3466d08c6421a48d1d5ba78457020e71673d780344c004a01b6d23495eeac671d918f97e2ac256998fe570884d449801c8ab72c5753
|
7
|
+
data.tar.gz: 005a9bab0ac30e22d0f318b611e9087e61a6126c4d15e9ea9492205663e6c98e5ed65862e1fa01589193a9132aca0336d7cc3d45ac98a538674b3e5d80b29baa
|
data/CHANGELOG.md
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
##2017.02.06 ms_rest version 0.6.3
|
26
26
|
* Adding JSONable mixin module to provide simple serialization / deserialization [PR #599](https://github.com/Azure/azure-sdk-for-ruby/pull/599)
|
27
|
-
* Making credentials optional parameter for
|
27
|
+
* Making credentials optional parameter for MsRest2::ServiceClient [PR #626](https://github.com/Azure/azure-sdk-for-ruby/pull/626)
|
28
28
|
* Bug fix while building path to handle double // [Issue #693](https://github.com/Azure/azure-sdk-for-ruby/issues/639) [PR #640](https://github.com/Azure/azure-sdk-for-ruby/pull/640)
|
29
29
|
|
30
30
|
##2016.11.14 ms_rest version 0.6.2
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Intro
|
2
2
|
|
3
|
-
|
3
|
+
MsRest2 is a library which supports the clients (SDKs) generated with Autorest tool. It contains core logic and helper classes for error handling and authentication. Usually it is not supposed to be used as a standalone gem but only as a dependency for generated client gems.
|
4
4
|
|
5
5
|
# Supported Ruby Versions
|
6
6
|
|
@@ -31,13 +31,13 @@ Faraday::SSLError:
|
|
31
31
|
```
|
32
32
|
that implies that ruby's OpenSSL was unable to verify the peer certificate while establihsing an SSL connection. You can provide Faraday ssl options or opt-in to use already bundled certificate using
|
33
33
|
```Ruby
|
34
|
-
|
34
|
+
MsRest2.use_ssl_cert
|
35
35
|
```
|
36
36
|
---
|
37
37
|
|
38
38
|
# Running tests
|
39
39
|
|
40
|
-
|
40
|
+
MsRest2 has only unit tests which doesn't require any preparation, just run 'rspec' command from the gem directory.
|
41
41
|
|
42
42
|
# Contribution
|
43
43
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRest2
|
6
6
|
#
|
7
7
|
# Class which keeps functionality and data for performing HTTP basic authentication.
|
8
8
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRest2
|
6
6
|
#
|
7
7
|
# Class which keeps functionality and date for performing OAuth (token based) authentication.
|
8
8
|
#
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
require 'json'
|
5
5
|
|
6
|
-
module
|
6
|
+
module MsRest2
|
7
7
|
#
|
8
8
|
# Class which represents an error happening during deserialization of server response.
|
9
9
|
#
|
@@ -15,7 +15,7 @@ module MsRest
|
|
15
15
|
# @return [String] the inner exception stacktrace.
|
16
16
|
attr_accessor :exception_stacktrace
|
17
17
|
|
18
|
-
# @return [
|
18
|
+
# @return [MsRest2::HttpOperationResponse] server response which client was unable to parse.
|
19
19
|
attr_accessor :result
|
20
20
|
|
21
21
|
#
|
@@ -23,7 +23,7 @@ module MsRest
|
|
23
23
|
# @param [String] message message the human readable description of error.
|
24
24
|
# @param [String] exception_message the inner exception stacktrace.
|
25
25
|
# @param [String] exception_stacktrace the inner exception stacktrace.
|
26
|
-
# @param [
|
26
|
+
# @param [MsRest2::HttpOperationResponse] the request and response
|
27
27
|
def initialize(msg, exception_message, exception_stacktrace, result)
|
28
28
|
@msg = msg || self.class.name
|
29
29
|
@exception_message = exception_message
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRest2
|
6
6
|
#
|
7
7
|
# Class which represents the data received and deserialized from server.
|
8
8
|
#
|
@@ -68,7 +68,7 @@ module MsRest
|
|
68
68
|
# @return [URI] body the HTTP response body.
|
69
69
|
def run_promise(&block)
|
70
70
|
Concurrent::Promise.new do
|
71
|
-
@connection ||= Faraday.new(:url => base_uri, :ssl =>
|
71
|
+
@connection ||= Faraday.new(:url => base_uri, :ssl => MsRest2.ssl_options) do |faraday|
|
72
72
|
middlewares.each{ |args| faraday.use(*args) } unless middlewares.nil?
|
73
73
|
faraday.adapter Faraday.default_adapter
|
74
74
|
logging = ENV['AZURE_HTTP_LOGGING'] || log
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRest2
|
6
6
|
#
|
7
7
|
# Class which represents the data received and deserialized from server.
|
8
8
|
#
|
9
9
|
class HttpOperationResponse
|
10
10
|
|
11
|
-
# @param [
|
11
|
+
# @param [MsRest2::HttpOperationRequest] the HTTP request data.
|
12
12
|
attr_accessor :request
|
13
13
|
|
14
14
|
# @return [Faraday::Response] the HTTP response object.
|
@@ -19,7 +19,7 @@ module MsRest
|
|
19
19
|
|
20
20
|
#
|
21
21
|
# Creates and initialize new instance of the HttpOperationResponse class.
|
22
|
-
# @param [
|
22
|
+
# @param [MsRest2::HttpOperationRequest] request the HTTP request object.
|
23
23
|
# @param [Faraday::Response] response the HTTP response object.
|
24
24
|
# @param [String] body the HTTP response body.
|
25
25
|
def initialize(request, response, body = nil)
|
@@ -2,10 +2,10 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRest2
|
6
6
|
# Mixin to provide simple serialization / deserialization in AutoRest generated model classes
|
7
7
|
module JSONable
|
8
|
-
include
|
8
|
+
include MsRest2::Serialization
|
9
9
|
|
10
10
|
#
|
11
11
|
# Serialize the object to JSON
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRest2
|
6
6
|
# Base module for Ruby serialization and deserialization.
|
7
7
|
#
|
8
8
|
# Provides methods to serialize Ruby object into Ruby Hash and
|
@@ -2,13 +2,13 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRest2
|
6
6
|
#
|
7
7
|
# Class which represents a point of access to the REST API.
|
8
8
|
#
|
9
9
|
class ServiceClient
|
10
10
|
|
11
|
-
# @return [
|
11
|
+
# @return [MsRest2::ServiceClientCredentials] the credentials object.
|
12
12
|
attr_accessor :credentials
|
13
13
|
|
14
14
|
# @return [Hash{String=>String}] default middlewares configuration for requests.
|
@@ -23,16 +23,16 @@ module MsRest
|
|
23
23
|
#
|
24
24
|
# Creates and initialize new instance of the ServiceClient class.
|
25
25
|
#
|
26
|
-
# @param credentials [
|
26
|
+
# @param credentials [MsRest2::ServiceClientCredentials] credentials to authorize
|
27
27
|
# HTTP requests made by the service client.
|
28
28
|
# @param options additional parameters for the HTTP request (not implemented yet).
|
29
29
|
#
|
30
30
|
def initialize(credentials = nil, options = nil)
|
31
31
|
@credentials = credentials
|
32
32
|
@request_headers = {}
|
33
|
-
@middlewares = {middlewares: [[
|
33
|
+
@middlewares = {middlewares: [[MsRest2::RetryPolicyMiddleware, times: 3, retry: 0.02], [:cookie_jar]]}
|
34
34
|
@user_agent_extended = []
|
35
|
-
@user_agent_extended.push("
|
35
|
+
@user_agent_extended.push("ms_rest2/#{MsRest2::VERSION}")
|
36
36
|
end
|
37
37
|
|
38
38
|
#
|
@@ -46,7 +46,7 @@ module MsRest
|
|
46
46
|
options = @middlewares.merge(options)
|
47
47
|
options[:credentials] = options[:credentials] || @credentials
|
48
48
|
options[:user_agent_extended] = @user_agent_extended
|
49
|
-
request =
|
49
|
+
request = MsRest2::HttpOperationRequest.new(base_url, path, method, options)
|
50
50
|
promise = request.run_promise do |req|
|
51
51
|
options[:credentials].sign_request(req) unless options[:credentials].nil?
|
52
52
|
end
|
@@ -75,10 +75,10 @@ module MsRest
|
|
75
75
|
private
|
76
76
|
#
|
77
77
|
# Retrieves a new instance of the HttpOperationResponse class.
|
78
|
-
# @param [
|
78
|
+
# @param [MsRest2::HttpOperationRequest] request the HTTP request object.
|
79
79
|
# @param [Faraday::Response] response the HTTP response object.
|
80
80
|
# @param [String] body the HTTP response body.
|
81
|
-
# @return [
|
81
|
+
# @return [MsRest2::HttpOperationResponse] the operation response.
|
82
82
|
#
|
83
83
|
def create_response(request, http_response, body = nil)
|
84
84
|
HttpOperationResponse.new(request, http_response, body)
|
@@ -93,8 +93,8 @@ module MsRest
|
|
93
93
|
#
|
94
94
|
# Stores the SSL options to be used for Faraday connections.
|
95
95
|
# ==== Examples
|
96
|
-
#
|
97
|
-
#
|
96
|
+
# MsRest2.use_ssl_cert # => Uses bundled certificate for all the connections
|
97
|
+
# MsRest2.use_ssl_cert({:ca_file => "path_to_ca_file"}) # => Uses supplied certificate for all the connections
|
98
98
|
#
|
99
99
|
# @param ssl_options [Hash] Hash of SSL options for Faraday connection. It defaults to the bundled certificate.
|
100
100
|
#
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
3
|
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
4
|
|
5
|
-
module
|
5
|
+
module MsRest2
|
6
6
|
#
|
7
7
|
# Class which represents an error meaning that invalid Model object was created by user or provided from server.
|
8
8
|
#
|
data/lib/ms_rest2.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
+
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
+
|
5
|
+
require 'base64'
|
6
|
+
require 'openssl'
|
7
|
+
require 'faraday'
|
8
|
+
require 'timeliness'
|
9
|
+
require 'ms_rest2/version'
|
10
|
+
|
11
|
+
require 'ms_rest2/credentials/token_provider'
|
12
|
+
require 'ms_rest2/credentials/string_token_provider'
|
13
|
+
require 'ms_rest2/credentials/service_client_credentials'
|
14
|
+
require 'ms_rest2/credentials/basic_authentication_credentials'
|
15
|
+
require 'ms_rest2/credentials/token_credentials'
|
16
|
+
|
17
|
+
require 'ms_rest2/rest_error.rb'
|
18
|
+
require 'ms_rest2/deserialization_error.rb'
|
19
|
+
require 'ms_rest2/validation_error.rb'
|
20
|
+
require 'ms_rest2/serialization.rb'
|
21
|
+
require 'ms_rest2/http_operation_response'
|
22
|
+
require 'ms_rest2/http_operation_request'
|
23
|
+
require 'ms_rest2/http_operation_error'
|
24
|
+
require 'ms_rest2/retry_policy_middleware'
|
25
|
+
require 'ms_rest2/service_client'
|
26
|
+
require 'ms_rest2/jsonable'
|
27
|
+
|
28
|
+
module MsRest2 end
|
29
|
+
module MsRest2::Serialization end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ms_rest2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Microsoft Corporation
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -110,24 +110,24 @@ files:
|
|
110
110
|
- LICENSE.txt
|
111
111
|
- README.md
|
112
112
|
- ca-cert.pem
|
113
|
-
- lib/
|
114
|
-
- lib/
|
115
|
-
- lib/
|
116
|
-
- lib/
|
117
|
-
- lib/
|
118
|
-
- lib/
|
119
|
-
- lib/
|
120
|
-
- lib/
|
121
|
-
- lib/
|
122
|
-
- lib/
|
123
|
-
- lib/
|
124
|
-
- lib/
|
125
|
-
- lib/
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
homepage: https://github.com/chef/azure-sdk-for-ruby
|
113
|
+
- lib/ms_rest2.rb
|
114
|
+
- lib/ms_rest2/credentials/basic_authentication_credentials.rb
|
115
|
+
- lib/ms_rest2/credentials/service_client_credentials.rb
|
116
|
+
- lib/ms_rest2/credentials/string_token_provider.rb
|
117
|
+
- lib/ms_rest2/credentials/token_credentials.rb
|
118
|
+
- lib/ms_rest2/credentials/token_provider.rb
|
119
|
+
- lib/ms_rest2/deserialization_error.rb
|
120
|
+
- lib/ms_rest2/http_operation_error.rb
|
121
|
+
- lib/ms_rest2/http_operation_request.rb
|
122
|
+
- lib/ms_rest2/http_operation_response.rb
|
123
|
+
- lib/ms_rest2/jsonable.rb
|
124
|
+
- lib/ms_rest2/rest_error.rb
|
125
|
+
- lib/ms_rest2/retry_policy_middleware.rb
|
126
|
+
- lib/ms_rest2/serialization.rb
|
127
|
+
- lib/ms_rest2/service_client.rb
|
128
|
+
- lib/ms_rest2/validation_error.rb
|
129
|
+
- lib/ms_rest2/version.rb
|
130
|
+
homepage: https://github.com/chef/azure-sdk-for-ruby/tree/master/runtime/ms_rest
|
131
131
|
licenses:
|
132
132
|
- MIT
|
133
133
|
metadata:
|
@@ -135,8 +135,8 @@ metadata:
|
|
135
135
|
changelog_uri: https://github.com/chef/azure-sdk-for-ruby/blob/master/runtime/ms_rest/CHANGELOG.md
|
136
136
|
documentation_uri: https://azure.microsoft.com/en-us/develop/ruby/
|
137
137
|
homepage_uri: https://github.com/chef/azure-sdk-for-ruby
|
138
|
-
source_code_uri: https://github.com/chef/azure-sdk-for-ruby/tree/ms_rest-
|
139
|
-
post_install_message:
|
138
|
+
source_code_uri: https://github.com/chef/azure-sdk-for-ruby/tree/ms_rest-v1.0.0
|
139
|
+
post_install_message:
|
140
140
|
rdoc_options: []
|
141
141
|
require_paths:
|
142
142
|
- lib
|
@@ -151,8 +151,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: '0'
|
153
153
|
requirements: []
|
154
|
-
rubygems_version: 3.3.
|
155
|
-
signing_key:
|
154
|
+
rubygems_version: 3.3.3
|
155
|
+
signing_key:
|
156
156
|
specification_version: 4
|
157
157
|
summary: Azure Client Library for Ruby.
|
158
158
|
test_files: []
|
data/lib/ms_rest.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
# Copyright (c) Microsoft Corporation. All rights reserved.
|
3
|
-
# Licensed under the MIT License. See License.txt in the project root for license information.
|
4
|
-
|
5
|
-
require 'base64'
|
6
|
-
require 'openssl'
|
7
|
-
require 'faraday'
|
8
|
-
require 'timeliness'
|
9
|
-
require 'ms_rest/version'
|
10
|
-
|
11
|
-
require 'ms_rest/credentials/token_provider'
|
12
|
-
require 'ms_rest/credentials/string_token_provider'
|
13
|
-
require 'ms_rest/credentials/service_client_credentials'
|
14
|
-
require 'ms_rest/credentials/basic_authentication_credentials'
|
15
|
-
require 'ms_rest/credentials/token_credentials'
|
16
|
-
|
17
|
-
require 'ms_rest/rest_error.rb'
|
18
|
-
require 'ms_rest/deserialization_error.rb'
|
19
|
-
require 'ms_rest/validation_error.rb'
|
20
|
-
require 'ms_rest/serialization.rb'
|
21
|
-
require 'ms_rest/http_operation_response'
|
22
|
-
require 'ms_rest/http_operation_request'
|
23
|
-
require 'ms_rest/http_operation_error'
|
24
|
-
require 'ms_rest/retry_policy_middleware'
|
25
|
-
require 'ms_rest/service_client'
|
26
|
-
require 'ms_rest/jsonable'
|
27
|
-
|
28
|
-
module MsRest end
|
29
|
-
module MsRest::Serialization end
|