Class: API::Helpers::Version

Inherits:
Object
  • Object
show all
Includes:
RelatedResourcesHelpers
Defined in:
lib/api/helpers/version.rb

Instance Method Summary collapse

Methods included from RelatedResourcesHelpers

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

Constructor Details

#initialize(version) ⇒ Version

Returns a new instance of Version.



8
9
10
11
12
13
14
# File 'lib/api/helpers/version.rb', line 8

def initialize(version)
  @version = version.to_s

  unless API.versions.include?(version)
    raise ArgumentError, 'Unknown API version!'
  end
end

Instance Method Details

#root_pathObject



16
17
18
# File 'lib/api/helpers/version.rb', line 16

def root_path
  File.join('/', API.prefix.to_s, @version)
end

#root_urlObject



20
21
22
# File 'lib/api/helpers/version.rb', line 20

def root_url
  @root_url ||= expose_url(root_path)
end

#to_sObject



24
25
26
# File 'lib/api/helpers/version.rb', line 24

def to_s
  @version
end