ms_rest 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a076ad1f650d77705233430c3ab8a8bff76d568
4
- data.tar.gz: 4cc31d2b65c4e22720ec440cf401da166456f156
3
+ metadata.gz: 91bb8b8bc46f2a05daf7c0de84d0d94e010b43c2
4
+ data.tar.gz: 7fb413af783fc6ef7294538a78b7155d569eb3fd
5
5
  SHA512:
6
- metadata.gz: 02968944245aca783affdf02d4ad74daaaf43f24b2650b31fce9422de7bfcb9ce41a1db510e0f96a0d8f3e389d6b0aaadc91eed67d75c86fd56b1191fa2d6c01
7
- data.tar.gz: 00a25077f3f286751de7b557f1d8e5bb77c8ba316f78cf25c02e349157a02444a546ee9444aa7558b47fe3bf837ae7f13530b9956d7870c93ab94d56bb7e73f5
6
+ metadata.gz: 5969cce618b705790f8ca50fca642fba7d0108fb88aea5ab6caa70f28dddc17662021c1c1165155a3da561f5d8d11e3581592375459388ad0ae1e5f62670c04e
7
+ data.tar.gz: 7507016e561db695d19c2695c6ca06164a3005efc5ae2e699b9eb21a5ea1183d6d2683b6709a51c1226536575000d7fd7bd2c1627ba35f7242f159915d0798c9
data/ChangeLog.md CHANGED
@@ -1,2 +1,6 @@
1
+ ##2016.07.21 ms_rest version 0.3.1
2
+ * [Bug fixes](https://github.com/Azure/autorest/commit/ede944a1fa30a7453aa30e6fa79154dc43393cdf)
3
+
1
4
  ##2016.07.14 ms_rest version 0.3.0
2
- * Moving serialization/deserializaiton code from sdk models to client runtime. [#1106](https://github.com/Azure/autorest/pull/1106)
5
+ * Moving serialization/deserializaiton code from sdk models to client runtime. [#1106](https://github.com/Azure/autorest/pull/1106)
6
+
@@ -88,9 +88,9 @@ module MsRest
88
88
  when 'String', 'Boolean', 'Object', 'Stream'
89
89
  result = response_body
90
90
  when 'Enum'
91
- unless response_body.nil? || response_body.empty?
91
+ unless response_body.nil?
92
92
  unless enum_is_valid(mapper, response_body)
93
- warn "Enum #{model} does not contain #{response_body.downcase}, but was received from the server."
93
+ warn "Enum does not contain #{response_body}, but was received from the server."
94
94
  end
95
95
  end
96
96
  result = response_body
@@ -146,6 +146,8 @@ module MsRest
146
146
  parent_class = get_model(mapper[:type][:class_name])
147
147
  discriminator = parent_class.class_eval("@@discriminatorMap")
148
148
  model_name = response_body["#{mapper[:type][:polymorphic_discriminator]}"]
149
+ # In case we do not find model from response body then use the class defined in mapper
150
+ model_name = mapper[:type][:class_name] if model_name.nil? || model_name.empty?
149
151
  model_class = get_model(discriminator[model_name])
150
152
  else
151
153
  model_class = get_model(mapper[:type][:class_name])
@@ -248,7 +250,7 @@ module MsRest
248
250
  when 'Number', 'Double', 'String', 'Date', 'Boolean', 'Object', 'Stream'
249
251
  payload = object != nil ? object : nil
250
252
  when 'Enum'
251
- unless object.nil? || object.empty?
253
+ unless object.nil?
252
254
  unless enum_is_valid(mapper, object)
253
255
  fail ValidationError, "Enum #{mapper[:type][:module]} does not contain #{object.to_s}, but trying to send it to the server."
254
256
  end
@@ -392,8 +394,12 @@ module MsRest
392
394
  # @param enum_value [String] Enum value to validate
393
395
  #
394
396
  def enum_is_valid(mapper, enum_value)
395
- model = get_model(mapper[:type][:module])
396
- model.constants.any? { |e| model.const_get(e).to_s.downcase == enum_value.downcase }
397
+ if enum_value.is_a?(String) && !enum_value.empty?
398
+ model = get_model(mapper[:type][:module])
399
+ model.constants.any? { |e| model.const_get(e).to_s.downcase == enum_value.downcase }
400
+ else
401
+ false
402
+ end
397
403
  end
398
404
 
399
405
  # Splits serialized_name with '.' to compute levels of object hierarchy
@@ -3,5 +3,5 @@
3
3
  # Licensed under the MIT License. See License.txt in the project root for license information.
4
4
 
5
5
  module MsRest
6
- VERSION = '0.3.0'
6
+ VERSION = '0.3.1'
7
7
  end
data/ms_rest.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
 
15
15
  spec.summary = %q{Azure Client Library for Ruby.}
16
16
  spec.description = %q{Azure Client Library for Ruby.}
17
- spec.homepage = 'https://rubygems.org/gems/azure'
17
+ spec.homepage = 'https://github.com/Azure/autorest'
18
18
  spec.license = 'MIT'
19
19
 
20
20
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
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.3.0
4
+ version: 0.3.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-07-14 00:00:00.000000000 Z
11
+ date: 2016-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -138,7 +138,7 @@ files:
138
138
  - lib/ms_rest/validation_error.rb
139
139
  - lib/ms_rest/version.rb
140
140
  - ms_rest.gemspec
141
- homepage: https://rubygems.org/gems/azure
141
+ homepage: https://github.com/Azure/autorest
142
142
  licenses:
143
143
  - MIT
144
144
  metadata: {}