File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
lib/travis/api/v3/queries Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -48,18 +48,24 @@ def schedule(repository, user)
48
48
credentials : { token : token } ,
49
49
payload : JSON . dump ( payload )
50
50
)
51
- payload
51
+ compact ( payload )
52
52
end
53
53
54
54
private
55
55
56
56
def request_configs
57
57
configs = self . configs
58
- configs . each { |config | config [ 'config' ] = to_str ( config [ 'config' ] ) } if configs
59
- configs ||= [ { config : to_str ( config ) , merge_mode : merge_mode } ] if config
58
+ configs = configs . map { |config | normalize_config ( config ) } if configs
59
+ configs ||= [ { config : to_str ( config ) , mode : merge_mode } ] if config
60
60
configs
61
61
end
62
62
63
+ def normalize_config ( config )
64
+ config [ 'config' ] = to_str ( config [ 'config' ] )
65
+ config [ 'mode' ] = config . delete ( 'merge_mode' ) if config [ 'merge_mode' ]
66
+ config
67
+ end
68
+
63
69
def to_str ( config )
64
70
config . is_a? ( Hash ) ? JSON . dump ( config ) : config
65
71
end
@@ -73,5 +79,9 @@ def create_request(repository)
73
79
private : repository . private
74
80
)
75
81
end
82
+
83
+ def compact ( hash )
84
+ hash . reject { |_ , value | value . nil? } . to_h
85
+ end
76
86
end
77
87
end
You can’t perform that action at this time.
0 commit comments