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



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



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

attribute :draft, type: :boolean

#html_urlString



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

attribute :html_url, type: :string

#idInteger



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

identity :id, type: :integer

#localeString



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

attribute :locale, type: :string

#outdatedBoolean



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



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

attribute :source_id, type: :integer

#source_typeString



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

attribute :source_type, type: :string

#titleString



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

attribute :title, type: :string

#urlString



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

attribute :url, type: :string