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
# File 'lib/seahorse/model/api.rb', line 5

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

Instance Attribute Details

#metadataHash

Returns:

  • (Hash)


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

def 
  @metadata
end

#versionString?

Returns:

  • (String, nil)


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

def version
  @version
end

Instance Method Details

#add_operation(name, operation) ⇒ Object



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

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

#operation(name) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/seahorse/model/api.rb', line 24

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

#operation_namesObject



32
33
34
# File 'lib/seahorse/model/api.rb', line 32

def operation_names
  @operations.keys
end

#operations(&block) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/seahorse/model/api.rb', line 16

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