Sha256: b15cc5b1a02f2b04e8cd6a9f0d9fd72130774afd852cdf5ba25b7f85eee1da34

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

require "digest"

module Duracloud
  class RequestOptions

    attr_reader :payload, :content_type, :md5, :properties, :query

    def initialize(**options)
      @payload      = options.delete(:payload)
      @content_type = options.delete(:content_type)
      @md5          = options.delete(:md5)
      @properties   = options.delete(:properties)
      @query        = options.delete(:query) { |k| Hash.new }.merge(options)
    end

    def headers
      Hash.new.tap do |h|
        h["Content-MD5"] = md5 if md5
        h["Content-Type"] = content_type if content_type
        h.update(properties) if properties
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
duracloud-client-0.0.1 lib/duracloud/request_options.rb