Class: Angus::SDoc::Definitions::Operation

Inherits:
Object
  • Object
show all
Defined in:
lib/angus/definitions/operation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#code_nameString

Returns the code name of the message. It is a human readable unique identifier. It has to start with Mayus and it has to be camelcase.

Returns:

  • (String)

    the code name of the message. It is a human readable unique identifier. It has to start with Mayus and it has to be camelcase.



12
13
14
# File 'lib/angus/definitions/operation.rb', line 12

def code_name
  @code_name
end

#descriptionString

Returns the description of the operation.

Returns:

  • (String)

    the description of the operation.



16
17
18
# File 'lib/angus/definitions/operation.rb', line 16

def description
  @description
end

#http_methodString

Returns the HTTP method of the operation.

Returns:

  • (String)

    the HTTP method of the operation.



24
25
26
# File 'lib/angus/definitions/operation.rb', line 24

def http_method
  @http_method
end

#messagesHash<String, Message>

Returns the messages associated with the operation.

Returns:

  • (Hash<String, Message>)

    the messages associated with the operation.



28
29
30
# File 'lib/angus/definitions/operation.rb', line 28

def messages
  @messages
end

#nameString

Returns the name of the operation.

Returns:

  • (String)

    the name of the operation.



7
8
9
# File 'lib/angus/definitions/operation.rb', line 7

def name
  @name
end

#pathString

Returns the path of the operation.

Returns:

  • (String)

    the path of the operation.



20
21
22
# File 'lib/angus/definitions/operation.rb', line 20

def path
  @path
end

#request_elementsSet<RequestElement>

Returns the request elements of the operation.

Returns:



36
37
38
# File 'lib/angus/definitions/operation.rb', line 36

def request_elements
  @request_elements
end

#response_elementsSet<ResponseElement>

Returns the response elements of the operation.

Returns:



40
41
42
# File 'lib/angus/definitions/operation.rb', line 40

def response_elements
  @response_elements
end

#uri_elementsSet<UriElement>

Returns the uri elements of the operation.

Returns:

  • (Set<UriElement>)

    the uri elements of the operation.



32
33
34
# File 'lib/angus/definitions/operation.rb', line 32

def uri_elements
  @uri_elements
end

Instance Method Details

#message(key, level) ⇒ Message

Returns the first message that matches the given key and level.

Parameters:

  • key (String)

    The key of the message.

  • level (String)

    The level of the message. Possible values are the *_LEVEL constants from Message.

Returns:

  • (Message)

    the message or nil if no one matches.



53
54
55
56
57
58
# File 'lib/angus/definitions/operation.rb', line 53

def message(key, level)
  return nil if self.messages.nil?

  level &&= level.downcase
  self.messages.find { |message| message.key == key && message.level.downcase == level }
end