Module: F00px::Authentication

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

Instance Method Summary collapse

Instance Method Details

#xauth(username, password) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/f00px/authentication.rb', line 4

def xauth(username, password)
  unless token? && token_secret?
    begin
      response = post('oauth/request_token')
      parse_oauth_response(response)

      params = { x_auth_mode: "client_auth", x_auth_username: username, x_auth_password: password}
      response = post("oauth/access_token", params)
      parse_oauth_response(response)
    rescue F00px::Error => e
      self.token = self.token_secret =  nil
      raise e
    end
  end
end