33module Github
44 # The Branch Protections API
55 class Client ::Repos ::Branches ::Protections < API
6-
76 VALID_PROTECTION_PARAM_NAMES = %w[
87 required_status_checks
98 enforce_admins
@@ -20,7 +19,7 @@ class Client::Repos::Branches::Protections < API
2019 def get ( *args )
2120 arguments ( args , required : [ :user , :repo , :branch ] )
2221
23- get_request ( "/repos/#{ arguments . user } /#{ arguments . repo } /branches/#{ arguments . branch } /protection" , arguments . params )
22+ get_request ( "/repos/#{ arguments . user } /#{ arguments . repo } /branches/#{ arguments . branch } /protection" , arguments . params . reverse_merge ( { accept : 'application/vnd.github.loki-preview+json' } ) )
2423 end
2524 alias :find :get
2625
@@ -47,7 +46,7 @@ def edit(*args)
4746 permit VALID_PROTECTION_PARAM_NAMES
4847 end
4948
50- patch_request ( "/repos/#{ arguments . user } /#{ arguments . repo } /branches/#{ arguments . branch } /protection" , arguments . params )
49+ put_request ( "/repos/#{ arguments . user } /#{ arguments . repo } /branches/#{ arguments . branch } /protection" , arguments . params . reverse_merge ( { accept : 'application/vnd.github.loki-preview+json' } ) )
5150 end
5251 alias :update :edit
5352
@@ -61,7 +60,7 @@ def edit(*args)
6160 def delete ( *args )
6261 arguments ( args , required : [ :user , :repo , :branch ] )
6362
64- delete_request ( "/repos/#{ arguments . user } /#{ arguments . repo } /branches/#{ arguments . branch } /protection" , arguments . params )
63+ delete_request ( "/repos/#{ arguments . user } /#{ arguments . repo } /branches/#{ arguments . branch } /protection" , arguments . params . reverse_merge ( { accept : 'application/vnd.github.loki-preview+json' } ) )
6564 end
6665 end # Client::Repos::Branches::Protections
6766end # Github
0 commit comments