Sha256: ce24fcbb7bcf3ad7efad82a82ae5f42eb9b4b449a8847f447e1a9331c816d565

Contents?: true

Size: 601 Bytes

Versions: 3

Compression:

Stored size: 601 Bytes

Contents

require "base64"

module Nuvado
  module Backend
    class AuthenticatedResource < BasicResource
      class << self
        def configure_authentication(token)
          encoded_token = Base64.strict_encode64(token)
          headers['Accept'] = 'application/json'
          headers['Authorization'] =  "Basic #{encoded_token}"
        end

        def headers
          if defined?(@headers)
            @headers
          elsif superclass != Object && superclass.headers
            superclass.headers
          else
            @headers ||= {}
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nuvado-1.0.0.rc3 lib/nuvado/backend/authenticated_resource.rb
nuvado-1.0.0.rc2 lib/nuvado/backend/authenticated_resource.rb
nuvado-1.0.0.rc1 lib/nuvado/backend/authenticated_resource.rb