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 sevice.
-
#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 sevice.
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
#initialize ⇒ Service
38 39 40 41 42 43 |
# File 'lib/angus/definitions/service.rb', line 38 def initialize = {} @operations = Set.new @representations = Set.new @glossary = Angus::SDoc::Definitions::Glossary.new end |
Instance Attribute Details
#code_name ⇒ String
12 13 14 |
# File 'lib/angus/definitions/service.rb', line 12 def code_name @code_name end |
#glossary ⇒ Glossary
36 37 38 |
# File 'lib/angus/definitions/service.rb', line 36 def glossary @glossary end |
#messages ⇒ Hash<String, Message>
20 21 22 |
# File 'lib/angus/definitions/service.rb', line 20 def end |
#name ⇒ String
7 8 9 |
# File 'lib/angus/definitions/service.rb', line 7 def name @name end |
#operations ⇒ Set<Operation>
24 25 26 |
# File 'lib/angus/definitions/service.rb', line 24 def operations @operations end |
#proxy_operations ⇒ Set<ProxyOperation>
28 29 30 |
# File 'lib/angus/definitions/service.rb', line 28 def proxy_operations @proxy_operations end |
#representations ⇒ Set<Representation>
32 33 34 |
# File 'lib/angus/definitions/service.rb', line 32 def representations @representations end |
#version ⇒ String
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.
71 72 73 74 75 76 |
# File 'lib/angus/definitions/service.rb', line 71 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.
55 56 57 58 59 60 61 |
# File 'lib/angus/definitions/service.rb', line 55 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.
83 84 85 |
# File 'lib/angus/definitions/service.rb', line 83 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.
93 94 95 96 97 |
# File 'lib/angus/definitions/service.rb', line 93 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.
106 107 108 109 110 111 112 |
# File 'lib/angus/definitions/service.rb', line 106 def representations_hash hash = {} @representations.each do |representation| hash[representation.name] = representation end hash end |