Class: Zendesk2::HelpCenter::Translation

Inherits:
Object
  • Object
show all
Extended by:
Attributes
Includes:
Zendesk2::HelpCenter::TranslationSource::Model, Model
Defined in:
lib/zendesk2/help_center/translation.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 Zendesk2::HelpCenter::TranslationSource::Model

#source=

Methods included from Model

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

Instance Method Details

#bodyString

Returns The body of the translation. Empty by default.

Returns:

  • (String)

    The body of the translation. Empty by default



24
# File 'lib/zendesk2/help_center/translation.rb', line 24

attribute :body, type: :string

#destroy!Object



30
31
32
33
34
35
36
# File 'lib/zendesk2/help_center/translation.rb', line 30

def destroy!
  requires :locale, :source_id, :source_type

  cistern.destroy_help_center_translation(
    'translation' => Cistern::Hash.slice(attributes, :source_id, :source_type, :locale)
  )
end

#draftBoolean

Returns True if the translation is a draft; false otherwise. False by default.

Returns:

  • (Boolean)

    True if the translation is a draft; false otherwise. False by default



28
# File 'lib/zendesk2/help_center/translation.rb', line 28

attribute :draft, type: :boolean

#html_urlString

Returns The url of the translation in Help Center.

Returns:

  • (String)

    The url of the translation in Help Center



14
# File 'lib/zendesk2/help_center/translation.rb', line 14

attribute :html_url, type: :string

#idInteger

Returns Automatically assigned when the translation is created.

Returns:

  • (Integer)

    Automatically assigned when the translation is created



9
# File 'lib/zendesk2/help_center/translation.rb', line 9

identity :id, type: :integer

#localeString

Returns The locale of the translation.

Returns:

  • (String)

    The locale of the translation



20
# File 'lib/zendesk2/help_center/translation.rb', line 20

attribute :locale, type: :string

#outdatedBoolean

Returns True if the translation is outdated; false otherwise. False by default.

Returns:

  • (Boolean)

    True if the translation is outdated; false otherwise. False by default



26
# File 'lib/zendesk2/help_center/translation.rb', line 26

attribute :outdated, type: :boolean

#save!Object



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

def save!
  response = if new_record?
               requires :locale, :source_id, :source_type

               cistern.create_help_center_translation('translation' => attributes)
             else
               requires :identity

               cistern.update_help_center_translation('translation' => attributes)
             end

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

#source_idInteger

Returns The id of the item that has this translation.

Returns:

  • (Integer)

    The id of the item that has this translation



16
# File 'lib/zendesk2/help_center/translation.rb', line 16

attribute :source_id, type: :integer

#source_typeString

Returns The type of the item that has this translation. Can be Article, Section, or Category.

Returns:

  • (String)

    The type of the item that has this translation. Can be Article, Section, or Category



18
# File 'lib/zendesk2/help_center/translation.rb', line 18

attribute :source_type, type: :string

#titleString

Returns The title of the translation.

Returns:

  • (String)

    The title of the translation



22
# File 'lib/zendesk2/help_center/translation.rb', line 22

attribute :title, type: :string

#urlString

Returns The API url of the translation.

Returns:

  • (String)

    The API url of the translation



12
# File 'lib/zendesk2/help_center/translation.rb', line 12

attribute :url, type: :string