Sha256: c96e828c158d3e137160563cc2e73d3cc56b882ecff7710b7d88253490e5a058

Contents?: true

Size: 644 Bytes

Versions: 3

Compression:

Stored size: 644 Bytes

Contents

module OfficialFM
  # @private
  module Authentication
    private

    # Authentication hash
    #
    # @return [Hash]
    def authentication
      {
        :consumer_key     => @api_key,
        :consumer_secret  => @api_secret,
        :token            => @access_token,
        :token_secret     => @access_secret,
      }
    end

    # Check whether user is authenticated
    #
    # @return [Boolean]
    def authenticated?
      authentication[:token] != nil
    end
    
    private
      
    def check_auth(name)
      raise "#{name} is an advanced API method - lacking OAuth credentials." unless authenticated?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
officialfm-0.1.2 lib/officialfm/authentication.rb
officialfm-0.1.1 lib/officialfm/authentication.rb
officialfm-0.1.0 lib/officialfm/authentication.rb