Module: Josef::GoogleWorkspace::Config

Included in:
Client, Group
Defined in:
lib/josef/google_workspace/config.rb

Instance Method Summary collapse

Instance Method Details

#actorObject



13
14
15
# File 'lib/josef/google_workspace/config.rb', line 13

def actor
  @_actor ||= actor!
end

#actor!Object



17
18
19
20
21
22
23
24
# File 'lib/josef/google_workspace/config.rb', line 17

def actor!
  if ENV["GOOGLE_WORKSPACE_ACTOR"].nil?
    print("input actor primary mail address:")
    return $stdin.gets.chomp!("\n")
  end

  ENV["GOOGLE_WORKSPACE_ACTOR"]
end

#credential_pathObject



5
6
7
# File 'lib/josef/google_workspace/config.rb', line 5

def credential_path
  ENV["GOOGLE_WORKSPACE_CREDENTIAL_PATH"]
end

#domains(domains_file_path: nil) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/josef/google_workspace/config.rb', line 26

def domains(domains_file_path: nil)
  path = domains_file_path || ENV["DOMAINS_FILE_PATH"]
  if path.nil?
    print "input your domains file path:"
    path = $stdin.gets.chomp!("\n")
  end
  YAML.load_file(path)["domains"]
end

#token_path(path) ⇒ Object



9
10
11
# File 'lib/josef/google_workspace/config.rb', line 9

def token_path(path)
  @_token_path ||= ENV["GOOGLE_WORKSPACE_TOKEN_PATH"] || path
end