Class: Seahorse::Model::Api
- Inherits:
-
Object
- Object
- Seahorse::Model::Api
- Defined in:
- lib/seahorse/model/api.rb
Instance Attribute Summary collapse
- #endpoint_operation ⇒ Symbol|nil
- #metadata ⇒ Hash
- #require_endpoint_discovery ⇒ Boolean|nil
- #version ⇒ String?
Instance Method Summary collapse
- #add_authorizer(name, authorizer) ⇒ Object
- #add_operation(name, operation) ⇒ Object
- #async_operation_names ⇒ Object
- #authorizer(name) ⇒ Object
- #authorizer_names ⇒ Object
- #authorizers(&block) ⇒ Object
-
#initialize ⇒ Api
constructor
A new instance of Api.
- #inspect(*args) ⇒ Object
- #operation(name) ⇒ Object
- #operation_names ⇒ Object
- #operations(&block) ⇒ Object
Constructor Details
#initialize ⇒ Api
Returns a new instance of Api.
7 8 9 10 11 12 13 |
# File 'lib/seahorse/model/api.rb', line 7 def initialize @metadata = {} @operations = {} @authorizers = {} @endpoint_operation = nil @require_endpoint_discovery = false end |
Instance Attribute Details
#endpoint_operation ⇒ Symbol|nil
22 23 24 |
# File 'lib/seahorse/model/api.rb', line 22 def endpoint_operation @endpoint_operation end |
#metadata ⇒ Hash
19 20 21 |
# File 'lib/seahorse/model/api.rb', line 19 def @metadata end |
#require_endpoint_discovery ⇒ Boolean|nil
25 26 27 |
# File 'lib/seahorse/model/api.rb', line 25 def require_endpoint_discovery @require_endpoint_discovery end |
#version ⇒ String?
16 17 18 |
# File 'lib/seahorse/model/api.rb', line 16 def version @version end |
Instance Method Details
#add_authorizer(name, authorizer) ⇒ Object
75 76 77 |
# File 'lib/seahorse/model/api.rb', line 75 def (name, ) @authorizers[name.to_sym] = end |
#add_operation(name, operation) ⇒ Object
51 52 53 |
# File 'lib/seahorse/model/api.rb', line 51 def add_operation(name, operation) @operations[name.to_sym] = operation end |
#async_operation_names ⇒ Object
47 48 49 |
# File 'lib/seahorse/model/api.rb', line 47 def async_operation_names @operations.select {|_, op| op.async }.keys end |
#authorizer(name) ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/seahorse/model/api.rb', line 63 def (name) if @authorizers.key?(name.to_sym) @authorizers[name.to_sym] else raise ArgumentError, "unknown authorizer #{name.inspect}" end end |
#authorizer_names ⇒ Object
71 72 73 |
# File 'lib/seahorse/model/api.rb', line 71 def @authorizers.keys end |
#authorizers(&block) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/seahorse/model/api.rb', line 55 def (&block) if block_given? @authorizers.each(&block) else @authorizers.enum_for(:each) end end |
#inspect(*args) ⇒ Object
79 80 81 |
# File 'lib/seahorse/model/api.rb', line 79 def inspect(*args) "#<#{self.class.name}>" end |
#operation(name) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/seahorse/model/api.rb', line 35 def operation(name) if @operations.key?(name.to_sym) @operations[name.to_sym] else raise ArgumentError, "unknown operation #{name.inspect}" end end |
#operation_names ⇒ Object
43 44 45 |
# File 'lib/seahorse/model/api.rb', line 43 def operation_names @operations.keys end |
#operations(&block) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/seahorse/model/api.rb', line 27 def operations(&block) if block_given? @operations.each(&block) else @operations.enum_for(:each) end end |