Sha256: 0a9109fc12bfd82f9eab3997c51522bc4ca6fefc751b77beb82842f5dee589eb

Contents?: true

Size: 1.58 KB

Versions: 72

Compression:

Stored size: 1.58 KB

Contents

module Seahorse
  module Model
    class Api

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

      # @return [String, nil]
      attr_accessor :version

      # @return [Hash]
      attr_accessor :metadata

      # @return [Symbol|nil]
      attr_accessor :endpoint_operation

      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 async_operation_names
        @operations.select {|_, op| op.async }.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

72 entries across 72 versions & 1 rubygems

Version Path
aws-sdk-core-3.96.1 lib/seahorse/model/api.rb
aws-sdk-core-3.96.0 lib/seahorse/model/api.rb
aws-sdk-core-3.95.0 lib/seahorse/model/api.rb
aws-sdk-core-3.94.1 lib/seahorse/model/api.rb
aws-sdk-core-3.94.0 lib/seahorse/model/api.rb
aws-sdk-core-3.93.0 lib/seahorse/model/api.rb
aws-sdk-core-3.92.0 lib/seahorse/model/api.rb
aws-sdk-core-3.91.1 lib/seahorse/model/api.rb
aws-sdk-core-3.91.0 lib/seahorse/model/api.rb
aws-sdk-core-3.90.1 lib/seahorse/model/api.rb
aws-sdk-core-3.90.0 lib/seahorse/model/api.rb
aws-sdk-core-3.89.1 lib/seahorse/model/api.rb
aws-sdk-core-3.89.0 lib/seahorse/model/api.rb
aws-sdk-core-3.88.0 lib/seahorse/model/api.rb
aws-sdk-core-3.87.0 lib/seahorse/model/api.rb
aws-sdk-core-3.86.0 lib/seahorse/model/api.rb
aws-sdk-core-3.85.1 lib/seahorse/model/api.rb
aws-sdk-core-3.85.0 lib/seahorse/model/api.rb
aws-sdk-core-3.84.0 lib/seahorse/model/api.rb
aws-sdk-core-3.83.0 lib/seahorse/model/api.rb