Class: ZendeskAPI::User
- Inherits:
-
Resource
- Object
- Data
- DataResource
- Resource
- ZendeskAPI::User
- Extended by:
- CreateMany, CreateOrUpdate, CreateOrUpdateMany, DestroyMany, UpdateMany
- Defined in:
- lib/zendesk_api/resources.rb,
lib/zendesk_api/resources.rb
Defined Under Namespace
Classes: CurrentSession, GroupMembership, Identity, Session
Instance Attribute Summary
Attributes inherited from DataResource
Attributes inherited from Data
#association, #attributes, #errors, #response
Class Method Summary collapse
- .cbp_path_regexes ⇒ Object
-
.incremental_export(client, start_time) ⇒ Collection
Gets a incremental export of users from the start_time until now.
Instance Method Summary collapse
- #attributes_for_save ⇒ Object
-
#change_password(opts = {}) ⇒ Object
Change a user’s password.
-
#change_password!(opts = {}) ⇒ Object
Change a user’s password.
- #clear_sessions ⇒ Object
- #clear_sessions! ⇒ Object
- #current_session ⇒ Object
- #handle_response ⇒ Object
-
#set_password(opts = {}) ⇒ Object
Set a user’s password.
-
#set_password!(opts = {}) ⇒ Object
Set a user’s password.
Methods included from CreateMany
Methods included from UpdateMany
Methods included from CreateOrUpdate
Methods included from CreateOrUpdateMany
Methods included from DestroyMany
Methods included from Destroy
#destroy, #destroy!, #destroyed?, included
Methods included from Update
Methods included from Save
#clear_associations, #save, #save!, #save_associations
Methods included from Create
Methods included from Read
Methods included from Sideloading
Methods included from Verbs
Methods inherited from Data
#==, #id, inherited, #initialize, #loaded_associations, #method_missing, namespace, new_from_response, #new_record?, #path, resource_name, resource_path, #respond_to_missing?, singular_resource_name, subclasses, #to_json, #to_s
Methods included from Associations
Constructor Details
This class inherits a constructor from ZendeskAPI::Data
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ZendeskAPI::Data
Class Method Details
.cbp_path_regexes ⇒ Object
803 804 805 |
# File 'lib/zendesk_api/resources.rb', line 803 def self.cbp_path_regexes [/^users$/, %r{^organizations/\d+/users$}] end |
.incremental_export(client, start_time) ⇒ Collection
Gets a incremental export of users from the start_time until now.
833 834 835 |
# File 'lib/zendesk_api/resources.rb', line 833 def self.incremental_export(client, start_time) ZendeskAPI::Collection.new(client, self, :path => "incremental/users?start_time=#{start_time.to_i}") end |
Instance Method Details
#attributes_for_save ⇒ Object
892 893 894 895 896 897 898 899 900 901 |
# File 'lib/zendesk_api/resources.rb', line 892 def attributes_for_save # Don't send role_id, it's necessary # for side-loading, but causes problems on save # see #initialize attrs = attributes.changes.delete_if do |k, _| k == "role_id" end { self.class.singular_resource_name => attrs } end |
#change_password(opts = {}) ⇒ Object
Change a user’s password
815 816 817 |
# File 'lib/zendesk_api/resources.rb', line 815 def change_password(opts = {}) password(opts.merge(:verb => :put)) end |
#change_password!(opts = {}) ⇒ Object
Change a user’s password
825 826 827 |
# File 'lib/zendesk_api/resources.rb', line 825 def change_password!(opts = {}) password!(opts.merge(:verb => :put)) end |
#clear_sessions ⇒ Object
864 865 866 867 868 |
# File 'lib/zendesk_api/resources.rb', line 864 def clear_sessions clear_sessions! rescue ZendeskAPI::Error::ClientError false end |
#clear_sessions! ⇒ Object
860 861 862 |
# File 'lib/zendesk_api/resources.rb', line 860 def clear_sessions! @client.connection.delete(path + '/sessions') end |
#current_session ⇒ Object
854 855 856 |
# File 'lib/zendesk_api/resources.rb', line 854 def current_session ZendeskAPI::User::CurrentSession.find(@client, :user_id => 'me') end |
#handle_response ⇒ Object
903 904 905 906 907 908 |
# File 'lib/zendesk_api/resources.rb', line 903 def handle_response(*) super # Needed for proper Role sideloading self.role_id = role.name if key?(:role) end |
#set_password(opts = {}) ⇒ Object
Set a user’s password
810 811 812 |
# File 'lib/zendesk_api/resources.rb', line 810 def set_password(opts = {}) password(opts.merge(:verb => :post)) end |
#set_password!(opts = {}) ⇒ Object
Set a user’s password
820 821 822 |
# File 'lib/zendesk_api/resources.rb', line 820 def set_password!(opts = {}) password!(opts.merge(:verb => :post)) end |