Class: Angus::SDoc::Definitions::Service
- Inherits:
-
Object
- Object
- Angus::SDoc::Definitions::Service
- Defined in:
- lib/angus/definitions/service.rb
Instance Attribute Summary collapse
-
#code_name ⇒ String
The service code name is a unique identifier.
-
#glossary ⇒ Glossary
The glossary of the service.
-
#messages ⇒ Hash<String, Message>
The messages associated with the service.
-
#name ⇒ String
The name of the service.
-
#operations ⇒ Set<Operation>
The operations of the service.
-
#proxy_operations ⇒ Set<ProxyOperation>
The proxy operations of the service.
-
#representations ⇒ Set<Representation>
The representations of the service.
-
#version ⇒ String
The version of the service.
Instance Method Summary collapse
-
#initialize ⇒ Service
constructor
A new instance of Service.
-
#merge(other) ⇒ Object
Merge the following definitions: - Operations.
-
#message(key, level = nil) ⇒ Message
Returns the message that matches the given key and level.
-
#operation_definition(namespace, operation_code_name) ⇒ Operation
Returns the operation definition that matches with the given operation name.
-
#proxy_operations_for(service) ⇒ Array<ProxyOperation>
Returns the proxy operations for a given service.
-
#representations_hash ⇒ Hash<String, Representation>
Returns a hash with the representations.
Constructor Details
Instance Attribute Details
#code_name ⇒ String
Returns the service code name is a unique identifier. It has to be human-readable and a valid literal identifier.
12 13 14 |
# File 'lib/angus/definitions/service.rb', line 12 def code_name @code_name end |
#glossary ⇒ Glossary
Returns the glossary of the service.
36 37 38 |
# File 'lib/angus/definitions/service.rb', line 36 def glossary @glossary end |
#messages ⇒ Hash<String, Message>
Returns the messages associated with the service.
20 21 22 |
# File 'lib/angus/definitions/service.rb', line 20 def @messages end |
#name ⇒ String
Returns the name of the service.
7 8 9 |
# File 'lib/angus/definitions/service.rb', line 7 def name @name end |
#operations ⇒ Set<Operation>
Returns the operations of the service.
24 25 26 |
# File 'lib/angus/definitions/service.rb', line 24 def operations @operations end |
#proxy_operations ⇒ Set<ProxyOperation>
Returns the proxy operations of the service.
28 29 30 |
# File 'lib/angus/definitions/service.rb', line 28 def proxy_operations @proxy_operations end |
#representations ⇒ Set<Representation>
Returns the representations of the service.
32 33 34 |
# File 'lib/angus/definitions/service.rb', line 32 def representations @representations end |
#version ⇒ String
Returns the version of the service.
16 17 18 |
# File 'lib/angus/definitions/service.rb', line 16 def version @version end |
Instance Method Details
#merge(other) ⇒ Object
This method does not merge glossary terms.
Merge the following definitions:
- Operations.
- Representations.
- Messages.
72 73 74 75 76 77 |
# File 'lib/angus/definitions/service.rb', line 72 def merge(other) self.operations.merge!(other.operations) self.representations += other.representations self..merge!(other.) end |
#message(key, level = nil) ⇒ Message
Returns the message that matches the given key and level.
This method searches for messages in all the operations and returns the first message that matches.
56 57 58 59 60 61 62 |
# File 'lib/angus/definitions/service.rb', line 56 def (key, level = nil) = self..find do |, | == key && (!level || .level.downcase == level) end .last if end |
#operation_definition(namespace, operation_code_name) ⇒ Operation
Returns the operation definition that matches with the given operation name.
84 85 86 |
# File 'lib/angus/definitions/service.rb', line 84 def operation_definition(namespace, operation_code_name) @operations[namespace].find { |operation| operation.code_name == operation_code_name } end |
#proxy_operations_for(service) ⇒ Array<ProxyOperation>
Does it receives the service or the service name?
Verify if this method is being called by remote-client and if it receives the service name.
Returns the proxy operations for a given service.
94 95 96 97 98 |
# File 'lib/angus/definitions/service.rb', line 94 def proxy_operations_for(service) self.proxy_operations.select do |op| op.service_name == service end end |
#representations_hash ⇒ Hash<String, Representation>
Returns a hash with the representations.
107 108 109 110 111 112 113 |
# File 'lib/angus/definitions/service.rb', line 107 def representations_hash hash = {} @representations.each do |representation| hash[representation.name] = representation end hash end |