Sha256: 5f7af2d7fc24e7839b8b1eab039a2b6c9b29cdb2417711c3a19e830a39288c93

Contents?: true

Size: 787 Bytes

Versions: 12

Compression:

Stored size: 787 Bytes

Contents

##
# LDP client for presenting an ORM on top of an LDP resource
module Ldp
  class Client

    require 'ldp/client/methods'
    include Ldp::Client::Methods

    def initialize *http_client
      initialize_http_client *http_client
    end

    # Find or initialize a new LDP resource by URI
    def find_or_initialize subject, options = {}
      data = get(subject, options = {})

      case
      when !data.is_a?(Ldp::Response)
        Resource::BinarySource.new self, subject, data
      when data.container?
        Ldp::Container.new_from_response self, subject, data
      when data.resource?
        Resource::RdfSource.new self, subject, data
      else
        Resource::BinarySource.new self, subject, data
      end
    end

    def logger
      Ldp.logger
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ldp-0.2.3 lib/ldp/client.rb
ldp-0.2.2 lib/ldp/client.rb
ldp-0.2.1 lib/ldp/client.rb
ldp-0.2.0 lib/ldp/client.rb
ldp-0.1.0 lib/ldp/client.rb
ldp-0.0.10 lib/ldp/client.rb
ldp-0.0.9 lib/ldp/client.rb
ldp-0.0.8 lib/ldp/client.rb
ldp-0.0.7 lib/ldp/client.rb
ldp-0.0.6 lib/ldp/client.rb
ldp-0.0.5 lib/ldp/client.rb
ldp-0.0.4 lib/ldp/client.rb