Sha256: b859ec5c3438d69112ac69f49b37d1b23e27bfd6a51ec016eac13e099921a064

Contents?: true

Size: 669 Bytes

Versions: 4

Compression:

Stored size: 669 Bytes

Contents

module RailsConnector

# TODO Caching:
# unlimited urls: ewig
# limited urls: zeitlimit - x (x fuer mindestverwendbarkeitszeit)
class ServiceBlob

  class << self

    def configure(config)
    end

    def find(id)
      new(id)
    end

  end

  attr_reader :id

  def initialize(id)
    @id = id
  end

  def url
    raw_data["url"]
  end

  def content_type
    meta_data[:content_type]
  end

  def length
    meta_data[:content_length].to_i
  end

  private

  def raw_data
    @raw_data ||= ContentService.query("blobs/query", :blob_ids => [id])["blobs"][id]
  end

  def meta_data
    @meta_data ||= RestClient.head(raw_data["meta_url"]).headers
  end
end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.356.19698103 lib/rails_connector/service_blob.rb
infopark_cloud_connector-6.8.0.348.160665197 lib/rails_connector/service_blob.rb
infopark_cloud_connector-6.8.0.328.4a753fc lib/rails_connector/service_blob.rb
infopark_cloud_connector-6.8.0.322.c003f11 lib/rails_connector/service_blob.rb