Class: Smartsheet::Users

Inherits:
Object
  • Object
show all
Defined in:
lib/smartsheet/endpoints/users/users.rb

Overview

Users Endpoints

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Users

Returns a new instance of Users.



13
14
15
16
17
# File 'lib/smartsheet/endpoints/users/users.rb', line 13

def initialize(client)
  @client = client

  @alternate_emails = AlternateEmails.new(client)
end

Instance Attribute Details

#alternate_emailsAlternateEmails (readonly)

Returns:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/smartsheet/endpoints/users/users.rb', line 9

class Users
  attr_reader :client, :alternate_emails
  private :client

  def initialize(client)
    @client = client

    @alternate_emails = AlternateEmails.new(client)
  end

  def add(body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['users'], body_type: :json)
    request_spec = Smartsheet::API::RequestSpec.new(
        header_overrides: header_overrides,
        body: body,
        params: params
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def get_current(params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['users', 'me'])
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def get(user_id:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['users', :user_id])
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        user_id: user_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def list(params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['users'])
    request_spec = Smartsheet::API::RequestSpec.new(
        header_overrides: header_overrides,
        params: params
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def remove(user_id:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['users', :user_id])
    request_spec = Smartsheet::API::RequestSpec.new(
        header_overrides: header_overrides,
        params: params,
        user_id: user_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

  def update(user_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['users', :user_id], body_type: :json)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        body: body,
        user_id: user_id
    )
    client.make_request(endpoint_spec, request_spec)
  end
end

Instance Method Details

#add(body:, params: {}, header_overrides: {}) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/smartsheet/endpoints/users/users.rb', line 19

def add(body:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['users'], body_type: :json)
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      body: body,
      params: params
  )
  client.make_request(endpoint_spec, request_spec)
end

#get(user_id:, params: {}, header_overrides: {}) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/smartsheet/endpoints/users/users.rb', line 38

def get(user_id:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['users', :user_id])
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      user_id: user_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#get_current(params: {}, header_overrides: {}) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/smartsheet/endpoints/users/users.rb', line 29

def get_current(params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['users', 'me'])
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides
  )
  client.make_request(endpoint_spec, request_spec)
end

#list(params: {}, header_overrides: {}) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/smartsheet/endpoints/users/users.rb', line 48

def list(params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['users'])
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      params: params
  )
  client.make_request(endpoint_spec, request_spec)
end

#remove(user_id:, params: {}, header_overrides: {}) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/smartsheet/endpoints/users/users.rb', line 57

def remove(user_id:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['users', :user_id])
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      params: params,
      user_id: user_id
  )
  client.make_request(endpoint_spec, request_spec)
end

#update(user_id:, body:, params: {}, header_overrides: {}) ⇒ Object



67
68
69
70
71
72
73
74
75
76
# File 'lib/smartsheet/endpoints/users/users.rb', line 67

def update(user_id:, body:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['users', :user_id], body_type: :json)
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      body: body,
      user_id: user_id
  )
  client.make_request(endpoint_spec, request_spec)
end