Sha256: b7414ac89ba4b3893dd9a47cd28c1c58c5a314b44140e7e82bf2a6c510066a53

Contents?: true

Size: 1.09 KB

Versions: 20

Compression:

Stored size: 1.09 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 :Collection, "harpy/collection"
  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

20 entries across 20 versions & 1 rubygems

Version Path
harpy-1.0.0 lib/harpy.rb
harpy-0.5.2 lib/harpy.rb
harpy-0.5.1 lib/harpy.rb
harpy-0.5.0 lib/harpy.rb
harpy-0.4.5 lib/harpy.rb
harpy-0.4.4 lib/harpy.rb
harpy-0.4.3 lib/harpy.rb
harpy-0.4.2 lib/harpy.rb
harpy-0.4.1 lib/harpy.rb
harpy-0.4.0 lib/harpy.rb
harpy-0.3.0 lib/harpy.rb
harpy-0.2.1 lib/harpy.rb
harpy-0.2.0 lib/harpy.rb
harpy-0.1.14 lib/harpy.rb
harpy-0.1.13 lib/harpy.rb
harpy-0.1.12 lib/harpy.rb
harpy-0.1.11 lib/harpy.rb
harpy-0.1.10 lib/harpy.rb
harpy-0.1.9 lib/harpy.rb
harpy-0.1.8 lib/harpy.rb