Sha256: 64f3acf441a0596c5cc3505720a9ee0f0685a55e5cb549eae2e69549eea7de16

Contents?: true

Size: 857 Bytes

Versions: 6

Compression:

Stored size: 857 Bytes

Contents

class Zendesk2::Client
  class Real
    def update_organization(params={})
      id = params.delete("id")

      request(
        :method => :put,
        :path   => "/organizations/#{id}.json",
        :body   => {
          "organization" => params
        },
      )
    end
  end
  class Mock
    def update_organization(params={})
      id = params.delete("id")

      organization = self.find!(:organizations, id)

      if self.data[:organizations].values.find { |o| o["name"] == params["name"] && o["id"] != id }
        error!(:invalid, details: {"name" => [ { "description" => "Name: has already been taken" } ]})
      end

      body = organization.merge!(params)

      response(
        :method => :put,
        :path   => "/organizations/#{id}.json",
        :body   => {
          "organization" => body
        },
      )
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
zendesk2-1.2.6 lib/zendesk2/client/requests/update_organization.rb
zendesk2-1.2.5 lib/zendesk2/client/requests/update_organization.rb
zendesk2-1.2.4 lib/zendesk2/client/requests/update_organization.rb
zendesk2-1.2.3 lib/zendesk2/client/requests/update_organization.rb
zendesk2-1.2.2 lib/zendesk2/client/requests/update_organization.rb
zendesk2-1.2.1 lib/zendesk2/client/requests/update_organization.rb