Sha256: 4fcf65f30144ca3bd7da64e535dfb6bcbc2e39d006aa24818fb3bfdea4c5f977

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

require 'yaml'
require 'json'
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/hash/slice'
require 'active_support/core_ext/object/try'
require 'brainstem_adaptor/specification'
require 'brainstem_adaptor/association'
require 'brainstem_adaptor/record'
require 'brainstem_adaptor/invalid_response_error'
require 'brainstem_adaptor/parsers/array_parser'
require 'brainstem_adaptor/response'

module BrainstemAdaptor
  VERSION = '0.0.4'

  def self.parser
    @parser ||= JSON
  end

  # @param parser Any JSON parser
  # @raise [ArgumentError] if parser does not respond to #parse
  def self.parser=(parser)
    raise ArgumentError, 'Parser must respond to #parse message' unless parser.respond_to?(:parse)
    @parser = parser
  end

  # @return [BrainstemAdaptor::Specification]
  def self.default_specification
    BrainstemAdaptor::Specification[:default]
  end

  # @param specification [Hash]
  def self.specification=(specification)
    BrainstemAdaptor::Specification[:default] = specification
  end

  # @param path [String] Path to YML specification file
  def self.load_specification(path)
    self.specification = YAML::load_file(path)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brainstem-adaptor-0.0.4 lib/brainstem-adaptor.rb