Skip to content

Commit 99a7563

Browse files
committed
debug
1 parent 1f88bc3 commit 99a7563

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lib/travis/api/v3/queries/request.rb

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,24 @@ def schedule(repository, user)
4848
credentials: { token: token },
4949
payload: JSON.dump(payload)
5050
)
51-
payload
51+
compact(payload)
5252
end
5353

5454
private
5555

5656
def request_configs
5757
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
6060
configs
6161
end
6262

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+
6369
def to_str(config)
6470
config.is_a?(Hash) ? JSON.dump(config) : config
6571
end
@@ -73,5 +79,9 @@ def create_request(repository)
7379
private: repository.private
7480
)
7581
end
82+
83+
def compact(hash)
84+
hash.reject { |_, value| value.nil? }.to_h
85+
end
7686
end
7787
end

0 commit comments

Comments
 (0)