Sha256: 834282da562f82ca4ca6543dce87d4990248a1a1854a2dc9337a3b2c9d4f24dd

Contents?: true

Size: 1.29 KB

Versions: 26

Compression:

Stored size: 1.29 KB

Contents

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

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

      record = {
        "active"                => true,
        "collapsed_for_agents"  => false,
        "created_at"            => Time.now.iso8601,
        "description"           => params["title"],
        "editable_in_portal"    => false,
        "id"                    => identity,
        "position"              => 9999,
        "regexp_for_validation" => "",
        "removable"             => true,
        "required"              => false,
        "required_in_portal"    => false,
        "tag"                   => "",
        "title_in_portal"       => params["title"],
        "updated_at"            => Time.now.iso8601,
        "url"                   => url_for("/user_fields/#{identity}.json"),
        "visible_in_portal"     => false,
      }.merge(params)

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

      response(
        :method => :post,
        :body   => {"user_field" => record},
        :path   => "/user_fields.json"
      )
    end
  end # Mock
end # Zendesk2::Client

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
zendesk2-0.5.4 lib/zendesk2/client/requests/create_user_field.rb
zendesk2-0.5.3 lib/zendesk2/client/requests/create_user_field.rb
zendesk2-0.5.2 lib/zendesk2/client/requests/create_user_field.rb
zendesk2-0.5.1 lib/zendesk2/client/requests/create_user_field.rb
zendesk2-0.5.0 lib/zendesk2/client/requests/create_user_field.rb
zendesk2-0.4.5 lib/zendesk2/client/requests/create_user_field.rb