Class: Abt::Providers::Asana::Configuration
- Inherits:
-
Object
- Object
- Abt::Providers::Asana::Configuration
- Defined in:
- lib/abt/providers/asana/configuration.rb
Instance Attribute Summary collapse
-
#cli ⇒ Object
Returns the value of attribute cli.
Instance Method Summary collapse
- #access_token ⇒ Object
- #clear_global(verbose: true) ⇒ Object
- #clear_local(verbose: true) ⇒ Object
- #finalized_section_gid ⇒ Object
-
#initialize(cli:) ⇒ Configuration
constructor
A new instance of Configuration.
- #local_available? ⇒ Boolean
- #path ⇒ Object
- #path=(new_path) ⇒ Object
- #wip_section_gid ⇒ Object
- #workspace_gid ⇒ Object
Constructor Details
#initialize(cli:) ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 |
# File 'lib/abt/providers/asana/configuration.rb', line 9 def initialize(cli:) @cli = cli end |
Instance Attribute Details
#cli ⇒ Object
Returns the value of attribute cli.
7 8 9 |
# File 'lib/abt/providers/asana/configuration.rb', line 7 def cli @cli end |
Instance Method Details
#access_token ⇒ Object
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/abt/providers/asana/configuration.rb', line 60 def access_token return git_global["accessToken"] unless git_global["accessToken"].nil? git_global["accessToken"] = cli.prompt.text([ "Please provide your personal access token for Asana.", "If you don't have one, create one here: https://app.asana.com/0/developer-console", "", "Enter access token" ].join("\n")) end |
#clear_global(verbose: true) ⇒ Object
56 57 58 |
# File 'lib/abt/providers/asana/configuration.rb', line 56 def clear_global(verbose: true) git_global.clear(output: verbose ? cli.err_output : nil) end |
#clear_local(verbose: true) ⇒ Object
52 53 54 |
# File 'lib/abt/providers/asana/configuration.rb', line 52 def clear_local(verbose: true) git.clear(output: verbose ? cli.err_output : nil) end |
#finalized_section_gid ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/abt/providers/asana/configuration.rb', line 44 def finalized_section_gid return nil unless local_available? @finalized_section_gid ||= git["finalizedSectionGid"] || directory_config["finalized_section_gid"] || prompt_finalized_section["gid"] end |
#local_available? ⇒ Boolean
13 14 15 |
# File 'lib/abt/providers/asana/configuration.rb', line 13 def local_available? git.available? end |
#path ⇒ Object
17 18 19 |
# File 'lib/abt/providers/asana/configuration.rb', line 17 def path Path.new((local_available? && git["path"]) || directory_config["path"] || "") end |
#path=(new_path) ⇒ Object
21 22 23 |
# File 'lib/abt/providers/asana/configuration.rb', line 21 def path=(new_path) git["path"] = new_path end |
#wip_section_gid ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/abt/providers/asana/configuration.rb', line 36 def wip_section_gid return nil unless local_available? @wip_section_gid ||= git["wipSectionGid"] || directory_config["wip_section_gid"] || prompt_wip_section["gid"] end |
#workspace_gid ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/abt/providers/asana/configuration.rb', line 25 def workspace_gid @workspace_gid ||= begin current = git_global["workspaceGid"] if current.nil? prompt_workspace_gid else current end end end |