Sha256: e52bff23a9a664d3deac7565d513d7caf932ec32a639e35d64f3af971fcc57f9

Contents?: true

Size: 641 Bytes

Versions: 3

Compression:

Stored size: 641 Bytes

Contents

require 'rexml/document'

desc "Update Graph API description file (optionally specify VERSION environment variable - defaults to \"v1.0\")"
task :update_metadata do
  version = ENV['VERSION'] || "v1.0"
  file_name = File.absolute_path File.join(__FILE__, "../../data/metadata_#{version}.xml")
  uri = URI("https://graph.microsoft.com/#{version}/$metadata?detailed=true")
  xml = Net::HTTP
    .new(uri.hostname, uri.port)
    .tap { |h| h.use_ssl = uri.scheme == "https" }
    .get(uri).body
  doc = REXML::Document.new(xml)
  File.open(file_name, 'w') do |f|
    puts "writing to #{file_name}"
    doc.write f, 2
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
microsoft_graph-0.1.3 tasks/update_metadata.rb
microsoft_graph-0.1.1 tasks/update_metadata.rb
microsoft_graph-0.1.0 tasks/update_metadata.rb