Sha256: 4ff9c20e4be8fb30b44ae0e37eb3e2373c9b9db3a8aa71d85659a47d51d910c5

Contents?: true

Size: 498 Bytes

Versions: 7

Compression:

Stored size: 498 Bytes

Contents

module Ldp
  class Resource::BinarySource < Ldp::Resource
    attr_accessor :content

    def initialize client, subject, content_or_response = nil, base_path = ''
      super
      
      case content_or_response
      when Faraday::Response
      else
        @content = content_or_response
      end
    end
    
    def content
      @content ||= get.body
    end
    
    def described_by
      client.find_or_initialize Array(Ldp::Response.links(self)["describedby"]).first
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ldp-0.2.0 lib/ldp/resource/binary_source.rb
ldp-0.1.0 lib/ldp/resource/binary_source.rb
ldp-0.0.10 lib/ldp/resource/binary_source.rb
ldp-0.0.9 lib/ldp/resource/binary_source.rb
ldp-0.0.8 lib/ldp/resource/binary_source.rb
ldp-0.0.7 lib/ldp/resource/binary_source.rb
ldp-0.0.6 lib/ldp/resource/binary_source.rb