Class: Zendesk2::UserField

Inherits:
Object
  • Object
show all
Extended by:
Attributes
Includes:
Model
Defined in:
lib/zendesk2/user_field.rb

Instance Attribute Summary

Attributes included from Model

#errors

Instance Method Summary collapse

Methods included from Attributes

assoc_accessor, assoc_reader, assoc_writer

Methods included from Model

#destroy, #destroyed?, #missing_attributes, #save, #update!

Instance Method Details

#activeBoolean

Returns If true, this field is available for use.

Returns:

  • (Boolean)

    If true, this field is available for use



11
# File 'lib/zendesk2/user_field.rb', line 11

attribute :active, type: :boolean

#created_atTime

Returns The time the ticket field was created.

Returns:

  • (Time)

    The time the ticket field was created



13
# File 'lib/zendesk2/user_field.rb', line 13

attribute :created_at, type: :time

#custom_field_optionsArray

Returns Required and presented for a custom field of type “tagger”.

Returns:

  • (Array)

    Required and presented for a custom field of type “tagger”



15
# File 'lib/zendesk2/user_field.rb', line 15

attribute :custom_field_options, type: :array

#descriptionString

Returns User-defined description of this field’s purpose.

Returns:

  • (String)

    User-defined description of this field’s purpose



17
# File 'lib/zendesk2/user_field.rb', line 17

attribute :description, type: :string

#destroy!Object



51
52
53
54
55
# File 'lib/zendesk2/user_field.rb', line 51

def destroy!
  requires :identity

  cistern.destroy_user_field('user_field' => { 'id' => identity })
end

#idInteger

Returns Automatically assigned upon creation.

Returns:

  • (Integer)

    Automatically assigned upon creation



8
# File 'lib/zendesk2/user_field.rb', line 8

identity :id, type: :integer

#keyString

This is used for updating the field and referencing in placeholders.

Returns:

  • (String)

    create a unique key that identifies this custom field.



20
# File 'lib/zendesk2/user_field.rb', line 20

attribute :key, type: :string

#positionInteger

Returns Ordering of the field relative to other fields.

Returns:

  • (Integer)

    Ordering of the field relative to other fields



22
# File 'lib/zendesk2/user_field.rb', line 22

attribute :position, type: :integer

#regexp_for_validationString

Returns Regular expression field only. The validation pattern for a field value to be deemed valid.

Returns:

  • (String)

    Regular expression field only. The validation pattern for a field value to be deemed valid.



24
# File 'lib/zendesk2/user_field.rb', line 24

attribute :regexp_for_validation, type: :string

#save!Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/zendesk2/user_field.rb', line 37

def save!
  response = if new_record?
               requires :type, :title, :key

               cistern.create_user_field('user_field' => attributes)
             else
               requires :identity

               cistern.update_user_field('user_field' => attributes)
             end

  merge_attributes(response.body['user_field'])
end

#tagString

Returns Optional for custom field of type “checkbox”; not presented otherwise.

Returns:

  • (String)

    Optional for custom field of type “checkbox”; not presented otherwise.



26
# File 'lib/zendesk2/user_field.rb', line 26

attribute :tag, type: :string

#titleString

Returns The title of the custom field.

Returns:

  • (String)

    The title of the custom field



28
# File 'lib/zendesk2/user_field.rb', line 28

attribute :title, type: :string

#typeString

(custom dropdown)

Returns:

  • (String)

    Supported types: “text”, “textarea”, “checkbox”, “date”, “integer”, “decimal”, “regexp”, “tagger”



31
# File 'lib/zendesk2/user_field.rb', line 31

attribute :type, type: :string

#updated_atTime

Returns The time of the last update of the ticket field.

Returns:

  • (Time)

    The time of the last update of the ticket field



33
# File 'lib/zendesk2/user_field.rb', line 33

attribute :updated_at, type: :time

#urlString

Returns The URL for this resource.

Returns:

  • (String)

    The URL for this resource



35
# File 'lib/zendesk2/user_field.rb', line 35

attribute :url, type: :string