Class: OdataDuty::OAS2::IndividualDeletePath

Inherits:
Object
  • Object
show all
Defined in:
lib/odata_duty/oas2/individual_delete_path.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity_set) ⇒ IndividualDeletePath

Returns a new instance of IndividualDeletePath.



14
15
16
# File 'lib/odata_duty/oas2/individual_delete_path.rb', line 14

def initialize(entity_set)
  @entity_set = entity_set
end

Class Method Details

.to_oas2(entity_set) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/odata_duty/oas2/individual_delete_path.rb', line 4

def self.to_oas2(entity_set)
  path_info = new(entity_set)
  {
    'operationId' => path_info.operation_id
  }.merge(path_info.summary_and_description).merge(
    'parameters' => path_info.parameters,
    'responses' => path_info.responses
  )
end

Instance Method Details

#operation_idObject



18
19
20
# File 'lib/odata_duty/oas2/individual_delete_path.rb', line 18

def operation_id
  "Delete#{@entity_set.name}"
end

#parametersObject



29
30
31
32
33
# File 'lib/odata_duty/oas2/individual_delete_path.rb', line 29

def parameters
  [
    { 'name' => 'id', 'in' => 'path', 'required' => true, 'type' => id_type }
  ]
end

#responsesObject



35
36
37
38
39
40
41
# File 'lib/odata_duty/oas2/individual_delete_path.rb', line 35

def responses
  {
    '204' => { 'description' => 'No Content' },
    'default' => { 'description' => 'Unexpected error',
                   'schema' => { '$ref' => '#/definitions/Error' } }
  }
end

#summary_and_descriptionObject



22
23
24
25
26
27
# File 'lib/odata_duty/oas2/individual_delete_path.rb', line 22

def summary_and_description
  return {} unless @entity_set.description

  { 'summary' => OperationVerbs.delete(@entity_set.name),
    'description' => @entity_set.description }
end