class ChefCLI::Policyfile::ComparisonBase::PolicyGroup

def initialize(group, policy_name, http_client)

def initialize(group, policy_name, http_client)
  @group = group
  @policy_name = policy_name
  @http_client = http_client
end

def lock

def lock
  http_client.get("policy_groups/#{group}/policies/#{policy_name}")
rescue Net::ProtocolError => e
  if e.respond_to?(:response) && e.response.code.to_s == "404"
    raise PolicyfileDownloadError.new("No Policyfile lock named '#{policy_name}' found in policy_group '#{group}' at #{http_client.url}", e)
  else
    raise PolicyfileDownloadError.new("HTTP error attempting to fetch Policyfile lock from #{http_client.url}", e)
  end
rescue => e
  raise PolicyfileDownloadError.new("Failed to fetch Policyfile lock from #{http_client.url}", e)
end

def name

def name
  "policy_group:#{group}"
end