Sha256: 2b4d2b5d0a430e669b1b291be3d4e8dadb5a37dbbb84a17181185f7efbf0048a

Contents?: true

Size: 492 Bytes

Versions: 2

Compression:

Stored size: 492 Bytes

Contents

module RDStation
  class AuthorizationHeader
    
    def initialize(access_token:)
      @access_token = access_token
      validate_access_token access_token
    end
    
    def to_h
      { "Authorization" => "Bearer #{@access_token}", "Content-Type" => "application/json" }
    end
    
    private
    
    def validate_access_token(access_token)
      access_token_msg = ':access_token is required'
      raise ArgumentError, access_token_msg unless access_token
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rdstation-ruby-client-2.1.0 lib/rdstation/authorization_header.rb
rdstation-ruby-client-2.0.0 lib/rdstation/authorization_header.rb