Class: Zendesk2::HelpCenter::Translation
- Inherits:
-
Object
- Object
- Zendesk2::HelpCenter::Translation
- Extended by:
- Attributes
- Defined in:
- lib/zendesk2/help_center/translation.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#body ⇒ String
The body of the translation.
- #destroy! ⇒ Object
-
#draft ⇒ Boolean
True if the translation is a draft; false otherwise.
-
#html_url ⇒ String
The url of the translation in Help Center.
-
#id ⇒ Integer
Automatically assigned when the translation is created.
-
#locale ⇒ String
The locale of the translation.
-
#outdated ⇒ Boolean
True if the translation is outdated; false otherwise.
- #save! ⇒ Object
-
#source_id ⇒ Integer
The id of the item that has this translation.
-
#source_type ⇒ String
The type of the item that has this translation.
-
#title ⇒ String
The title of the translation.
-
#url ⇒ String
The API url of the translation.
Methods included from Attributes
assoc_accessor, assoc_reader, assoc_writer
Methods included from Zendesk2::HelpCenter::TranslationSource::Model
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#body ⇒ String
Returns 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 |
#draft ⇒ Boolean
Returns 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_url ⇒ String
Returns The url of the translation in Help Center.
14 |
# File 'lib/zendesk2/help_center/translation.rb', line 14 attribute :html_url, type: :string |
#id ⇒ Integer
Returns Automatically assigned when the translation is created.
9 |
# File 'lib/zendesk2/help_center/translation.rb', line 9 identity :id, type: :integer |
#locale ⇒ String
Returns The locale of the translation.
20 |
# File 'lib/zendesk2/help_center/translation.rb', line 20 attribute :locale, type: :string |
#outdated ⇒ Boolean
Returns 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_id ⇒ Integer
Returns 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_type ⇒ String
Returns 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 |
#title ⇒ String
Returns The title of the translation.
22 |
# File 'lib/zendesk2/help_center/translation.rb', line 22 attribute :title, type: :string |
#url ⇒ String
Returns The API url of the translation.
12 |
# File 'lib/zendesk2/help_center/translation.rb', line 12 attribute :url, type: :string |