Sha256: 31ef23365715badd2c0a1a6cd0f98a015848852f9784a72cede176765ef7c6c2

Contents?: true

Size: 768 Bytes

Versions: 6

Compression:

Stored size: 768 Bytes

Contents

# frozen_string_literal: true
class Zendesk2::UpdateHelpCenterAccessPolicy
  include Zendesk2::Request

  request_method :put
  request_body { |r| { 'access_policy' => r.access_policy_params } }
  request_path do |r|
    "/help_center/sections/#{r.section_id}/access_policy.json"
  end

  def self.accepted_attributes
    %w(viewable_by managable_by restricted_to_group_ids restricted_to_organization_ids required_tags)
  end

  def access_policy_params
    Cistern::Hash.slice(params.fetch('access_policy'), *Zendesk2::UpdateHelpCenterAccessPolicy.accepted_attributes)
  end

  def section_id
    params.fetch('section_id')
  end

  def mock
    mock_response('access_policy' => find!(:help_center_access_policies, section_id).merge!(access_policy_params))
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zendesk2-1.15.0 lib/zendesk2/help_center/update_help_center_access_policy.rb
zendesk2-1.13.1 lib/zendesk2/help_center/update_help_center_access_policy.rb
zendesk2-1.13.0 lib/zendesk2/help_center/update_help_center_access_policy.rb
zendesk2-1.12.0 lib/zendesk2/help_center/update_help_center_access_policy.rb
zendesk2-1.11.0 lib/zendesk2/help_center/update_help_center_access_policy.rb
zendesk2-1.10.0 lib/zendesk2/help_center/update_help_center_access_policy.rb