Class: Runcible::Resources::User
- Defined in:
- lib/runcible/resources/user.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.path(login = nil) ⇒ String
Generates the API path for Users.
Instance Method Summary collapse
-
#create(login, optional = {}) ⇒ RestClient::Response
Creates a user.
-
#delete(login) ⇒ RestClient::Response
Deletes a user.
-
#retrieve(login) ⇒ RestClient::Response
Retrieves a user.
-
#retrieve_all ⇒ RestClient::Response
Retrieves all users.
Methods inherited from Base
#add_http_auth_header, #add_oauth_header, #call, #combine_get_params, #config, #exception_to_log, #format_payload_json, #generate_payload, #get_response, #initialize, #lazy_config=, #log_debug, #log_exception, #log_info, #logger, #path, #process_response, #required_params
Constructor Details
This class inherits a constructor from Runcible::Base
Class Method Details
.path(login = nil) ⇒ String
Generates the API path for Users
9 10 11 |
# File 'lib/runcible/resources/user.rb', line 9 def self.path(login = nil) login.nil? ? 'users/' : "users/#{login}/" end |
Instance Method Details
#create(login, optional = {}) ⇒ RestClient::Response
Creates a user
25 26 27 28 |
# File 'lib/runcible/resources/user.rb', line 25 def create(login, optional = {}) required = required_params(binding.send(:local_variables), binding) call(:post, path, :payload => { :required => required, :optional => optional }) end |
#delete(login) ⇒ RestClient::Response
Deletes a user
42 43 44 |
# File 'lib/runcible/resources/user.rb', line 42 def delete(login) call(:delete, path(login)) end |
#retrieve(login) ⇒ RestClient::Response
Retrieves a user
34 35 36 |
# File 'lib/runcible/resources/user.rb', line 34 def retrieve(login) call(:get, path(login)) end |
#retrieve_all ⇒ RestClient::Response
Retrieves all users
16 17 18 |
# File 'lib/runcible/resources/user.rb', line 16 def retrieve_all call(:get, path) end |