Class: Gitlab::QA::Component::Staging::Version
- Inherits:
-
Object
- Object
- Gitlab::QA::Component::Staging::Version
- Defined in:
- lib/gitlab/qa/component/staging.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
-
#initialize(address) ⇒ Version
constructor
A new instance of Version.
- #major_minor_revision ⇒ Object
- #tag_end ⇒ Object
Constructor Details
#initialize(address) ⇒ Version
Returns a new instance of Version.
62 63 64 65 66 |
# File 'lib/gitlab/qa/component/staging.rb', line 62 def initialize(address) @uri = URI.join(address, '/api/v4/version') Runtime::Env.require_qa_access_token! end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
60 61 62 |
# File 'lib/gitlab/qa/component/staging.rb', line 60 def uri @uri end |
Instance Method Details
#major_minor_revision ⇒ Object
72 73 74 75 76 77 78 |
# File 'lib/gitlab/qa/component/staging.rb', line 72 def major_minor_revision api_response = api_get! version_regexp = /^v?(?<major>\d+)\.(?<minor>\d+)\.\d+/ match = version_regexp.match(api_response.fetch('version')) "#{match[:major]}.#{match[:minor]}-#{api_response.fetch('revision')}" end |
#tag_end ⇒ Object
68 69 70 |
# File 'lib/gitlab/qa/component/staging.rb', line 68 def tag_end official? ? version : revision end |