Module: Grafeas::V1::Grafeas::Paths

Extended by:
Paths
Included in:
Client, Paths
Defined in:
lib/grafeas/v1/grafeas/paths.rb

Overview

Path helper methods for the Grafeas API.

Instance Method Summary collapse

Instance Method Details

#note_path(project:, note:) ⇒ ::String

Create a fully-qualified Note resource string.

The resource will be in the following format:

projects/{project}/notes/{note}

Parameters:

  • project (String)
  • note (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


36
37
38
39
40
# File 'lib/grafeas/v1/grafeas/paths.rb', line 36

def note_path project:, note:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/notes/#{note}"
end

#occurrence_path(project:, occurrence:) ⇒ ::String

Create a fully-qualified Occurrence resource string.

The resource will be in the following format:

projects/{project}/occurrences/{occurrence}

Parameters:

  • project (String)
  • occurrence (String)

Returns:

  • (::String)

Raises:

  • (::ArgumentError)


53
54
55
56
57
# File 'lib/grafeas/v1/grafeas/paths.rb', line 53

def occurrence_path project:, occurrence:
  raise ::ArgumentError, "project cannot contain /" if project.to_s.include? "/"

  "projects/#{project}/occurrences/#{occurrence}"
end

#project_path(project:) ⇒ ::String

Create a fully-qualified Project resource string.

The resource will be in the following format:

projects/{project}

Parameters:

  • project (String)

Returns:

  • (::String)


69
70
71
# File 'lib/grafeas/v1/grafeas/paths.rb', line 69

def project_path project:
  "projects/#{project}"
end