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, #log_info, #logger, #path, #process_response, #required_params, #rest_client_response

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( = nil)
  .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(, 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()
  call(:delete, path())
end

#retrieve(login) ⇒ RestClient::Response

Retrieves a user



34
35
36
# File 'lib/runcible/resources/user.rb', line 34

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

#retrieve_allRestClient::Response

Retrieves all users



16
17
18
# File 'lib/runcible/resources/user.rb', line 16

def retrieve_all
  call(:get, path)
end