Sha256: 84ff4fa09c900c3db074cd30209d480954e28e699a8fd314db883639a200d6ac

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

module Harpy
  class Exception < ::Exception; end
  class EntryPointRequired < Exception; end
  class UrlRequired < Exception; end
  class BodyToBig < Exception; end
  class ClientTimeout < Exception; end
  class ClientError < Exception; end
  class Unauthorized < Exception; end
  class InvalidResponseCode < Exception; end

  autoload :Client, "harpy/client"
  autoload :EntryPoint, "harpy/entry_point"
  autoload :Resource, "harpy/resource"
  autoload :BodyToBig, "harpy/resource"
  autoload :UnknownResponseCode, "harpy/resource"

  def self.client=(new_client)
    @client = new_client
  end

  def self.client
    @client ||= Client.new
  end

  def self.entry_point_url=(url)
    @entry_point = EntryPoint.new url
  end

  def self.entry_point_url
    @entry_point.url if @entry_point
  end

  def self.entry_point=(value)
    @entry_point = value
  end

  def self.entry_point
    @entry_point || raise(EntryPointRequired, 'you can setup one with Harpy.entry_point_url = "http://localhost"')
  end
  
  def self.reset
    @client = nil
    @entry_point = nil
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
harpy-0.1.7 lib/harpy.rb
harpy-0.1.6 lib/harpy.rb
harpy-0.1.5 lib/harpy.rb
harpy-0.1.4 lib/harpy.rb
harpy-0.1.3 lib/harpy.rb
harpy-0.1.2 lib/harpy.rb
harpy-0.1.1 lib/harpy.rb
harpy-0.1.0 lib/harpy.rb