Sha256: d7a7cbe0bc438d730c768f25fcbc98f9d5a2204e29c658c4338a52e025548f29
Contents?: true
Size: 954 Bytes
Versions: 4
Compression:
Stored size: 954 Bytes
Contents
module ResoTransport Metadata = Struct.new(:client) do MIME_TYPES = { xml: "application/xml", json: "application/json" } def entity_sets parser.entity_sets end def schemas parser.schemas end def parser @parser ||= MetadataParser.new.parse(get_data) end def get_data if client.md_file if File.exist?(client.md_file) && File.size(client.md_file) > 0 File.new(client.md_file) else File.open(client.md_file, "w") {|f| f.write(raw) } File.new(client.md_file) end else raw end end def raw resp = client.connection.get("$metadata") do |req| req.headers['Accept'] = MIME_TYPES[client.vendor.fetch(:metadata_format, :xml).to_sym] end if resp.success? resp.body else puts resp.body raise "Error getting metadata!" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems