Class: Packages::Composer::PackagesPresenter

Inherits:
Object
  • Object
show all
Includes:
API::Helpers::RelatedResourcesHelpers
Defined in:
app/presenters/packages/composer/packages_presenter.rb

Instance Method Summary collapse

Methods included from API::Helpers::RelatedResourcesHelpers

#expose_path, #expose_url, #issues_available?, #mrs_available?

Constructor Details

#initialize(group, packages) ⇒ PackagesPresenter

Returns a new instance of PackagesPresenter.


8
9
10
11
# File 'app/presenters/packages/composer/packages_presenter.rb', line 8

def initialize(group, packages)
  @group = group
  @packages = packages
end

Instance Method Details

#package_versions(packages = @packages) ⇒ Object


22
23
24
# File 'app/presenters/packages/composer/packages_presenter.rb', line 22

def package_versions(packages = @packages)
  { 'packages' => { packages.first.name => package_versions_map(packages) } }
end

#providerObject


18
19
20
# File 'app/presenters/packages/composer/packages_presenter.rb', line 18

def provider
  { 'providers' => providers_map }
end

#rootObject


13
14
15
16
# File 'app/presenters/packages/composer/packages_presenter.rb', line 13

def root
  path = api_v4_group___packages_composer_package_name_path({ id: @group.id, package_name: '%package%', format: '.json' }, true)
  { 'packages' => [], 'provider-includes' => { 'p/%hash%.json' => { 'sha256' => provider_sha } }, 'providers-url' => path }
end