class Reposync::GetSyncBranchesService < Reposync::ClientService

  attr_accessor :repo_name, :page, :limit, :create_sort 

  def initialize(repo_name, page=1, limit=10, create_sort=false)
    @repo_name = repo_name
    @page = page
    @limit = limit 
    @create_sort = create_sort
  end

  def call 
    result = get(url, request_params)
    response = render_response(result)
  end

  private 
  def request_params 
    {
      page: page,
      limit: limit,
      create_sort: create_sort
    }.stringify_keys
  end

  def url 
    "/cerobot/sync/#{repo_name}/branch".freeze
  end

end