Class: Singly::Auth::Service
- Inherits:
-
Object
- Object
- Singly::Auth::Service
- 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
-
#is_oauth1 ⇒ Object
readonly
Returns the value of attribute is_oauth1.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #apply(params = {}) ⇒ Object
-
#initialize(service, is_oauth1 = false) ⇒ Service
constructor
A new instance of Service.
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_oauth1 ⇒ Object (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 |
#service ⇒ Object (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 |