Sha256: a3ecb3e269c11fb4cdf4764abd362c624b0804d262194d8c49fafc66560dab5e

Contents?: true

Size: 863 Bytes

Versions: 2

Compression:

Stored size: 863 Bytes

Contents

# frozen_string_literal: true

require "openapi3_parser/node/oauth_flows"
require "openapi3_parser/node_factory/oauth_flow"
require "openapi3_parser/node_factory/object"
require "openapi3_parser/node_factory/optional_reference"

module Openapi3Parser
  module NodeFactory
    class OauthFlows < NodeFactory::Object
      allow_extensions
      field "implicit", factory: :oauth_flow_factory
      field "password", factory: :oauth_flow_factory
      field "clientCredentials", factory: :oauth_flow_factory
      field "authorizationCode", factory: :oauth_flow_factory

      private

      def oauth_flow_factory(context)
        NodeFactory::OptionalReference.new(NodeFactory::OauthFlow)
                                      .call(context)
      end

      def build_object(data, context)
        Node::OauthFlows.new(data, context)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
openapi3_parser-0.5.1 lib/openapi3_parser/node_factory/oauth_flows.rb
openapi3_parser-0.5.0 lib/openapi3_parser/node_factory/oauth_flows.rb