Class: Runcible::Resources::User

Inherits:
Base
  • Object
show all
Defined in:
lib/runcible/resources/user.rb

Overview

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#add_http_auth_header, #add_oauth_header, #call, #combine_get_params, #config, #format_payload_json, #generate_log_message, #generate_payload, #get_response, #initialize, #lazy_config=, #log_debug, #log_exception, #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



32
33
34
# File 'lib/runcible/resources/user.rb', line 32

def self.path( = nil)
  (.nil?) ? 'users/' : "users/#{}/"
end

Instance Method Details

#create(login, optional = {}) ⇒ RestClient::Response

Creates a user



48
49
50
51
# File 'lib/runcible/resources/user.rb', line 48

def create(, 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



65
66
67
# File 'lib/runcible/resources/user.rb', line 65

def delete()
  call(:delete, path())
end

#retrieve(login) ⇒ RestClient::Response

Retrieves a user



57
58
59
# File 'lib/runcible/resources/user.rb', line 57

def retrieve()
  call(:get, path())
end

#retrieve_allRestClient::Response

Retrieves all users



39
40
41
# File 'lib/runcible/resources/user.rb', line 39

def retrieve_all
  call(:get, path)
end