Sha256: 241eb4d838af1d5b61848beaa285227076e0cd43954aa2e61591bf8b567e2d1c

Contents?: true

Size: 1.01 KB

Versions: 5

Compression:

Stored size: 1.01 KB

Contents

$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))

require 'active_support/core_ext'
require 'rest_client'
require 'hashie'
require 'forwardable'

require 'reviewed/version'
require 'reviewed/util'
require 'reviewed/base'
require 'reviewed/collection'
require 'reviewed/request'
require 'reviewed/response'

require 'reviewed/website'
require 'reviewed/product'
require 'reviewed/author'
require 'reviewed/brand'
require 'reviewed/article'

module Reviewed
  class ConfigurationError < StandardError; end
  class ResourceError < StandardError; end

  @@config = {
    base_uri: 'http://localhost:3000/api'
  }

  def self.api_key=(token)
    @@config[:api_key] = token
  end

  def self.api_key
    @@config[:api_key]
  end

  def self.base_uri=(uri)
    @@config[:base_uri] = uri
  end

  def self.base_uri
    @@config[:base_uri]
  end

  def self.verify_key!
    if Reviewed.api_key.present?
      true
    else
      raise ConfigurationError.new("Please set Reviewed.api_key before making a request")
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
reviewed-0.0.5 lib/reviewed.rb
reviewed-0.0.4 lib/reviewed.rb
reviewed-0.0.3 lib/reviewed.rb
reviewed-0.0.2 lib/reviewed.rb
reviewed-0.0.1 lib/reviewed.rb