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 = {}
  @authorizers = {}
end

Instance Attribute Details

#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_authorizer(name, authorizer) ⇒ Object



61
62
63
# File 'lib/seahorse/model/api.rb', line 61

def add_authorizer(name, authorizer)
  @authorizers[name.to_sym] = authorizer
end

#add_operation(name, operation) ⇒ Object



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

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

#authorizer(name) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/seahorse/model/api.rb', line 49

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

#authorizer_namesObject



57
58
59
# File 'lib/seahorse/model/api.rb', line 57

def authorizer_names
  @authorizers.keys
end

#authorizers(&block) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/seahorse/model/api.rb', line 41

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

#inspect(*args) ⇒ Object



65
66
67
# File 'lib/seahorse/model/api.rb', line 65

def inspect(*args)
  "#<#{self.class.name}>"
end

#operation(name) ⇒ Object



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

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

#operation_namesObject



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

def operation_names
  @operations.keys
end

#operations(&block) ⇒ Object



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

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