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.
41 42 43 |
# File 'lib/gitlab/qa/component/staging.rb', line 41 def initialize(address) @uri = URI.join(address, '/api/v4/version') end |
Instance Method Details
#fetch! ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/gitlab/qa/component/staging.rb', line 45 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 |