Class: Google::ServiceAccount
- Inherits:
-
Object
- Object
- Google::ServiceAccount
- Defined in:
- lib/google/service_account.rb
Constant Summary collapse
- CLIENT_ID_SUFFIX =
".apps.googleusercontent.com"- CLIENT_EMAIL_DOMAIN =
"developer.gserviceaccount.com"- ACCOUNTS_GOOGLE_COM_BASE_URI =
"https://accounts.google.com"- WWW_GOOGLEAPIS_COM_BASE_URI =
"https://www.googleapis.com"
Instance Attribute Summary collapse
-
#auth_provider_x509_cert_url ⇒ Object
readonly
Returns the value of attribute auth_provider_x509_cert_url.
-
#auth_uri ⇒ Object
readonly
Returns the value of attribute auth_uri.
-
#client_email ⇒ Object
readonly
Returns the value of attribute client_email.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_x509_cert_url ⇒ Object
readonly
Returns the value of attribute client_x509_cert_url.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#token_uri ⇒ Object
readonly
Returns the value of attribute token_uri.
Instance Method Summary collapse
-
#initialize(client_id) ⇒ ServiceAccount
constructor
A new instance of ServiceAccount.
Constructor Details
#initialize(client_id) ⇒ ServiceAccount
Returns a new instance of ServiceAccount.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/google/service_account.rb', line 14 def initialize(client_id) @id = client_id.include?(CLIENT_ID_SUFFIX) ? scan_id(client_id) : client_id @auth_uri = ACCOUNTS_GOOGLE_COM_BASE_URI + "/o/oauth2/auth" @token_uri = ACCOUNTS_GOOGLE_COM_BASE_URI + "/o/oauth2/token" @client_id = @id + CLIENT_ID_SUFFIX @client_email = @id + "@" + CLIENT_EMAIL_DOMAIN @auth_provider_x509_cert_url = WWW_GOOGLEAPIS_COM_BASE_URI + "/oauth2/v1/certs" @client_x509_cert_url = WWW_GOOGLEAPIS_COM_BASE_URI + "/robot/v1/metadata/x509" + @client_email @scope = WWW_GOOGLEAPIS_COM_BASE_URI + "/auth/calendar" end |
Instance Attribute Details
#auth_provider_x509_cert_url ⇒ Object (readonly)
Returns the value of attribute auth_provider_x509_cert_url.
11 12 13 |
# File 'lib/google/service_account.rb', line 11 def auth_provider_x509_cert_url @auth_provider_x509_cert_url end |
#auth_uri ⇒ Object (readonly)
Returns the value of attribute auth_uri.
9 10 11 |
# File 'lib/google/service_account.rb', line 9 def auth_uri @auth_uri end |
#client_email ⇒ Object (readonly)
Returns the value of attribute client_email.
10 11 12 |
# File 'lib/google/service_account.rb', line 10 def client_email @client_email end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
10 11 12 |
# File 'lib/google/service_account.rb', line 10 def client_id @client_id end |
#client_x509_cert_url ⇒ Object (readonly)
Returns the value of attribute client_x509_cert_url.
11 12 13 |
# File 'lib/google/service_account.rb', line 11 def client_x509_cert_url @client_x509_cert_url end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/google/service_account.rb', line 8 def id @id end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
12 13 14 |
# File 'lib/google/service_account.rb', line 12 def scope @scope end |
#token_uri ⇒ Object (readonly)
Returns the value of attribute token_uri.
9 10 11 |
# File 'lib/google/service_account.rb', line 9 def token_uri @token_uri end |