Module: FlightPlanCli::Config
- Included in:
- FlightPlanCli::Commands::Ls, Initializer
- Defined in:
- lib/flight_plan_cli/config.rb
Constant Summary collapse
- YAML_FILE =
'.flight_plan_cli.yml'.freeze
Instance Attribute Summary collapse
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
readonly
Returns the value of attribute api_secret.
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#board_id ⇒ Object
readonly
Returns the value of attribute board_id.
-
#default_swimlane_ids ⇒ Object
readonly
Returns the value of attribute default_swimlane_ids.
-
#repo_id ⇒ Object
readonly
Returns the value of attribute repo_id.
Instance Method Summary collapse
Instance Attribute Details
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/flight_plan_cli/config.rb', line 6 def api_key @api_key end |
#api_secret ⇒ Object (readonly)
Returns the value of attribute api_secret.
6 7 8 |
# File 'lib/flight_plan_cli/config.rb', line 6 def api_secret @api_secret end |
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
6 7 8 |
# File 'lib/flight_plan_cli/config.rb', line 6 def api_url @api_url end |
#board_id ⇒ Object (readonly)
Returns the value of attribute board_id.
5 6 7 |
# File 'lib/flight_plan_cli/config.rb', line 5 def board_id @board_id end |
#default_swimlane_ids ⇒ Object (readonly)
Returns the value of attribute default_swimlane_ids.
5 6 7 |
# File 'lib/flight_plan_cli/config.rb', line 5 def default_swimlane_ids @default_swimlane_ids end |
#repo_id ⇒ Object (readonly)
Returns the value of attribute repo_id.
5 6 7 |
# File 'lib/flight_plan_cli/config.rb', line 5 def repo_id @repo_id end |
Instance Method Details
#client ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/flight_plan_cli/config.rb', line 18 def client @client ||= FlightPlanCli::Api.new( url: api_url, key: api_key, secret: api_secret ) end |
#config ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/flight_plan_cli/config.rb', line 26 def config @config ||= begin unless File.exist?(YAML_FILE) puts "Could not file #{YAML_FILE} file." exit 1 end YAML.load_file(YAML_FILE) end end |
#read_config ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/flight_plan_cli/config.rb', line 8 def read_config @board_id = config['board_id'] @repo_id = config['repo_id'] @default_swimlane_ids = config['ls']['default_swimlane_ids'] @api_url = config['api_url'] @api_key = ENV['FLIGHT_PLAN_API_KEY'] @api_secret = ENV['FLIGHT_PLAN_API_SECRET'] end |