Class: Danger::DangerFavro

Inherits:
Plugin
  • Object
show all
Defined in:
lib/favro/plugin.rb

Overview

This is a danger plugin that detects Favro cards in added code and pr titles

Examples:

Initiate the check


favro.check(
  user_name: "api-user",
  api_token: "api-token",
  organization_id: "org-id",
  key: "Test"
)

Environment variables can also be used.


ENV["DANGER_FAVRO_USER_NAME"] = "api-user"
ENV["DANGER_FAVRO_API_TOKEN"] = "api-token"
ENV["DANGER_FAVRO_ORGANIZATION_ID"] = "org-id"

favro.check(key: "Test")

See Also:

  • /danger-favro

Instance Method Summary collapse

Instance Method Details

#check(user_name: nil, api_token: nil, organization_id: nil, key: nil) ⇒ void

This method returns an undefined value.

Check for cards.

Parameters:

  • user_name (String) (defaults to: nil)
  • api_token (String) (defaults to: nil)
  • organization_id (String) (defaults to: nil)
  • key (String) (defaults to: nil)


32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/favro/plugin.rb', line 32

def check(user_name: nil, api_token: nil, organization_id: nil, key: nil)
  return unless setup(user_name, api_token, organization_id, key)

  ids = find_card_ids([title] + file_additions)

  return if ids.empty?

  client = ApiClient.new(@user_name, @api_token, @organization_id)
  cards = client.get(ids)

  render_table(cards)
end