module BWAPI::Client::Projects::Rules

Rules module for projects/rules endpoints

Public Instance Methods

create_rule(project_id, opts = {}) click to toggle source

Create a new rule in project

@param project_id [Integer] The project id @param opts [Hash] options Hash of parameters @option opts [String] id The rule id @option opts [String] name The name of the rule @option opts [Hash] filter Filter object @option opts [String] scope The scope of the rule @option opts [Boolean] enabled If the rule is paused @option opts [Hash] rule Rule object @option opts [String] queryName The query name the rule is applied to @option opts [String] projectName The project name the rule is applied to @return [Hash] New rule

# File lib/bwapi/client/projects/rules.rb, line 44
def create_rule(project_id, opts = {})
  post "projects/#{project_id}/rules", opts
end
delete_rule(project_id, rule_id) click to toggle source

Delete an existing rule project

@param project_id [Integer] Id The project id @param rule_id [Integer] Id The rule id @return [Hash] Deleted rule

# File lib/bwapi/client/projects/rules.rb, line 70
def delete_rule(project_id, rule_id)
  delete "projects/#{project_id}/rules/#{rule_id}"
end
get_rule(project_id, rule_id) click to toggle source

Get a specific rule in project

@param project_id [Integer] id The id of project @param rule_id [Integer] id The id of rule @return [Hash] Specific rule

# File lib/bwapi/client/projects/rules.rb, line 27
def get_rule(project_id, rule_id)
  get "projects/#{project_id}/rules/#{rule_id}"
end
rules(project_id, opts = {}) click to toggle source

Get all rules in project

@param project_id [Integer] The id of project @param opts [Hash] options Hash of parameters @option opts [String] nameContains Partial name to filter by @option opts [Boolean] getPaused Includes the paused rules if true @option opts [Integer] page Page Number of results to retrieve @option opts [Integer] pageSize Results per page of results @return [Hash] All rules in project

# File lib/bwapi/client/projects/rules.rb, line 18
def rules(project_id, opts = {})
  get "projects/#{project_id}/rules", opts
end
update_rule(project_id, rule_id, opts = {}) click to toggle source

Update an existing rule in project

@param project_id [Integer] The project id @param opts [Hash] options Hash of parameters @option opts [String] id The rule id @option opts [String] name The name of the rule @option opts [Hash] filter Filter object @option opts [String] scope The scope of the rule @option opts [Boolean] enabled If the rule is paused @option opts [Hash] rule Rule object @option opts [String] queryName The query name the rule is applied to @option opts [String] projectName The project name the rule is applied to @return [Hash] Updated rule

# File lib/bwapi/client/projects/rules.rb, line 61
def update_rule(project_id, rule_id, opts = {})
  put "projects/#{project_id}/rules/#{rule_id}", opts
end