Class: Authorization

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/authorization.rb

Overview

The Authorizaton model handels the authentication for the customer model.

Instance Method Summary (collapse)

Instance Method Details

- (Object) fetch_details

Fetch customer details from a authentication provider.



10
11
12
# File 'app/models/authorization.rb', line 10

def fetch_details
  self.send("fetch_details_from_#{self.provider.downcase}")
end

- (Object) fetch_details_from_devise

Fetch customer details from devise



25
26
27
28
# File 'app/models/authorization.rb', line 25

def fetch_details_from_devise
  self.username = 'devise_user'
  self.save
end

- (Object) fetch_details_from_facebook

Fetch customer details from facebook.



16
17
18
19
20
21
# File 'app/models/authorization.rb', line 16

def fetch_details_from_facebook
  graph = Koala::Facebook::API.new(self.token)
  facebook_data = graph.get_object("me")
  self.username = facebook_data['username']
  self.save
end