Class: Gitlab::GrapeOpenapi::Models::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/grape_openapi/models/server.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, description: nil, variables: nil) ⇒ Server

Returns a new instance of Server.



10
11
12
13
14
# File 'lib/gitlab/grape_openapi/models/server.rb', line 10

def initialize(url:, description: nil, variables: nil)
  @url = url
  @description = description
  @variables = variables
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/gitlab/grape_openapi/models/server.rb', line 8

def description
  @description
end

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/gitlab/grape_openapi/models/server.rb', line 8

def url
  @url
end

#variablesObject (readonly)

Returns the value of attribute variables.



8
9
10
# File 'lib/gitlab/grape_openapi/models/server.rb', line 8

def variables
  @variables
end

Instance Method Details

#to_hObject



16
17
18
19
20
21
# File 'lib/gitlab/grape_openapi/models/server.rb', line 16

def to_h
  hash = { url: url }
  hash[:description] = description if description.present?
  hash[:variables] = variables_to_h if variables.present?
  hash
end