Class: Packages::Nuget::V2::MetadataIndexPresenter

Inherits:
Object
  • Object
show all
Defined in:
app/presenters/packages/nuget/v2/metadata_index_presenter.rb

Instance Method Summary collapse

Instance Method Details

#xmlObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'app/presenters/packages/nuget/v2/metadata_index_presenter.rb', line 7

def xml
  Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|
    xml['edmx'].Edmx('xmlns:edmx' => 'http://schemas.microsoft.com/ado/2007/06/edmx', Version: '1.0') do
      xml['edmx'].DataServices('xmlns:m' => 'http://schemas.microsoft.com/ado/2007/08/dataservices/metadata',
        'm:DataServiceVersion' => '2.0', 'm:MaxDataServiceVersion' => '2.0') do
        xml.Schema(xmlns: 'http://schemas.microsoft.com/ado/2006/04/edm', Namespace: 'NuGetGallery.OData') do
          xml.EntityType(Name: 'V2FeedPackage', 'm:HasStream' => true) do
            xml.Key do
              xml.PropertyRef(Name: 'Id')
              xml.PropertyRef(Name: 'Version')
            end
            xml.Property(Name: 'Id', Type: 'Edm.String', Nullable: false)
            xml.Property(Name: 'Version', Type: 'Edm.String', Nullable: false)
            xml.Property(Name: 'Authors', Type: 'Edm.String')
            xml.Property(Name: 'Dependencies', Type: 'Edm.String')
            xml.Property(Name: 'Description', Type: 'Edm.String')
            xml.Property(Name: 'DownloadCount', Type: 'Edm.Int64', Nullable: false)
            xml.Property(Name: 'IconUrl', Type: 'Edm.String')
            xml.Property(Name: 'Published', Type: 'Edm.DateTime', Nullable: false)
            xml.Property(Name: 'ProjectUrl', Type: 'Edm.String')
            xml.Property(Name: 'Tags', Type: 'Edm.String')
            xml.Property(Name: 'Title', Type: 'Edm.String')
            xml.Property(Name: 'LicenseUrl', Type: 'Edm.String')
          end
        end
        xml.Schema(xmlns: 'http://schemas.microsoft.com/ado/2006/04/edm', Namespace: 'NuGetGallery') do
          xml.EntityContainer(Name: 'V2FeedContext', 'm:IsDefaultEntityContainer' => true) do
            xml.EntitySet(Name: 'Packages', EntityType: 'NuGetGallery.OData.V2FeedPackage')
            xml.FunctionImport(Name: 'FindPackagesById',
              ReturnType: 'Collection(NuGetGallery.OData.V2FeedPackage)', EntitySet: 'Packages') do
              xml.Parameter(Name: 'id', Type: 'Edm.String', FixedLength: 'false', Unicode: 'false')
            end
          end
        end
      end
    end
  end
end