Class: Smartsheet::Discussions

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

Overview

Discussions Endpoints

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Discussions

Returns a new instance of Discussions.



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

def initialize(client)
  @client = client

  @attachments = DiscussionsAttachments.new(client)
end

Instance Attribute Details

#attachmentsDiscussionsAttachments (readonly)



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
78
79
80
81
82
83
84
# File 'lib/smartsheet/endpoints/sheets/discussions.rb', line 9

class Discussions
  attr_reader :client, :attachments
  private :client

  def initialize(client)
    @client = client

    @attachments = DiscussionsAttachments.new(client)
  end

  def create_on_row(sheet_id:, row_id:, body:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', :row_id, 'discussions'], body_type: :json)
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        body: body,
        sheet_id: sheet_id,
        row_id: row_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

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

  def delete(sheet_id:, discussion_id:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'discussions', :discussion_id])
    request_spec = Smartsheet::API::RequestSpec.new(
        params: params,
        header_overrides: header_overrides,
        sheet_id: sheet_id,
        discussion_id: discussion_id
    )
    client.make_request(endpoint_spec, request_spec)
  end

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

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

  def list_row_discussions(sheet_id:, row_id:, params: {}, header_overrides: {})
    endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'rows', :row_id, 'discussions'])
    request_spec = Smartsheet::API::RequestSpec.new(
        header_overrides: header_overrides,
        params: params,
        sheet_id: sheet_id,
        row_id: row_id
    )
    client.make_request(endpoint_spec, request_spec)
  end
end

Instance Method Details

#create_on_row(sheet_id:, row_id:, body:, params: {}, header_overrides: {}) ⇒ Object



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

def create_on_row(sheet_id:, row_id:, body:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', :row_id, 'discussions'], body_type: :json)
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      body: body,
      sheet_id: sheet_id,
      row_id: row_id
  )
  client.make_request(endpoint_spec, request_spec)
end

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



31
32
33
34
35
36
37
38
39
40
# File 'lib/smartsheet/endpoints/sheets/discussions.rb', line 31

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

#delete(sheet_id:, discussion_id:, params: {}, header_overrides: {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
# File 'lib/smartsheet/endpoints/sheets/discussions.rb', line 42

def delete(sheet_id:, discussion_id:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'discussions', :discussion_id])
  request_spec = Smartsheet::API::RequestSpec.new(
      params: params,
      header_overrides: header_overrides,
      sheet_id: sheet_id,
      discussion_id: discussion_id
  )
  client.make_request(endpoint_spec, request_spec)
end

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



63
64
65
66
67
68
69
70
71
72
# File 'lib/smartsheet/endpoints/sheets/discussions.rb', line 63

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

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



53
54
55
56
57
58
59
60
61
# File 'lib/smartsheet/endpoints/sheets/discussions.rb', line 53

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

#list_row_discussions(sheet_id:, row_id:, params: {}, header_overrides: {}) ⇒ Object



74
75
76
77
78
79
80
81
82
83
# File 'lib/smartsheet/endpoints/sheets/discussions.rb', line 74

def list_row_discussions(sheet_id:, row_id:, params: {}, header_overrides: {})
  endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'rows', :row_id, 'discussions'])
  request_spec = Smartsheet::API::RequestSpec.new(
      header_overrides: header_overrides,
      params: params,
      sheet_id: sheet_id,
      row_id: row_id
  )
  client.make_request(endpoint_spec, request_spec)
end