Class: Gitlab::QA::Component::Staging::GetRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/qa/component/staging.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, token) ⇒ GetRequest

Returns a new instance of GetRequest.



142
143
144
145
# File 'lib/gitlab/qa/component/staging.rb', line 142

def initialize(uri, token)
  @uri = uri
  @token = token
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



140
141
142
# File 'lib/gitlab/qa/component/staging.rb', line 140

def token
  @token
end

#uriObject (readonly)

Returns the value of attribute uri.



140
141
142
# File 'lib/gitlab/qa/component/staging.rb', line 140

def uri
  @uri
end

Instance Method Details

#execute!Object



147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/gitlab/qa/component/staging.rb', line 147

def execute!
  response =
    Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|
      http.request(build_request)
    end

  case response
  when Net::HTTPSuccess
    response
  else
    raise InvalidResponseError.new(uri.to_s, response)
  end
end