Class: Zendesk2::Membership
- Inherits:
-
Object
- Object
- Zendesk2::Membership
- Extended by:
- Attributes
- Includes:
- Model
- Defined in:
- lib/zendesk2/membership.rb
Instance Attribute Summary
Attributes included from Model
Instance Method Summary collapse
-
#created_at ⇒ Time
The time the identity got created.
-
#default ⇒ Boolean
Is membership the default.
- #default! ⇒ Object
- #destroy! ⇒ Object
-
#id ⇒ Integer
Automatically assigned upon creation.
-
#organization_id ⇒ Integer
The id of the organization.
- #save! ⇒ Object
-
#updated_at ⇒ Time
The time the identity got updated.
-
#url ⇒ String
The API url of this identity.
-
#user_id ⇒ Integer
The id of the user.
Methods included from Attributes
assoc_accessor, assoc_reader, assoc_writer
Methods included from Model
#destroy, #destroyed?, #missing_attributes, #save, #update!
Instance Method Details
#created_at ⇒ Time
Returns The time the identity got created.
11 |
# File 'lib/zendesk2/membership.rb', line 11 attribute :created_at, type: :time |
#default ⇒ Boolean
Returns Is membership the default.
13 |
# File 'lib/zendesk2/membership.rb', line 13 attribute :default, type: :boolean |
#default! ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/zendesk2/membership.rb', line 46 def default! requires :identity, :user_id cistern.mark_membership_default( 'membership' => { 'user_id' => user_id, 'id' => identity, } ) self.default = true end |
#destroy! ⇒ Object
40 41 42 43 44 |
# File 'lib/zendesk2/membership.rb', line 40 def destroy! requires :identity cistern.destroy_membership('membership' => { 'id' => identity }) end |
#id ⇒ Integer
Returns Automatically assigned upon creation.
8 |
# File 'lib/zendesk2/membership.rb', line 8 identity :id, type: :integer |
#organization_id ⇒ Integer
Returns The id of the organization.
15 |
# File 'lib/zendesk2/membership.rb', line 15 attribute :organization_id, type: :integer |
#save! ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zendesk2/membership.rb', line 26 def save! data = if new_record? requires :organization_id, :user_id cistern.create_membership('membership' => attributes).body['organization_membership'] else requires :identity raise ArgumentError, 'update not implemented' end merge_attributes(data) end |
#updated_at ⇒ Time
Returns The time the identity got updated.
17 |
# File 'lib/zendesk2/membership.rb', line 17 attribute :updated_at, type: :time |
#url ⇒ String
Returns The API url of this identity.
21 |
# File 'lib/zendesk2/membership.rb', line 21 attribute :url, type: :string |
#user_id ⇒ Integer
Returns The id of the user.
19 |
# File 'lib/zendesk2/membership.rb', line 19 attribute :user_id, type: :integer |