Class: Gitlab::QA::Component::Staging::Version
- Inherits:
-
Object
- Object
- Gitlab::QA::Component::Staging::Version
- Defined in:
- lib/gitlab/qa/component/staging.rb
Instance Method Summary collapse
- #fetch! ⇒ Object
-
#initialize(address) ⇒ Version
constructor
A new instance of Version.
Constructor Details
#initialize(address) ⇒ Version
Returns a new instance of Version.
44 45 46 |
# File 'lib/gitlab/qa/component/staging.rb', line 44 def initialize(address) @uri = URI.join(address, '/api/v4/version') end |
Instance Method Details
#fetch! ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/gitlab/qa/component/staging.rb', line 48 def fetch! response = Net::HTTP.start(@uri.host, @uri.port, use_ssl: true) do |http| http.request(request) end case response when Net::HTTPSuccess JSON.parse(response.body).fetch('version') else raise InvalidResponseError.new(@uri.to_s, response) end end |