Class: Seahorse::Model::Api

Inherits:
Object
  • Object
show all
Defined in:
aws-sdk-core/lib/seahorse/model/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(definition = {}) ⇒ Api


6
7
8
9
10
11
12
13
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 6

def initialize(definition = {})
   = definition['metadata'] || {}
  @version = ('apiVersion')
  @documentation = definition['documentation']
  @definition = definition
  @shape_map = ShapeMap.new(definition['shapes'] || {})
  compute_operations
end

Instance Attribute Details

#definitionHash (readonly)


28
29
30
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 28

def definition
  @definition
end

#documentationString? (readonly)


22
23
24
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 22

def documentation
  @documentation
end

#operation_namesArray<Symbol> (readonly)


19
20
21
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 19

def operation_names
  @operation_names
end

#shape_mapShapeMap (readonly)


25
26
27
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 25

def shape_map
  @shape_map
end

#versionString? (readonly)


16
17
18
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 16

def version
  @version
end

Instance Method Details

#metadata(key) ⇒ Object?


55
56
57
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 55

def (key)
  [key]
end

#operation(name) ⇒ Operation


39
40
41
42
43
44
45
46
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 39

def operation(name)
  name = name.to_sym
  if definition = @operation_defs[name.to_sym]
    @operations[name] ||= Operation.new(definition, shape_map: @shape_map)
  else
    raise ArgumentError, "unknown operation :#{name}"
  end
end

#operation?(name) ⇒ Boolean


33
34
35
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 33

def operation?(name)
  @operation_defs.key?(name.to_sym)
end

#operationsEnumerable


49
50
51
# File 'aws-sdk-core/lib/seahorse/model/api.rb', line 49

def operations
  enum_for(:each_operation) { |*args| operation_names.size }
end