Class: Seahorse::Model::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/seahorse/model/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApi

Returns a new instance of Api.



5
6
7
8
9
# File 'lib/seahorse/model/api.rb', line 5

def initialize
  @metadata = {}
  @operations = {}
  @endpoint_operation = nil
end

Instance Attribute Details

#endpoint_operationSymbol|nil

Returns:

  • (Symbol|nil)


18
19
20
# File 'lib/seahorse/model/api.rb', line 18

def endpoint_operation
  @endpoint_operation
end

#metadataHash

Returns:

  • (Hash)


15
16
17
# File 'lib/seahorse/model/api.rb', line 15

def 
  @metadata
end

#versionString?

Returns:

  • (String, nil)


12
13
14
# File 'lib/seahorse/model/api.rb', line 12

def version
  @version
end

Instance Method Details

#add_operation(name, operation) ⇒ Object



40
41
42
# File 'lib/seahorse/model/api.rb', line 40

def add_operation(name, operation)
  @operations[name.to_sym] = operation
end

#operation(name) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/seahorse/model/api.rb', line 28

def operation(name)
  if @operations.key?(name.to_sym)
    @operations[name.to_sym]
  else
    raise ArgumentError, "unknown operation #{name.inspect}"
  end
end

#operation_namesObject



36
37
38
# File 'lib/seahorse/model/api.rb', line 36

def operation_names
  @operations.keys
end

#operations(&block) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/seahorse/model/api.rb', line 20

def operations(&block)
  if block_given?
    @operations.each(&block)
  else
    @operations.enum_for(:each)
  end
end