Sha256: 87aad10f383ddb4691ecdbee750fac4053c60156302ace7291a99fca9b62144d

Contents?: true

Size: 589 Bytes

Versions: 5

Compression:

Stored size: 589 Bytes

Contents

module Vertebrae
  class API
    include Request

    attr_accessor :connection

    # Create new API
    #
    def initialize(options={}, &block)
      options = default_options.merge(options)

      yield_or_eval(&block) if block_given?
      self.connection = Connection.new(options)
      self.connection.configuration.process_basic_auth(options[:basic_auth])
      setup
    end

    def setup
    end

    def default_options
      {}
    end

    def yield_or_eval(&block)
      return unless block
      block.arity > 0 ? yield(self) : self.instance_eval(&block)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vertebrae-0.2.10 lib/api.rb
vertebrae-0.2.9 lib/api.rb
vertebrae-0.2.8 lib/api.rb
vertebrae-0.2.7 lib/api.rb
vertebrae-0.2.6 lib/api.rb