Skip to content

Commit

Permalink
Merge pull request #61 from adnanh/development
Browse files Browse the repository at this point in the history
- added omitempty to json fields
  • Loading branch information
adnanh committed Dec 27, 2015
2 parents 8de1a51 + f59f0a5 commit 5594a62
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
40 changes: 20 additions & 20 deletions hook/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ func ExtractParameterAsString(s string, params interface{}) (string, bool) {
// Argument type specifies the parameter key name and the source it should
// be extracted from
type Argument struct {
Source string `json:"source"`
Name string `json:"name"`
Source string `json:"source,omitempty"`
Name string `json:"name,omitempty"`
}

// Get Argument method returns the value for the Argument's key name
Expand Down Expand Up @@ -248,15 +248,15 @@ func (ha *Argument) Get(headers, query, payload *map[string]interface{}) (string

// Hook type is a structure containing details for a single hook
type Hook struct {
ID string `json:"id"`
ExecuteCommand string `json:"execute-command"`
CommandWorkingDirectory string `json:"command-working-directory"`
ResponseMessage string `json:"response-message"`
CaptureCommandOutput bool `json:"include-command-output-in-response"`
PassEnvironmentToCommand []Argument `json:"pass-environment-to-command"`
PassArgumentsToCommand []Argument `json:"pass-arguments-to-command"`
JSONStringParameters []Argument `json:"parse-parameters-as-json"`
TriggerRule *Rules `json:"trigger-rule"`
ID string `json:"id,omitempty"`
ExecuteCommand string `json:"execute-command,omitempty"`
CommandWorkingDirectory string `json:"command-working-directory,omitempty"`
ResponseMessage string `json:"response-message,omitempty"`
CaptureCommandOutput bool `json:"include-command-output-in-response,omitempty"`
PassEnvironmentToCommand []Argument `json:"pass-environment-to-command,omitempty"`
PassArgumentsToCommand []Argument `json:"pass-arguments-to-command,omitempty"`
JSONStringParameters []Argument `json:"parse-parameters-as-json,omitempty"`
TriggerRule *Rules `json:"trigger-rule,omitempty"`
}

// ParseJSONParameters decodes specified arguments to JSON objects and replaces the
Expand Down Expand Up @@ -386,10 +386,10 @@ func (h *Hooks) MatchAll(id string) []*Hook {

// Rules is a structure that contains one of the valid rule types
type Rules struct {
And *AndRule `json:"and"`
Or *OrRule `json:"or"`
Not *NotRule `json:"not"`
Match *MatchRule `json:"match"`
And *AndRule `json:"and,omitempty"`
Or *OrRule `json:"or,omitempty"`
Not *NotRule `json:"not,omitempty"`
Match *MatchRule `json:"match,omitempty"`
}

// Evaluate finds the first rule property that is not nil and returns the value
Expand Down Expand Up @@ -464,11 +464,11 @@ func (r NotRule) Evaluate(headers, query, payload *map[string]interface{}, body

// MatchRule will evaluate to true based on the type
type MatchRule struct {
Type string `json:"type"`
Regex string `json:"regex"`
Secret string `json:"secret"`
Value string `json:"value"`
Parameter Argument `json:"parameter"`
Type string `json:"type,omitempty"`
Regex string `json:"regex,omitempty"`
Secret string `json:"secret,omitempty"`
Value string `json:"value,omitempty"`
Parameter Argument `json:"parameter,omitempty"`
}

// Constants for the MatchRule type
Expand Down
2 changes: 1 addition & 1 deletion webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

const (
version = "2.3.6"
version = "2.3.7"
)

var (
Expand Down

0 comments on commit 5594a62

Please sign in to comment.