Module: GoogleSdk::OAuth::ClassMethods
- Defined in:
- lib/google_sdk/oauth.rb
Instance Method Summary collapse
- #access_type(value) ⇒ Object
- #approval_prompt(value) ⇒ Object
- #client_id(value) ⇒ Object
- #client_secret(value) ⇒ Object
- #default_options ⇒ Object
- #login_url ⇒ Object
- #redirect_uri(value) ⇒ Object
- #scope(value) ⇒ Object
- #user_token(code) ⇒ Object
Instance Method Details
#access_type(value) ⇒ Object
35 36 37 |
# File 'lib/google_sdk/oauth.rb', line 35 def access_type(value) [:params][:access_type] = value end |
#approval_prompt(value) ⇒ Object
39 40 41 |
# File 'lib/google_sdk/oauth.rb', line 39 def approval_prompt(value) [:params][:approval_prompt] = value end |
#client_id(value) ⇒ Object
23 24 25 |
# File 'lib/google_sdk/oauth.rb', line 23 def client_id(value) [:params][:client_id] = value end |
#client_secret(value) ⇒ Object
27 28 29 |
# File 'lib/google_sdk/oauth.rb', line 27 def client_secret(value) [:params][:client_secret] = value end |
#default_options ⇒ Object
19 20 21 |
# File 'lib/google_sdk/oauth.rb', line 19 def @default_options end |
#login_url ⇒ Object
47 48 49 50 51 |
# File 'lib/google_sdk/oauth.rb', line 47 def login_url params = [] [:params].each {|key, value| params << "#{key}=#{value}"} return "#{[:google_uri]}/o/oauth2/auth?#{params.join("&")}" end |
#redirect_uri(value) ⇒ Object
43 44 45 |
# File 'lib/google_sdk/oauth.rb', line 43 def redirect_uri(value) [:params][:redirect_uri] = value end |
#scope(value) ⇒ Object
31 32 33 |
# File 'lib/google_sdk/oauth.rb', line 31 def scope(value) [:params][:scope] = value.join('+') end |
#user_token(code) ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/google_sdk/oauth.rb', line 53 def user_token(code) RestClient.post "#{[:google_uri]}/o/oauth2/token", { code: code, client_id: [:params][:client_id], client_secret: [:params][:client_secret], redirect_uri: [:params][:redirect_uri], grant_type: 'authorization_code' } end |