Class: Zendesk2::HelpCenter::Subscription

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

#content_idInteger

Returns The id of the subscribed item.

Returns:

  • (Integer)

    The id of the subscribed item



15
# File 'lib/zendesk2/help_center/subscription.rb', line 15

attribute :content_id, type: :integer

#content_typeString

Returns The type of the subscribed item.

Returns:

  • (String)

    The type of the subscribed item



17
# File 'lib/zendesk2/help_center/subscription.rb', line 17

attribute :content_type

#created_atTime

Returns The time at which the subscription was created.

Returns:

  • (Time)

    The time at which the subscription was created



23
# File 'lib/zendesk2/help_center/subscription.rb', line 23

attribute :created_at, type: :time

#destroy!Object



27
28
29
30
31
# File 'lib/zendesk2/help_center/subscription.rb', line 27

def destroy!
  requires :identity

  cistern.destroy_help_center_subscription('subscription' => attributes)
end

#idInteger

Returns Automatically assigned when the subscription is created.

Returns:

  • (Integer)

    Automatically assigned when the subscription is created



8
# File 'lib/zendesk2/help_center/subscription.rb', line 8

identity :id, type: :integer

#include_commentsBoolean

Returns Subscribe also to article comments. Only for section subscriptions.

Returns:

  • (Boolean)

    Subscribe also to article comments. Only for section subscriptions.



21
# File 'lib/zendesk2/help_center/subscription.rb', line 21

attribute :include_comments, type: :boolean

#localeString

Returns The locale of the subscribed item.

Returns:

  • (String)

    The locale of the subscribed item



19
# File 'lib/zendesk2/help_center/subscription.rb', line 19

attribute :locale

#save!Object



33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/zendesk2/help_center/subscription.rb', line 33

def save!
  response = if new_record?
               requires :content_id, :content_type

               cistern.create_help_center_subscription('subscription' => attributes)
             else
               requires :identity

               cistern.update_help_center_subscription('subscription' => attributes)
             end

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

#updated_atTime

Returns The time at which the subscription was last updated.

Returns:

  • (Time)

    The time at which the subscription was last updated



25
# File 'lib/zendesk2/help_center/subscription.rb', line 25

attribute :updated_at, type: :time

#urlString

Returns The API url of the subscription.

Returns:

  • (String)

    The API url of the subscription



11
# File 'lib/zendesk2/help_center/subscription.rb', line 11

attribute :url

#user_idInteger

Returns The id of the user who has this subscription.

Returns:

  • (Integer)

    The id of the user who has this subscription



13
# File 'lib/zendesk2/help_center/subscription.rb', line 13

attribute :user_id, type: :integer