Class: Service
Overview
Copyright (c) 2010-2011, Diaspora Inc. This file is
licensed under the Affero General Public License version 3 or later. See
the COPYRIGHT file.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#access_level ⇒ Object
Returns the value of attribute access_level.
8
9
10
|
# File 'app/models/service.rb', line 8
def access_level
@access_level
end
|
#info ⇒ Object
Returns the value of attribute info.
8
9
10
|
# File 'app/models/service.rb', line 8
def info
@info
end
|
#provider ⇒ Object
Returns the value of attribute provider.
8
9
10
|
# File 'app/models/service.rb', line 8
def provider
@provider
end
|
Class Method Details
.auth ⇒ Object
37
38
39
|
# File 'app/models/service.rb', line 37
def auth
@@auth
end
|
.first_from_omniauth(auth_hash) ⇒ Object
27
28
29
30
|
# File 'app/models/service.rb', line 27
def first_from_omniauth( auth_hash )
@@auth = auth_hash
find_by(type: service_type, uid: options[:uid])
end
|
.initialize_from_omniauth(auth_hash) ⇒ Object
32
33
34
35
|
# File 'app/models/service.rb', line 32
def initialize_from_omniauth( auth_hash )
@@auth = auth_hash
service_type.constantize.new( options )
end
|
.options ⇒ Object
45
46
47
48
49
50
51
52
53
54
|
# File 'app/models/service.rb', line 45
def options
{
nickname: auth['info']['nickname'],
access_token: auth['credentials']['token'],
access_secret: auth['credentials']['secret'],
uid: auth['uid'],
provider: auth['provider'],
info: auth['info']
}
end
|
.service_type ⇒ Object
41
42
43
|
# File 'app/models/service.rb', line 41
def service_type
"Services::#{options[:provider].camelize}"
end
|
.titles(service_strings) ⇒ Object
23
24
25
|
# File 'app/models/service.rb', line 23
def titles(service_strings)
service_strings.map {|s| "Services::#{s.titleize}"}
end
|
Instance Method Details
#post_opts(post) ⇒ Object
17
18
19
|
# File 'app/models/service.rb', line 17
def post_opts(post)
end
|
#profile_photo_url ⇒ Object
13
14
15
|
# File 'app/models/service.rb', line 13
def profile_photo_url
nil
end
|