Class: Google::ServiceAccount

Inherits:
Object
  • Object
show all
Defined in:
lib/google/service_account.rb

Constant Summary collapse

SCOPE =
'https://www.googleapis.com/auth/calendar'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(secret_path, email) ⇒ ServiceAccount

Returns a new instance of ServiceAccount.



11
12
13
14
15
16
17
18
19
20
# File 'lib/google/service_account.rb', line 11

def initialize(secret_path, email)
  JSON.parse(File.read(secret_path)).each do |key, secret|
    secret.each do |k, v|
      instance_varialbe_name = "@#{k}".to_sym
      instance_variable_set(instance_varialbe_name, v)
    end
  end
  @client_email ||= email
  @scope = SCOPE
end

Instance Attribute Details

#auth_provider_x509_cert_urlObject (readonly)

Returns the value of attribute auth_provider_x509_cert_url.



7
8
9
# File 'lib/google/service_account.rb', line 7

def auth_provider_x509_cert_url
  @auth_provider_x509_cert_url
end

#auth_uriObject (readonly)

Returns the value of attribute auth_uri.



5
6
7
# File 'lib/google/service_account.rb', line 5

def auth_uri
  @auth_uri
end

#client_emailObject (readonly)

Returns the value of attribute client_email.



6
7
8
# File 'lib/google/service_account.rb', line 6

def client_email
  @client_email
end

#client_idObject (readonly)

Returns the value of attribute client_id.



6
7
8
# File 'lib/google/service_account.rb', line 6

def client_id
  @client_id
end

#client_x509_cert_urlObject (readonly)

Returns the value of attribute client_x509_cert_url.



7
8
9
# File 'lib/google/service_account.rb', line 7

def client_x509_cert_url
  @client_x509_cert_url
end

#project_idObject (readonly)

Returns the value of attribute project_id.



8
9
10
# File 'lib/google/service_account.rb', line 8

def project_id
  @project_id
end

#scopeObject (readonly)

Returns the value of attribute scope.



9
10
11
# File 'lib/google/service_account.rb', line 9

def scope
  @scope
end

#token_uriObject (readonly)

Returns the value of attribute token_uri.



5
6
7
# File 'lib/google/service_account.rb', line 5

def token_uri
  @token_uri
end