Sha256: 0e35a0b8db8cf796d048d894b9280ccfddeecec10b030637e8f1f1b2c7757f52

Contents?: true

Size: 658 Bytes

Versions: 10

Compression:

Stored size: 658 Bytes

Contents

module Vertebrae
  class API
    include Request

    attr_accessor :connection, :initialisation_options

    # Create new API
    #
    def initialize(options={}, &block)
      self.initialisation_options = options
      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

10 entries across 10 versions & 1 rubygems

Version Path
vertebrae-0.6.0 lib/api.rb
vertebrae-0.5.1 lib/api.rb
vertebrae-0.5.0 lib/api.rb
vertebrae-0.4.3 lib/api.rb
vertebrae-0.4.2 lib/api.rb
vertebrae-0.4.1 lib/api.rb
vertebrae-0.4.0 lib/api.rb
vertebrae-0.3.1 lib/api.rb
vertebrae-0.3.0 lib/api.rb
vertebrae-0.2.11 lib/api.rb