Class: Singly::Auth::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/singly/api/auth/service.rb,
lib/singly/api/auth/service/oauth1_apply.rb,
lib/singly/api/auth/service/oauth2_apply.rb

Defined Under Namespace

Classes: Oauth1Apply, Oauth2Apply

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, is_oauth1 = false) ⇒ Service

Returns a new instance of Service.



7
8
9
10
# File 'lib/singly/api/auth/service.rb', line 7

def initialize(service, is_oauth1=false)
  @service = service
  @is_oauth1 = is_oauth1
end

Instance Attribute Details

#is_oauth1Object (readonly)

Returns the value of attribute is_oauth1.



5
6
7
# File 'lib/singly/api/auth/service.rb', line 5

def is_oauth1
  @is_oauth1
end

#serviceObject (readonly)

Returns the value of attribute service.



4
5
6
# File 'lib/singly/api/auth/service.rb', line 4

def service
  @service
end

Instance Method Details

#apply(params = {}) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/singly/api/auth/service.rb', line 12

def apply(params={})
  params ||= {}
  apply_type = is_oauth1 ? Singly::Auth::Service::Oauth1Apply : Singly::Auth::Service::Oauth2Apply
  apply_type.new(params.merge({
    service: service.to_s,
    client_id: Singly.client_id, 
    client_secret: Singly.client_secret
  }))
end