Sha256: b8f3cee47ab0ac65b0af2326b947434711d41cff4e36324ba08b58665ddeefc0

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

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"

module Qismo
  # @!parse extend Qismo::Api

  class << self
    def configure
      yield client

      client
    end

    # Initiate Qismo ruby client
    #
    # @param options [Hash]
    # @return [Qismo::Client]
    def new(options = {})
      @client = Client.new(options)
    end

    # @return [Qismo::Client]
    def client
      @client ||= Client.new
    end

    private

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

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

    def respond_to?(method_name, include_private = false)
      client.respond_to?(method_name, include_private) || super(method_name, include_private)
    end

    def respond_to_missing?(method_name, include_private = false)
      client.respond_to?(method_name, include_private) || super(method_name, include_private)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
qismo-0.11.3 lib/qismo.rb
qismo-0.11.2 lib/qismo.rb