Sha256: 8b8cd8d3cbfa393ae2630f1776aad2ede000ee8b3731a0cc363c4d590119f741

Contents?: true

Size: 729 Bytes

Versions: 8

Compression:

Stored size: 729 Bytes

Contents

class Zendesk2::Client
  class Real
    def create_user(params={})
      request(
        :body   => {"user" => params},
        :method => :post,
        :path   => "/users.json",
      )
    end
  end # Real

  class Mock
    def create_user(params={})
      identity = self.class.new_id

      record = {
        "id"         => identity,
        "url"        => url_for("/users/#{identity}.json"),
        "created_at" => Time.now.iso8601,
        "updated_at" => Time.now.iso8601,
        "active"     => true,
      }.merge(params)

      self.data[:users][identity]= record

      response(
        :method => :post,
        :body   => {"user" => record},
        :path   => "/users.json"
      )
    end
  end # Mock
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
zendesk2-0.0.13 lib/zendesk2/client/requests/create_user.rb
zendesk2-0.0.12 lib/zendesk2/client/requests/create_user.rb
zendesk2-0.0.11 lib/zendesk2/client/requests/create_user.rb
zendesk2-0.0.10 lib/zendesk2/client/requests/create_user.rb
zendesk2-0.0.9 lib/zendesk2/client/requests/create_user.rb
zendesk2-0.0.8 lib/zendesk2/client/requests/create_user.rb
zendesk2-0.0.7 lib/zendesk2/client/requests/create_user.rb
zendesk2-0.0.6 lib/zendesk2/client/requests/create_user.rb