Sha256: 18771a93bb5932b316e7a64d761f3be237db30a4bf1d1c0fe96f3c4bf5df5ad5

Contents?: true

Size: 501 Bytes

Versions: 6

Compression:

Stored size: 501 Bytes

Contents

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

  request_method :put
  request_path { |r| "/forums/#{r.forum_id}.json" }
  request_body { |r| { 'forum' => r.forum_params } }

  def forum_params
    Cistern::Hash.slice(params.fetch('forum'), *Zendesk2::CreateForum.accepted_attributes)
  end

  def forum_id
    params.fetch('forum').fetch('id')
  end

  def mock
    mock_response(
      'forum' => find!(:forums, forum_id).merge!(forum_params)
    )
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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