class Gosns::Googleplus

Attributes

key[RW]
redirect_uri[RW]
secret[RW]

Public Class Methods

oauth_authorize_url(options={}) click to toggle source
# File lib/provider/googleplus.rb, line 5
def oauth_authorize_url(options={})
  oauth_client.auth_code.authorize_url(
    redirect_uri: redirect_uri,
    state: options[:state],
    access_type: 'offline',
    approval_prompt: 'force',
    scope: 'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/plus.login'
  )
end
oauth_client() click to toggle source
# File lib/provider/googleplus.rb, line 14
def oauth_client
  option = {
    site: 'https://accounts.google.com',
    authorize_url: "/o/oauth2/auth",
    token_url: "https://www.googleapis.com/oauth2/v3/token"
  }
  OAuth2::Client.new(key, secret, option)
end
token(code) click to toggle source
# File lib/provider/googleplus.rb, line 23
def token(code)
  oauth_client.auth_code.get_token(code, redirect_uri: redirect_uri)
end

Public Instance Methods

followers() click to toggle source
# File lib/provider/googleplus.rb, line 27
def followers
  Helper::parse_int Helper::at_css("https://plus.google.com/+#{account}", ".BOfSxb")
end