Method: Azure::Storage::Common::Service::Serialization::ClassMethods#cors_rule_from_xml

Defined in:
lib/azure/storage/common/service/serialization.rb

#cors_rule_from_xml(xml) ⇒ Object


245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/azure/storage/common/service/serialization.rb', line 245

def cors_rule_from_xml(xml)
  xml = slopify(xml)
  expect_node("CorsRule", xml)

  CorsRule.new do |cors_rule|
    cors_rule.allowed_origins =  ary_from_node(xml.AllowedOrigins) if (xml > "AllowedOrigins").any?
    cors_rule.allowed_methods =  ary_from_node(xml.AllowedMethods) if (xml > "AllowedMethods").any?
    cors_rule.max_age_in_seconds = xml.MaxAgeInSeconds.text.to_i if (xml > "MaxAgeInSeconds").any?
    cors_rule.exposed_headers = ary_from_node(xml.ExposedHeaders) if (xml > "ExposedHeaders").any?
    cors_rule.allowed_headers = ary_from_node(xml.AllowedHeaders) if (xml > "AllowedHeaders").any?
  end
end