Sha256: e54cfb15c77ff2a90b54d5528e77a63848c83c41cd3a7855d45a50e3315df484

Contents?: true

Size: 827 Bytes

Versions: 4

Compression:

Stored size: 827 Bytes

Contents

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

    require 'ldp/client/methods'
    require 'ldp/client/prefer_headers'
    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

4 entries across 4 versions & 1 rubygems

Version Path
ldp-0.4.1 lib/ldp/client.rb
ldp-0.4.0 lib/ldp/client.rb
ldp-0.3.1 lib/ldp/client.rb
ldp-0.3.0 lib/ldp/client.rb