Module: Ronnie::Authentication

Included in:
Client
Defined in:
lib/ronnie/authentication.rb

Instance Method Summary collapse

Instance Method Details

#authenticateObject



3
4
5
6
7
8
9
10
11
12
# File 'lib/ronnie/authentication.rb', line 3

def authenticate
  credentials = {}

  if consumer_key && consumer_secret
    credentials[:consumer_key]    = consumer_key
    credentials[:consumer_secret] = consumer_secret
  end
  
  credentials
end

#authenticated?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/ronnie/authentication.rb', line 25

def authenticated?
  !authenticate.empty?
end

#authorizeObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/ronnie/authentication.rb', line 14

def authorize
  credentials = {}

  if token && token_secret
    credentials[:token]        = token
    credentials[:token_secret] = token_secret
  end

  authenticate.merge! credentials
end

#authorized?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/ronnie/authentication.rb', line 29

def authorized?
  !token.nil?
end