Module: Inferno::DSL::Links

Included in:
Entities::TestSuite
Defined in:
lib/inferno/dsl/links.rb

Overview

This module contains methods to add test suite links which are displayed in the footer of the UI

Constant Summary collapse

DEFAULT_TYPES =
{
  'report_issue' => 'Report Issue',
  'source_code' => 'Open Source',
  'download' => 'Download',
  'ig' => 'Implementation Guide'
}.freeze

Instance Method Summary collapse

Instance Method Details

Add a link to the test suit links list.

Examples:

add_link('source_code', 'Source Code', 'https://github.com/onc-healthit/onc-certification-g10-test-kit/')
add_link('custom_type', 'Custom Link', 'https://custom-link.com')

Parameters:

  • type (String)

    The type of the link. Default types: report_issue, source_code, download, or ig. Custom types are also allowed.

  • label (String)

    The label for the link, describing its purpose.

  • url (String)

    The URL the link points to.

Returns:

  • (Array<Hash>)

    The updated array of links.



51
52
53
# File 'lib/inferno/dsl/links.rb', line 51

def add_link(type, label, url)
  links << { type:, label:, url: }
end

#download_url(url, label: nil) ⇒ Array<Hash>

Add a link to the latest release version of the test kit.

Parameters:

  • url (String)

    The URL to the latest release version of the test kit.

  • label (String) (defaults to: nil)

    (optional) A custom label for the link.

Returns:

  • (Array<Hash>)

    The updated array of links.



78
79
80
# File 'lib/inferno/dsl/links.rb', line 78

def download_url(url, label: nil)
  add_predefined_link('download', url, label)
end

#ig_url(url, label: nil) ⇒ Array<Hash>

Add a link to the implementation guide.

Parameters:

  • url (String)

    The URL to the implementation guide.

  • label (String) (defaults to: nil)

    (optional) A custom label for the link.

Returns:

  • (Array<Hash>)

    The updated array of links.



69
70
71
# File 'lib/inferno/dsl/links.rb', line 69

def ig_url(url, label: nil)
  add_predefined_link('ig', url, label)
end

Set/get a list of links which are displayed in the footer of the UI.

Examples:

links [
  {
    type: 'report_issue',
    label: 'Report Issue',
    url: 'https://github.com/onc-healthit/onc-certification-g10-test-kit/issues/'
  },
  {
    type: 'source_code'
    label: 'Open Source',
    url: 'https://github.com/onc-healthit/onc-certification-g10-test-kit/'
  }
]

Parameters:

  • links (Array<Hash>) (defaults to: nil)

    A list of Hashes for the links to be displayed. Each hash needs a type:, label:, and url: entry. Default types: report_issue, source_code, download, or ig.

Returns:

  • (Array<Hash>)

    an array of hashes or an empty array



33
34
35
36
37
38
# File 'lib/inferno/dsl/links.rb', line 33

def links(links = nil)
  @links ||= []
  return @links if links.nil?

  @links.concat(links)
end

#report_issue_url(url, label: nil) ⇒ Array<Hash>

Add a link to report an issue in the footer of the UI.

Parameters:

  • url (String)

    The URL for reporting an issue.

  • label (String) (defaults to: nil)

    (optional) A custom label for the link.

Returns:

  • (Array<Hash>)

    The updated array of links.



87
88
89
# File 'lib/inferno/dsl/links.rb', line 87

def report_issue_url(url, label: nil)
  add_predefined_link('report_issue', url, label)
end

#source_code_url(url, label: nil) ⇒ Array<Hash>

Add a link to the source code repository.

Parameters:

  • url (String)

    The URL to the source code repository.

  • label (String) (defaults to: nil)

    (optional) A custom label for the link.

Returns:

  • (Array<Hash>)

    The updated array of links.



60
61
62
# File 'lib/inferno/dsl/links.rb', line 60

def source_code_url(url, label: nil)
  add_predefined_link('source_code', url, label)
end