ms_rest 0.2.0 → 0.2.1
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 +4 -4
- data/lib/ms_rest/http_operation_request.rb +10 -2
- data/lib/ms_rest/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb23269524d72595eea5bf57e7296344cd013ec
|
4
|
+
data.tar.gz: e9b039be71e5b171d22b2fbd07b8600e781d53ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad5055678904d0874bf5edb051b3829b070884a3c18ea78491422f6441fd95609612f02b10fe03f596295c8b3d9c35779c7153d5fa901bba7d9a27a49de9ed7f
|
7
|
+
data.tar.gz: 31caa6ef155fbf6427a0a27df21c9180a6be097da214aaa7fafb933d3fff4d45cefc861b15dcd884489eceaa3741387f7c418ec46bf43c5130ae8ee80d238109
|
@@ -41,6 +41,9 @@ module MsRest
|
|
41
41
|
# @return [String] full - to log requests, responses and bodies, partial - just requests and responses without body
|
42
42
|
attr_accessor :log
|
43
43
|
|
44
|
+
# @return [Array] strings to be appended to the user agent in the request
|
45
|
+
attr_accessor :user_agent_extended
|
46
|
+
|
44
47
|
# Creates and initialize new instance of the HttpOperationResponse class.
|
45
48
|
# @param [String|URI] base uri for requests
|
46
49
|
# @param [String] path template /{replace}/{url_param}
|
@@ -54,6 +57,7 @@ module MsRest
|
|
54
57
|
@path_template = path_template
|
55
58
|
@method = method
|
56
59
|
@headers = {}
|
60
|
+
@user_agent_extended = []
|
57
61
|
|
58
62
|
options.each do |k,v|
|
59
63
|
instance_variable_set("@#{k}", v) unless v.nil?
|
@@ -73,7 +77,7 @@ module MsRest
|
|
73
77
|
end
|
74
78
|
end
|
75
79
|
|
76
|
-
connection.run_request(:"#{method}", build_path, body, headers) do |req|
|
80
|
+
connection.run_request(:"#{method}", build_path, body, {'User-Agent' => user_agent}.merge(headers)) do |req|
|
77
81
|
req.params = query_params.reject{|_, v| v.nil?} unless query_params.nil?
|
78
82
|
yield(req) if block_given?
|
79
83
|
end
|
@@ -85,7 +89,7 @@ module MsRest
|
|
85
89
|
# @return [URI] body the HTTP response body.
|
86
90
|
def build_path
|
87
91
|
template = path_template.dup
|
88
|
-
path_params.each{ |key, value| template["{#{key}}"] = ERB::Util.url_encode(value) } unless path_params.nil?
|
92
|
+
path_params.each{ |key, value| template["{#{key}}"] = ERB::Util.url_encode(value) if template.include?("{#{key}}") } unless path_params.nil?
|
89
93
|
skip_encoding_path_params.each{ |key, value| template["{#{key}}"] = value } unless skip_encoding_path_params.nil?
|
90
94
|
path = URI.parse(template.gsub(/([^:])\/\//, '\1/'))
|
91
95
|
unless skip_encoding_query_params.nil?
|
@@ -98,6 +102,10 @@ module MsRest
|
|
98
102
|
URI.join(base_uri || '', build_path)
|
99
103
|
end
|
100
104
|
|
105
|
+
def user_agent
|
106
|
+
"Azure-SDK-For-Ruby/#{MsRest::VERSION}/#{user_agent_extended.join('/')}"
|
107
|
+
end
|
108
|
+
|
101
109
|
def to_json(*a)
|
102
110
|
{
|
103
111
|
base_uri: base_uri,
|
data/lib/ms_rest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ms_rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
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-03-
|
11
|
+
date: 2016-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|