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

Returns a new instance of Api.

Parameters:

  • definition (Hash) (defaults to: {})

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)

Returns:

  • (Hash)

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

def definition
  @definition
end

#documentationString? (readonly)

Returns:

  • (String, nil)

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

def documentation
  @documentation
end

#operation_namesArray<Symbol> (readonly)

Returns:

  • (Array<Symbol>)

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

def operation_names
  @operation_names
end

#shape_mapShapeMap (readonly)

Returns:

  • (ShapeMap)

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

def shape_map
  @shape_map
end

#versionString? (readonly)

Returns:

  • (String, nil)

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

def version
  @version
end

Instance Method Details

#metadata(key) ⇒ Object?

Parameters:

  • key (String)

Returns:

  • (Object, nil)

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

def (key)
  [key]
end

#operation(name) ⇒ Operation

Parameters:

  • name (Symbol)

Returns:


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

Returns true if this API provides an operation with the given name.

Parameters:

  • name (Symbol)

Returns:

  • (Boolean)

    Returns true if this API provides an operation with the given name.


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

Returns:

  • (Enumerable)

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