Class: ForemanApi::Resources::User

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

Class Method Summary (collapse)

Instance Method Summary (collapse)

Class Method Details

+ (Object) doc



4
5
6
# File 'lib/foreman_api/resources/user.rb', line 4

def self.doc
  @doc ||= ForemanApi.doc['resources']["users"]
end

Instance Method Details

- (Object) create(params = { }, headers = { })

Parameters:

  • params (Hash) (defaults to: { })

    a hash of params to be passed to the service

  • headers (Hash) (defaults to: { })

    additional http headers

Options Hash (params):

  • user (Hash)

    allowed keys are:

    • admin [String] Is an admin account? ,

    • auth_source_id [Numeric],

    • firstname [String],

    • lastname [String],

    • login [String],

    • mail [String],

    • password [String],



43
44
45
46
47
# File 'lib/foreman_api/resources/user.rb', line 43

def create(params = { }, headers = { })
  check_params params, :allowed => true, :method => __method__
  url, params = fill_params_in_url "/api/users", params
  call(:post", url, params, headers)
end

- (Object) destroy(params = { }, headers = { })

Parameters:

  • params (Hash) (defaults to: { })

    a hash of params to be passed to the service

  • headers (Hash) (defaults to: { })

    additional http headers

Options Hash (params):

  • id (String)


71
72
73
74
75
# File 'lib/foreman_api/resources/user.rb', line 71

def destroy(params = { }, headers = { })
  check_params params, :allowed => true, :method => __method__
  url, params = fill_params_in_url "/api/users/:id", params
  call(:delete", url, params, headers)
end

- (Object) index(params = { }, headers = { })

Parameters:

  • params (Hash) (defaults to: { })

    a hash of params to be passed to the service

  • headers (Hash) (defaults to: { })

    additional http headers

Options Hash (params):

  • order (String)

    Sort results

  • page (String)

    Paginate results

  • per_page (String)

    Number of entries per request

  • search (String)

    Filter results



15
16
17
18
19
# File 'lib/foreman_api/resources/user.rb', line 15

def index(params = { }, headers = { })
  check_params params, :allowed => true, :method => __method__
  url, params = fill_params_in_url "/api/users", params
  call(:get", url, params, headers)
end

- (Object) show(params = { }, headers = { })

Parameters:

  • params (Hash) (defaults to: { })

    a hash of params to be passed to the service

  • headers (Hash) (defaults to: { })

    additional http headers

Options Hash (params):

  • id (String)


25
26
27
28
29
# File 'lib/foreman_api/resources/user.rb', line 25

def show(params = { }, headers = { })
  check_params params, :allowed => true, :method => __method__
  url, params = fill_params_in_url "/api/users/:id", params
  call(:get", url, params, headers)
end

- (Object) update(params = { }, headers = { })

Parameters:

  • params (Hash) (defaults to: { })

    a hash of params to be passed to the service

  • headers (Hash) (defaults to: { })

    additional http headers

Options Hash (params):

  • id (String)
  • user (Hash)

    allowed keys are:

    • admin [String] Is an admin account? ,

    • firstname [String, nil],

    • lastname [String, nil],

    • login [String],

    • mail [String],

    • password [String],



61
62
63
64
65
# File 'lib/foreman_api/resources/user.rb', line 61

def update(params = { }, headers = { })
  check_params params, :allowed => true, :method => __method__
  url, params = fill_params_in_url "/api/users/:id", params
  call(:put", url, params, headers)
end