opti/panda_doc

View on GitHub
lib/panda_doc/response_factory.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

module PandaDoc
  class ResponseFactory
    attr_reader :type
    private :type

    def self.build(type)
      new(type).build
    end

    def initialize(type)
      @type = type.capitalize
    end

    def build
      PandaDoc::Objects.const_get(type)
    end
  end
end