Sha256: 618ae3b0689923bd627be506cf2b370532a26fae828a8fb6019b6e0fb5842454

Contents?: true

Size: 984 Bytes

Versions: 1

Compression:

Stored size: 984 Bytes

Contents

# frozen_string_literal: true

require "active_support/all"
require "http"

require "qismo/util"
require "qismo/version"
require "qismo/error"
require "qismo/model"
require "qismo/api"
require "qismo/client"

# Qismo
module Qismo
  class << self
    def configure
      yield client

      client
    end

    def new(**opt)
      @client = Client.new(opt)
    end

    if Gem::Version.new(RUBY_VERSION).release >= Gem::Version.new("3.0.0")
      def method_missing(method, *args, **kwargs, &block)
        return super unless client.respond_to?(method)

        client.send(method, *args, **kwargs, &block)
      end
    else
      def method_missing(method, *args, &block)
        return super unless client.respond_to?(method)

        client.send(method, *args, &block)
      end
    end

    def respond_to_missing?(method_name, *args)
      Qismo::Client.instance_methods.include?(method_name)
    end

    private

    def client
      @client ||= Client.new
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
qismo-0.8.7 lib/qismo.rb