Class: Gurney::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/gurney/api.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url:, token:) ⇒ Api

Returns a new instance of Api.



7
8
9
10
# File 'lib/gurney/api.rb', line 7

def initialize(base_url:, token:)
  @base_url = base_url
  @token = token
end

Instance Method Details

#post_dependencies(dependencies:, branch:, project_id:, repo_path: nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/gurney/api.rb', line 12

def post_dependencies(dependencies:, branch:, project_id:, repo_path: nil)
  data = { dependencies: dependencies }
  data[:repository_path] = repo_path if repo_path

  url = base_url
  url.gsub! '<project_id>', CGI.escape(project_id)
  url.gsub! '<branch>', CGI.escape(branch)

  post_json(url, data.to_json)
end