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.
60 61 62 63 64 |
# File 'lib/gitlab/qa/component/staging.rb', line 60 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.
58 59 60 |
# File 'lib/gitlab/qa/component/staging.rb', line 58 def uri @uri end |
Instance Method Details
#major_minor_revision ⇒ Object
70 71 72 73 74 75 76 |
# File 'lib/gitlab/qa/component/staging.rb', line 70 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
66 67 68 |
# File 'lib/gitlab/qa/component/staging.rb', line 66 def tag_end official? ? version : revision end |