Sha256: e8c8c75fa63a5552108c13041d41a645434a1b5959acd740117f7df369f26c53

Contents?: true

Size: 1.38 KB

Versions: 40

Compression:

Stored size: 1.38 KB

Contents

module Seahorse
  module Model
    class Api

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

      # @return [String, nil]
      attr_accessor :version

      # @return [Hash]
      attr_accessor :metadata

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

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

      def operation_names
        @operations.keys
      end

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

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

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

      def authorizer_names
        @authorizers.keys
      end

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

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

    end
  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
aws-sdk-core-3.36.0 lib/seahorse/model/api.rb
aws-sdk-core-3.35.0 lib/seahorse/model/api.rb
aws-sdk-core-3.34.0 lib/seahorse/model/api.rb
aws-sdk-core-3.33.0 lib/seahorse/model/api.rb
aws-sdk-core-3.32.0 lib/seahorse/model/api.rb
aws-sdk-core-3.31.0 lib/seahorse/model/api.rb
aws-sdk-core-3.30.0 lib/seahorse/model/api.rb
aws-sdk-core-3.29.0 lib/seahorse/model/api.rb
aws-sdk-core-3.28.0 lib/seahorse/model/api.rb
aws-sdk-core-3.27.1 lib/seahorse/model/api.rb
aws-sdk-core-3.27.0 lib/seahorse/model/api.rb
aws-sdk-core-3.26.0 lib/seahorse/model/api.rb
aws-sdk-core-3.25.0 lib/seahorse/model/api.rb
aws-sdk-core-3.24.1 lib/seahorse/model/api.rb
aws-sdk-core-3.24.0 lib/seahorse/model/api.rb
aws-sdk-core-3.23.0 lib/seahorse/model/api.rb
aws-sdk-core-3.22.1 lib/seahorse/model/api.rb
aws-sdk-core-3.22.0 lib/seahorse/model/api.rb
aws-sdk-core-3.21.3 lib/seahorse/model/api.rb
aws-sdk-core-3.21.2 lib/seahorse/model/api.rb