smartsheet 2.77.0 → 2.101.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +12 -12
- data/.rubocop.yml +4 -4
- data/.travis.yml +29 -15
- data/.yardopts +3 -3
- data/ADVANCED.md +78 -78
- data/CHANGELOG.md +133 -112
- data/Gemfile +6 -6
- data/LICENSE +202 -202
- data/README.md +248 -246
- data/Rakefile +29 -29
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/lib/smartsheet.rb +2 -2
- data/lib/smartsheet/api/body_builder.rb +25 -25
- data/lib/smartsheet/api/endpoint_spec.rb +54 -54
- data/lib/smartsheet/api/faraday_adapter/faraday_net_client.rb +45 -45
- data/lib/smartsheet/api/faraday_adapter/faraday_response.rb +70 -70
- data/lib/smartsheet/api/faraday_adapter/middleware/faraday_error_translator.rb +20 -20
- data/lib/smartsheet/api/faraday_adapter/middleware/response_parser.rb +25 -25
- data/lib/smartsheet/api/file_spec.rb +55 -55
- data/lib/smartsheet/api/header_builder.rb +96 -96
- data/lib/smartsheet/api/request.rb +42 -42
- data/lib/smartsheet/api/request_client.rb +43 -43
- data/lib/smartsheet/api/request_logger.rb +182 -182
- data/lib/smartsheet/api/request_spec.rb +57 -57
- data/lib/smartsheet/api/response_net_client_decorator.rb +54 -54
- data/lib/smartsheet/api/retry_logic.rb +40 -40
- data/lib/smartsheet/api/retry_net_client_decorator.rb +37 -37
- data/lib/smartsheet/api/url_builder.rb +25 -25
- data/lib/smartsheet/client.rb +193 -193
- data/lib/smartsheet/constants.rb +18 -18
- data/lib/smartsheet/endpoints/contacts/contacts.rb +30 -30
- data/lib/smartsheet/endpoints/events/events.rb +20 -20
- data/lib/smartsheet/endpoints/favorites/favorites.rb +159 -159
- data/lib/smartsheet/endpoints/folders/folders.rb +125 -125
- data/lib/smartsheet/endpoints/groups/groups.rb +83 -83
- data/lib/smartsheet/endpoints/home/home.rb +20 -20
- data/lib/smartsheet/endpoints/reports/reports.rb +100 -100
- data/lib/smartsheet/endpoints/reports/reports_share.rb +69 -69
- data/lib/smartsheet/endpoints/search/search.rb +30 -30
- data/lib/smartsheet/endpoints/server_info/server_info.rb +21 -21
- data/lib/smartsheet/endpoints/share/share.rb +58 -58
- data/lib/smartsheet/endpoints/sheets/automation_rules.rb +55 -55
- data/lib/smartsheet/endpoints/sheets/cells.rb +82 -82
- data/lib/smartsheet/endpoints/sheets/columns.rb +66 -66
- data/lib/smartsheet/endpoints/sheets/comments.rb +64 -64
- data/lib/smartsheet/endpoints/sheets/comments_attachments.rb +78 -78
- data/lib/smartsheet/endpoints/sheets/cross_sheet_references.rb +45 -45
- data/lib/smartsheet/endpoints/sheets/discussions.rb +84 -84
- data/lib/smartsheet/endpoints/sheets/discussions_attachments.rb +22 -22
- data/lib/smartsheet/endpoints/sheets/rows.rb +106 -106
- data/lib/smartsheet/endpoints/sheets/rows_attachments.rb +92 -92
- data/lib/smartsheet/endpoints/sheets/sheets.rb +514 -510
- data/lib/smartsheet/endpoints/sheets/sheets_attachments.rb +174 -174
- data/lib/smartsheet/endpoints/sheets/sheets_share.rb +69 -69
- data/lib/smartsheet/endpoints/sheets/sheets_summaries.rb +123 -0
- data/lib/smartsheet/endpoints/sights/sights.rb +101 -101
- data/lib/smartsheet/endpoints/sights/sights_share.rb +69 -69
- data/lib/smartsheet/endpoints/templates/templates.rb +29 -29
- data/lib/smartsheet/endpoints/token/token.rb +70 -66
- data/lib/smartsheet/endpoints/update_requests/sent_update_requests.rb +44 -44
- data/lib/smartsheet/endpoints/update_requests/update_requests.rb +74 -74
- data/lib/smartsheet/endpoints/users/alternate_emails.rb +79 -79
- data/lib/smartsheet/endpoints/users/users.rb +123 -77
- data/lib/smartsheet/endpoints/webhooks/webhooks.rb +71 -71
- data/lib/smartsheet/endpoints/workspaces/workspaces.rb +87 -87
- data/lib/smartsheet/endpoints/workspaces/workspaces_share.rb +70 -70
- data/lib/smartsheet/error.rb +69 -69
- data/lib/smartsheet/general_request.rb +74 -74
- data/lib/smartsheet/version.rb +5 -5
- data/smartsheet.gemspec +54 -54
- metadata +24 -12
@@ -1,107 +1,107 @@
|
|
1
|
-
require 'smartsheet/endpoints/sheets/rows_attachments'
|
2
|
-
|
3
|
-
module Smartsheet
|
4
|
-
# Rows Endpoints
|
5
|
-
# @see https://smartsheet-platform.github.io/api-docs/?ruby#rows API Rows Docs
|
6
|
-
#
|
7
|
-
# @!attribute [r] attachments
|
8
|
-
# @return [RowsAttachments]
|
9
|
-
class Rows
|
10
|
-
attr_reader :client, :attachments
|
11
|
-
private :client
|
12
|
-
|
13
|
-
def initialize(client)
|
14
|
-
@client = client
|
15
|
-
|
16
|
-
@attachments = RowsAttachments.new(client)
|
17
|
-
end
|
18
|
-
|
19
|
-
def add(sheet_id:, body:, params: {}, header_overrides: {})
|
20
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows'], body_type: :json)
|
21
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
22
|
-
header_overrides: header_overrides,
|
23
|
-
params: params,
|
24
|
-
body: body,
|
25
|
-
sheet_id: sheet_id
|
26
|
-
)
|
27
|
-
client.make_request(endpoint_spec, request_spec)
|
28
|
-
end
|
29
|
-
|
30
|
-
def copy_to_another_sheet(sheet_id:, body:, params: {}, header_overrides: {})
|
31
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'copy'], body_type: :json)
|
32
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
33
|
-
header_overrides: header_overrides,
|
34
|
-
body: body,
|
35
|
-
params: params,
|
36
|
-
sheet_id: sheet_id
|
37
|
-
)
|
38
|
-
client.make_request(endpoint_spec, request_spec)
|
39
|
-
end
|
40
|
-
|
41
|
-
def delete(sheet_id:, row_ids:, params: {}, header_overrides: {})
|
42
|
-
params[:ids] = row_ids.join(',')
|
43
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'rows'])
|
44
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
45
|
-
header_overrides: header_overrides,
|
46
|
-
params: params,
|
47
|
-
sheet_id: sheet_id
|
48
|
-
)
|
49
|
-
client.make_request(endpoint_spec, request_spec)
|
50
|
-
end
|
51
|
-
|
52
|
-
def get(sheet_id:, row_id:, params: {}, header_overrides: {})
|
53
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'rows', :row_id])
|
54
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
55
|
-
header_overrides: header_overrides,
|
56
|
-
params: params,
|
57
|
-
sheet_id: sheet_id,
|
58
|
-
row_id: row_id
|
59
|
-
)
|
60
|
-
client.make_request(endpoint_spec, request_spec)
|
61
|
-
end
|
62
|
-
|
63
|
-
def move_to_another_sheet(sheet_id:, body:, params: {}, header_overrides: {})
|
64
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'move'], body_type: :json)
|
65
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
66
|
-
header_overrides: header_overrides,
|
67
|
-
body: body,
|
68
|
-
params: params,
|
69
|
-
sheet_id: sheet_id
|
70
|
-
)
|
71
|
-
client.make_request(endpoint_spec, request_spec)
|
72
|
-
end
|
73
|
-
|
74
|
-
def send_via_email(sheet_id:, body:, params: {}, header_overrides: {})
|
75
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'emails'], body_type: :json)
|
76
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
77
|
-
header_overrides: header_overrides,
|
78
|
-
params: params,
|
79
|
-
body: body,
|
80
|
-
sheet_id: sheet_id
|
81
|
-
)
|
82
|
-
client.make_request(endpoint_spec, request_spec)
|
83
|
-
end
|
84
|
-
|
85
|
-
def update(sheet_id:, body:, params: {}, header_overrides: {})
|
86
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'rows'], body_type: :json)
|
87
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
88
|
-
header_overrides: header_overrides,
|
89
|
-
body: body,
|
90
|
-
params: params,
|
91
|
-
sheet_id: sheet_id
|
92
|
-
)
|
93
|
-
client.make_request(endpoint_spec, request_spec)
|
94
|
-
end
|
95
|
-
|
96
|
-
def sort(sheet_id:, body:, params: {}, header_overrides: {})
|
97
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'sort'], body_type: :json)
|
98
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
99
|
-
header_overrides: header_overrides,
|
100
|
-
body: body,
|
101
|
-
params: params,
|
102
|
-
sheet_id: sheet_id
|
103
|
-
)
|
104
|
-
client.make_request(endpoint_spec, request_spec)
|
105
|
-
end
|
106
|
-
end
|
1
|
+
require 'smartsheet/endpoints/sheets/rows_attachments'
|
2
|
+
|
3
|
+
module Smartsheet
|
4
|
+
# Rows Endpoints
|
5
|
+
# @see https://smartsheet-platform.github.io/api-docs/?ruby#rows API Rows Docs
|
6
|
+
#
|
7
|
+
# @!attribute [r] attachments
|
8
|
+
# @return [RowsAttachments]
|
9
|
+
class Rows
|
10
|
+
attr_reader :client, :attachments
|
11
|
+
private :client
|
12
|
+
|
13
|
+
def initialize(client)
|
14
|
+
@client = client
|
15
|
+
|
16
|
+
@attachments = RowsAttachments.new(client)
|
17
|
+
end
|
18
|
+
|
19
|
+
def add(sheet_id:, body:, params: {}, header_overrides: {})
|
20
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows'], body_type: :json)
|
21
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
22
|
+
header_overrides: header_overrides,
|
23
|
+
params: params,
|
24
|
+
body: body,
|
25
|
+
sheet_id: sheet_id
|
26
|
+
)
|
27
|
+
client.make_request(endpoint_spec, request_spec)
|
28
|
+
end
|
29
|
+
|
30
|
+
def copy_to_another_sheet(sheet_id:, body:, params: {}, header_overrides: {})
|
31
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'copy'], body_type: :json)
|
32
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
33
|
+
header_overrides: header_overrides,
|
34
|
+
body: body,
|
35
|
+
params: params,
|
36
|
+
sheet_id: sheet_id
|
37
|
+
)
|
38
|
+
client.make_request(endpoint_spec, request_spec)
|
39
|
+
end
|
40
|
+
|
41
|
+
def delete(sheet_id:, row_ids:, params: {}, header_overrides: {})
|
42
|
+
params[:ids] = row_ids.join(',')
|
43
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:delete, ['sheets', :sheet_id, 'rows'])
|
44
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
45
|
+
header_overrides: header_overrides,
|
46
|
+
params: params,
|
47
|
+
sheet_id: sheet_id
|
48
|
+
)
|
49
|
+
client.make_request(endpoint_spec, request_spec)
|
50
|
+
end
|
51
|
+
|
52
|
+
def get(sheet_id:, row_id:, params: {}, header_overrides: {})
|
53
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'rows', :row_id])
|
54
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
55
|
+
header_overrides: header_overrides,
|
56
|
+
params: params,
|
57
|
+
sheet_id: sheet_id,
|
58
|
+
row_id: row_id
|
59
|
+
)
|
60
|
+
client.make_request(endpoint_spec, request_spec)
|
61
|
+
end
|
62
|
+
|
63
|
+
def move_to_another_sheet(sheet_id:, body:, params: {}, header_overrides: {})
|
64
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'move'], body_type: :json)
|
65
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
66
|
+
header_overrides: header_overrides,
|
67
|
+
body: body,
|
68
|
+
params: params,
|
69
|
+
sheet_id: sheet_id
|
70
|
+
)
|
71
|
+
client.make_request(endpoint_spec, request_spec)
|
72
|
+
end
|
73
|
+
|
74
|
+
def send_via_email(sheet_id:, body:, params: {}, header_overrides: {})
|
75
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'rows', 'emails'], body_type: :json)
|
76
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
77
|
+
header_overrides: header_overrides,
|
78
|
+
params: params,
|
79
|
+
body: body,
|
80
|
+
sheet_id: sheet_id
|
81
|
+
)
|
82
|
+
client.make_request(endpoint_spec, request_spec)
|
83
|
+
end
|
84
|
+
|
85
|
+
def update(sheet_id:, body:, params: {}, header_overrides: {})
|
86
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:put, ['sheets', :sheet_id, 'rows'], body_type: :json)
|
87
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
88
|
+
header_overrides: header_overrides,
|
89
|
+
body: body,
|
90
|
+
params: params,
|
91
|
+
sheet_id: sheet_id
|
92
|
+
)
|
93
|
+
client.make_request(endpoint_spec, request_spec)
|
94
|
+
end
|
95
|
+
|
96
|
+
def sort(sheet_id:, body:, params: {}, header_overrides: {})
|
97
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post, ['sheets', :sheet_id, 'sort'], body_type: :json)
|
98
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
99
|
+
header_overrides: header_overrides,
|
100
|
+
body: body,
|
101
|
+
params: params,
|
102
|
+
sheet_id: sheet_id
|
103
|
+
)
|
104
|
+
client.make_request(endpoint_spec, request_spec)
|
105
|
+
end
|
106
|
+
end
|
107
107
|
end
|
@@ -1,93 +1,93 @@
|
|
1
|
-
require 'smartsheet/api/file_spec'
|
2
|
-
|
3
|
-
module Smartsheet
|
4
|
-
# Rows Attachments Endpoints
|
5
|
-
# @see https://smartsheet-platform.github.io/api-docs/?ruby#attachments API Attachments Docs
|
6
|
-
class RowsAttachments
|
7
|
-
attr_reader :client
|
8
|
-
private :client
|
9
|
-
|
10
|
-
def initialize(client)
|
11
|
-
@client = client
|
12
|
-
end
|
13
|
-
|
14
|
-
def list(sheet_id:, row_id:, params: {}, header_overrides: {})
|
15
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
16
|
-
:get,
|
17
|
-
['sheets', :sheet_id, 'rows', :row_id, 'attachments']
|
18
|
-
)
|
19
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
20
|
-
params: params,
|
21
|
-
header_overrides: header_overrides,
|
22
|
-
sheet_id: sheet_id,
|
23
|
-
row_id: row_id
|
24
|
-
)
|
25
|
-
client.make_request(endpoint_spec, request_spec)
|
26
|
-
end
|
27
|
-
|
28
|
-
def attach_url(sheet_id:, row_id:, body:, params: {}, header_overrides: {})
|
29
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
30
|
-
:post,
|
31
|
-
['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
|
32
|
-
body_type: :json
|
33
|
-
)
|
34
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
35
|
-
header_overrides: header_overrides,
|
36
|
-
params: params,
|
37
|
-
body: body,
|
38
|
-
sheet_id: sheet_id,
|
39
|
-
row_id: row_id
|
40
|
-
)
|
41
|
-
client.make_request(endpoint_spec, request_spec)
|
42
|
-
end
|
43
|
-
|
44
|
-
def attach_file(
|
45
|
-
sheet_id:,
|
46
|
-
row_id:,
|
47
|
-
file:,
|
48
|
-
filename:,
|
49
|
-
file_length:,
|
50
|
-
content_type: '',
|
51
|
-
params: {},
|
52
|
-
header_overrides: {}
|
53
|
-
)
|
54
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
55
|
-
:post,
|
56
|
-
['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
|
57
|
-
body_type: :file
|
58
|
-
)
|
59
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
60
|
-
params: params,
|
61
|
-
header_overrides: header_overrides,
|
62
|
-
file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
|
63
|
-
sheet_id: sheet_id,
|
64
|
-
row_id: row_id
|
65
|
-
)
|
66
|
-
client.make_request(endpoint_spec, request_spec)
|
67
|
-
end
|
68
|
-
|
69
|
-
def attach_file_from_path(
|
70
|
-
sheet_id:,
|
71
|
-
row_id:,
|
72
|
-
path:,
|
73
|
-
filename: nil,
|
74
|
-
content_type: '',
|
75
|
-
params: {},
|
76
|
-
header_overrides: {}
|
77
|
-
)
|
78
|
-
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
79
|
-
:post,
|
80
|
-
['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
|
81
|
-
body_type: :file
|
82
|
-
)
|
83
|
-
request_spec = Smartsheet::API::RequestSpec.new(
|
84
|
-
params: params,
|
85
|
-
header_overrides: header_overrides,
|
86
|
-
file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
|
87
|
-
sheet_id: sheet_id,
|
88
|
-
row_id: row_id
|
89
|
-
)
|
90
|
-
client.make_request(endpoint_spec, request_spec)
|
91
|
-
end
|
92
|
-
end
|
1
|
+
require 'smartsheet/api/file_spec'
|
2
|
+
|
3
|
+
module Smartsheet
|
4
|
+
# Rows Attachments Endpoints
|
5
|
+
# @see https://smartsheet-platform.github.io/api-docs/?ruby#attachments API Attachments Docs
|
6
|
+
class RowsAttachments
|
7
|
+
attr_reader :client
|
8
|
+
private :client
|
9
|
+
|
10
|
+
def initialize(client)
|
11
|
+
@client = client
|
12
|
+
end
|
13
|
+
|
14
|
+
def list(sheet_id:, row_id:, params: {}, header_overrides: {})
|
15
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
16
|
+
:get,
|
17
|
+
['sheets', :sheet_id, 'rows', :row_id, 'attachments']
|
18
|
+
)
|
19
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
20
|
+
params: params,
|
21
|
+
header_overrides: header_overrides,
|
22
|
+
sheet_id: sheet_id,
|
23
|
+
row_id: row_id
|
24
|
+
)
|
25
|
+
client.make_request(endpoint_spec, request_spec)
|
26
|
+
end
|
27
|
+
|
28
|
+
def attach_url(sheet_id:, row_id:, body:, params: {}, header_overrides: {})
|
29
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
30
|
+
:post,
|
31
|
+
['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
|
32
|
+
body_type: :json
|
33
|
+
)
|
34
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
35
|
+
header_overrides: header_overrides,
|
36
|
+
params: params,
|
37
|
+
body: body,
|
38
|
+
sheet_id: sheet_id,
|
39
|
+
row_id: row_id
|
40
|
+
)
|
41
|
+
client.make_request(endpoint_spec, request_spec)
|
42
|
+
end
|
43
|
+
|
44
|
+
def attach_file(
|
45
|
+
sheet_id:,
|
46
|
+
row_id:,
|
47
|
+
file:,
|
48
|
+
filename:,
|
49
|
+
file_length:,
|
50
|
+
content_type: '',
|
51
|
+
params: {},
|
52
|
+
header_overrides: {}
|
53
|
+
)
|
54
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
55
|
+
:post,
|
56
|
+
['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
|
57
|
+
body_type: :file
|
58
|
+
)
|
59
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
60
|
+
params: params,
|
61
|
+
header_overrides: header_overrides,
|
62
|
+
file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type),
|
63
|
+
sheet_id: sheet_id,
|
64
|
+
row_id: row_id
|
65
|
+
)
|
66
|
+
client.make_request(endpoint_spec, request_spec)
|
67
|
+
end
|
68
|
+
|
69
|
+
def attach_file_from_path(
|
70
|
+
sheet_id:,
|
71
|
+
row_id:,
|
72
|
+
path:,
|
73
|
+
filename: nil,
|
74
|
+
content_type: '',
|
75
|
+
params: {},
|
76
|
+
header_overrides: {}
|
77
|
+
)
|
78
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
79
|
+
:post,
|
80
|
+
['sheets', :sheet_id, 'rows', :row_id, 'attachments'],
|
81
|
+
body_type: :file
|
82
|
+
)
|
83
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
84
|
+
params: params,
|
85
|
+
header_overrides: header_overrides,
|
86
|
+
file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type),
|
87
|
+
sheet_id: sheet_id,
|
88
|
+
row_id: row_id
|
89
|
+
)
|
90
|
+
client.make_request(endpoint_spec, request_spec)
|
91
|
+
end
|
92
|
+
end
|
93
93
|
end
|
@@ -1,510 +1,514 @@
|
|
1
|
-
require 'smartsheet/api/endpoint_spec'
|
2
|
-
require 'smartsheet/api/request_spec'
|
3
|
-
require 'smartsheet/constants'
|
4
|
-
require 'smartsheet/error'
|
5
|
-
|
6
|
-
require 'smartsheet/endpoints/sheets/automation_rules'
|
7
|
-
require 'smartsheet/endpoints/sheets/cells'
|
8
|
-
require 'smartsheet/endpoints/sheets/columns'
|
9
|
-
require 'smartsheet/endpoints/sheets/comments'
|
10
|
-
require 'smartsheet/endpoints/sheets/cross_sheet_references'
|
11
|
-
require 'smartsheet/endpoints/sheets/discussions'
|
12
|
-
require 'smartsheet/endpoints/sheets/rows'
|
13
|
-
require 'smartsheet/endpoints/sheets/sheets_attachments'
|
14
|
-
require 'smartsheet/endpoints/sheets/
|
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
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
endpoint_spec
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
endpoint_spec
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
endpoint_spec
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
endpoint_spec
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
endpoint_spec
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
endpoint_spec
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
endpoint_spec
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
endpoint_spec
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
endpoint_spec
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
endpoint_spec
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
endpoint_spec
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
#
|
349
|
-
#
|
350
|
-
#
|
351
|
-
#
|
352
|
-
#
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
#
|
357
|
-
#
|
358
|
-
#
|
359
|
-
#
|
360
|
-
#
|
361
|
-
#
|
362
|
-
|
363
|
-
#
|
364
|
-
#
|
365
|
-
#
|
366
|
-
|
367
|
-
#
|
368
|
-
#
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
376
|
-
#
|
377
|
-
#
|
378
|
-
#
|
379
|
-
#
|
380
|
-
#
|
381
|
-
#
|
382
|
-
#
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
endpoint_spec
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
endpoint_spec
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
endpoint_spec
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
)
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
)
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
1
|
+
require 'smartsheet/api/endpoint_spec'
|
2
|
+
require 'smartsheet/api/request_spec'
|
3
|
+
require 'smartsheet/constants'
|
4
|
+
require 'smartsheet/error'
|
5
|
+
|
6
|
+
require 'smartsheet/endpoints/sheets/automation_rules'
|
7
|
+
require 'smartsheet/endpoints/sheets/cells'
|
8
|
+
require 'smartsheet/endpoints/sheets/columns'
|
9
|
+
require 'smartsheet/endpoints/sheets/comments'
|
10
|
+
require 'smartsheet/endpoints/sheets/cross_sheet_references'
|
11
|
+
require 'smartsheet/endpoints/sheets/discussions'
|
12
|
+
require 'smartsheet/endpoints/sheets/rows'
|
13
|
+
require 'smartsheet/endpoints/sheets/sheets_attachments'
|
14
|
+
require 'smartsheet/endpoints/sheets/sheets_summaries'
|
15
|
+
require 'smartsheet/endpoints/sheets/sheets_share'
|
16
|
+
|
17
|
+
module Smartsheet
|
18
|
+
# Sheets Endpoints
|
19
|
+
# @see https://smartsheet-platform.github.io/api-docs/?ruby#sheets API Sheets Docs
|
20
|
+
#
|
21
|
+
# @!attribute [r] attachments
|
22
|
+
# @return [SheetsAttachments]
|
23
|
+
# @!attribute [r] automation_rules
|
24
|
+
# @return [AutomationRules]
|
25
|
+
# @!attribute [r] cells
|
26
|
+
# @return [Cells]
|
27
|
+
# @!attribute [r] columns
|
28
|
+
# @return [Columns]
|
29
|
+
# @!attribute [r] comments
|
30
|
+
# @return [Comments]
|
31
|
+
# @!attribute [r] cross_sheet_references
|
32
|
+
# @return [CrossSheetReferences]
|
33
|
+
# @!attribute [r] discussions
|
34
|
+
# @return [Discussions]
|
35
|
+
# @!attribute [r] summaries
|
36
|
+
# @return [Summaries]
|
37
|
+
# @!attribute [r] rows
|
38
|
+
# @return [Rows]
|
39
|
+
# @!attribute [r] share
|
40
|
+
# @return [SheetsShare]
|
41
|
+
class Sheets
|
42
|
+
include Smartsheet::Constants
|
43
|
+
|
44
|
+
attr_reader :client, :attachments, :automation_rules, :cells, :columns, :comments,
|
45
|
+
:cross_sheet_references, :discussions, :summaries, :rows, :share
|
46
|
+
private :client
|
47
|
+
|
48
|
+
def initialize(client)
|
49
|
+
@client = client
|
50
|
+
|
51
|
+
@attachments = SheetsAttachments.new(client)
|
52
|
+
@automation_rules = AutomationRules.new(client)
|
53
|
+
@cells = Cells.new(client)
|
54
|
+
@columns = Columns.new(client)
|
55
|
+
@comments = Comments.new(client)
|
56
|
+
@cross_sheet_references = CrossSheetReferences.new(client)
|
57
|
+
@discussions = Discussions.new(client)
|
58
|
+
@summaries = SheetsSummaries.new(client)
|
59
|
+
@rows = Rows.new(client)
|
60
|
+
@share = SheetsShare.new(client)
|
61
|
+
end
|
62
|
+
|
63
|
+
def list(params: {}, header_overrides: {})
|
64
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets'])
|
65
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
66
|
+
params: params,
|
67
|
+
header_overrides: header_overrides
|
68
|
+
)
|
69
|
+
client.make_request(endpoint_spec, request_spec)
|
70
|
+
end
|
71
|
+
|
72
|
+
def get(sheet_id:, params: {}, header_overrides: {})
|
73
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id])
|
74
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
75
|
+
params: params,
|
76
|
+
header_overrides: header_overrides,
|
77
|
+
sheet_id: sheet_id
|
78
|
+
)
|
79
|
+
client.make_request(endpoint_spec, request_spec)
|
80
|
+
end
|
81
|
+
|
82
|
+
def get_version(sheet_id:, params: {}, header_overrides: {})
|
83
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:get, ['sheets', :sheet_id, 'version'])
|
84
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
85
|
+
params: params,
|
86
|
+
header_overrides: header_overrides,
|
87
|
+
sheet_id: sheet_id
|
88
|
+
)
|
89
|
+
client.make_request(endpoint_spec, request_spec)
|
90
|
+
end
|
91
|
+
|
92
|
+
def get_as_excel(sheet_id:, params: {}, header_overrides: {})
|
93
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
94
|
+
:get,
|
95
|
+
['sheets', :sheet_id],
|
96
|
+
headers: {Accept: EXCEL_TYPE}
|
97
|
+
)
|
98
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
99
|
+
params: params,
|
100
|
+
header_overrides: header_overrides,
|
101
|
+
sheet_id: sheet_id
|
102
|
+
)
|
103
|
+
client.make_request(endpoint_spec, request_spec)
|
104
|
+
end
|
105
|
+
|
106
|
+
def get_as_pdf(sheet_id:, params: {}, header_overrides: {})
|
107
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
108
|
+
:get,
|
109
|
+
['sheets', :sheet_id],
|
110
|
+
headers: {Accept: PDF_TYPE}
|
111
|
+
)
|
112
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
113
|
+
params: params,
|
114
|
+
header_overrides: header_overrides,
|
115
|
+
sheet_id: sheet_id
|
116
|
+
)
|
117
|
+
client.make_request(endpoint_spec, request_spec)
|
118
|
+
end
|
119
|
+
|
120
|
+
def get_as_csv(sheet_id:, params: {}, header_overrides: {})
|
121
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
122
|
+
:get,
|
123
|
+
['sheets', :sheet_id],
|
124
|
+
headers: {Accept: CSV_TYPE}
|
125
|
+
)
|
126
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
127
|
+
params: params,
|
128
|
+
header_overrides: header_overrides,
|
129
|
+
sheet_id: sheet_id
|
130
|
+
)
|
131
|
+
client.make_request(endpoint_spec, request_spec)
|
132
|
+
end
|
133
|
+
|
134
|
+
def create(body:, params: {}, header_overrides: {})
|
135
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
136
|
+
:post,
|
137
|
+
['sheets'],
|
138
|
+
body_type: :json
|
139
|
+
)
|
140
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
141
|
+
params: params,
|
142
|
+
header_overrides: header_overrides,
|
143
|
+
body: body
|
144
|
+
)
|
145
|
+
client.make_request(endpoint_spec, request_spec)
|
146
|
+
end
|
147
|
+
|
148
|
+
def create_in_folder(folder_id:, body:, params: {}, header_overrides: {})
|
149
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
150
|
+
:post,
|
151
|
+
['folders', :folder_id, 'sheets'],
|
152
|
+
body_type: :json
|
153
|
+
)
|
154
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
155
|
+
params: params,
|
156
|
+
header_overrides: header_overrides,
|
157
|
+
body: body,
|
158
|
+
folder_id: folder_id
|
159
|
+
)
|
160
|
+
client.make_request(endpoint_spec, request_spec)
|
161
|
+
end
|
162
|
+
|
163
|
+
def create_in_workspace(workspace_id:, body:, params: {}, header_overrides: {})
|
164
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
165
|
+
:post,
|
166
|
+
['workspaces', :workspace_id, 'sheets'],
|
167
|
+
body_type: :json
|
168
|
+
)
|
169
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
170
|
+
params: params,
|
171
|
+
header_overrides: header_overrides,
|
172
|
+
body: body,
|
173
|
+
workspace_id: workspace_id
|
174
|
+
)
|
175
|
+
client.make_request(endpoint_spec, request_spec)
|
176
|
+
end
|
177
|
+
|
178
|
+
def create_from_template(body:, params: {}, header_overrides: {})
|
179
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
180
|
+
:post,
|
181
|
+
['sheets'],
|
182
|
+
body_type: :json
|
183
|
+
)
|
184
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
185
|
+
params: params,
|
186
|
+
header_overrides: header_overrides,
|
187
|
+
body: body
|
188
|
+
)
|
189
|
+
client.make_request(endpoint_spec, request_spec)
|
190
|
+
end
|
191
|
+
|
192
|
+
def create_in_folder_from_template(folder_id:, body:, params: {}, header_overrides: {})
|
193
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
194
|
+
:post,
|
195
|
+
['folders', :folder_id, 'sheets'],
|
196
|
+
body_type: :json
|
197
|
+
)
|
198
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
199
|
+
params: params,
|
200
|
+
header_overrides: header_overrides,
|
201
|
+
body: body,
|
202
|
+
folder_id: folder_id
|
203
|
+
)
|
204
|
+
client.make_request(endpoint_spec, request_spec)
|
205
|
+
end
|
206
|
+
|
207
|
+
def create_in_workspace_from_template(workspace_id:, body:, params: {}, header_overrides: {})
|
208
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
209
|
+
:post,
|
210
|
+
['workspaces', :workspace_id, 'sheets'],
|
211
|
+
body_type: :json
|
212
|
+
)
|
213
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
214
|
+
params: params,
|
215
|
+
header_overrides: header_overrides,
|
216
|
+
body: body,
|
217
|
+
workspace_id: workspace_id
|
218
|
+
)
|
219
|
+
client.make_request(endpoint_spec, request_spec)
|
220
|
+
end
|
221
|
+
|
222
|
+
def import_from_file(file:, file_type:, file_length:, params: {}, header_overrides: {})
|
223
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
224
|
+
:post,
|
225
|
+
['sheets', 'import'],
|
226
|
+
body_type: :file
|
227
|
+
)
|
228
|
+
content_type = file_type_to_content_type(file_type)
|
229
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
230
|
+
params: params,
|
231
|
+
header_overrides: header_overrides,
|
232
|
+
file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
|
233
|
+
)
|
234
|
+
client.make_request(endpoint_spec, request_spec)
|
235
|
+
end
|
236
|
+
|
237
|
+
def import_from_file_path(path:, file_type:, params: {}, header_overrides: {})
|
238
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
239
|
+
:post,
|
240
|
+
['sheets', 'import'],
|
241
|
+
body_type: :file
|
242
|
+
)
|
243
|
+
content_type = file_type_to_content_type(file_type)
|
244
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
245
|
+
params: params,
|
246
|
+
header_overrides: header_overrides,
|
247
|
+
file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
|
248
|
+
)
|
249
|
+
client.make_request(endpoint_spec, request_spec)
|
250
|
+
end
|
251
|
+
|
252
|
+
def import_from_file_into_folder(
|
253
|
+
folder_id:,
|
254
|
+
file:,
|
255
|
+
file_type:,
|
256
|
+
file_length:,
|
257
|
+
params: {},
|
258
|
+
header_overrides: {}
|
259
|
+
)
|
260
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
261
|
+
:post,
|
262
|
+
['folders', :folder_id, 'sheets', 'import'],
|
263
|
+
body_type: :file
|
264
|
+
)
|
265
|
+
content_type = file_type_to_content_type(file_type)
|
266
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
267
|
+
params: params,
|
268
|
+
header_overrides: header_overrides,
|
269
|
+
file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
|
270
|
+
folder_id: folder_id
|
271
|
+
)
|
272
|
+
client.make_request(endpoint_spec, request_spec)
|
273
|
+
end
|
274
|
+
|
275
|
+
def import_from_file_path_into_folder(
|
276
|
+
folder_id:,
|
277
|
+
path:,
|
278
|
+
file_type:,
|
279
|
+
params: {},
|
280
|
+
header_overrides: {}
|
281
|
+
)
|
282
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
283
|
+
:post,
|
284
|
+
['folders', :folder_id, 'sheets', 'import'],
|
285
|
+
body_type: :file
|
286
|
+
)
|
287
|
+
content_type = file_type_to_content_type(file_type)
|
288
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
289
|
+
params: params,
|
290
|
+
header_overrides: header_overrides,
|
291
|
+
file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
|
292
|
+
folder_id: folder_id
|
293
|
+
)
|
294
|
+
client.make_request(endpoint_spec, request_spec)
|
295
|
+
end
|
296
|
+
|
297
|
+
def import_from_file_into_workspace(
|
298
|
+
workspace_id:,
|
299
|
+
file:,
|
300
|
+
file_type:,
|
301
|
+
file_length:,
|
302
|
+
params: {},
|
303
|
+
header_overrides: {}
|
304
|
+
)
|
305
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
306
|
+
:post,
|
307
|
+
['workspaces', :workspace_id, 'sheets', 'import'],
|
308
|
+
body_type: :file
|
309
|
+
)
|
310
|
+
content_type = file_type_to_content_type(file_type)
|
311
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
312
|
+
params: params,
|
313
|
+
header_overrides: header_overrides,
|
314
|
+
file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type),
|
315
|
+
workspace_id: workspace_id
|
316
|
+
)
|
317
|
+
client.make_request(endpoint_spec, request_spec)
|
318
|
+
end
|
319
|
+
|
320
|
+
def import_from_file_path_into_workspace(
|
321
|
+
workspace_id:,
|
322
|
+
path:,
|
323
|
+
file_type:,
|
324
|
+
params: {},
|
325
|
+
header_overrides: {}
|
326
|
+
)
|
327
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
328
|
+
:post,
|
329
|
+
['workspaces', :workspace_id, 'sheets', 'import'],
|
330
|
+
body_type: :file
|
331
|
+
)
|
332
|
+
content_type = file_type_to_content_type(file_type)
|
333
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
334
|
+
params: params,
|
335
|
+
header_overrides: header_overrides,
|
336
|
+
file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type),
|
337
|
+
workspace_id: workspace_id
|
338
|
+
)
|
339
|
+
client.make_request(endpoint_spec, request_spec)
|
340
|
+
end
|
341
|
+
|
342
|
+
### These endpoints are not yet implemented; these endpoints can be re-included once they are
|
343
|
+
### active
|
344
|
+
|
345
|
+
# def import_and_replace_sheet_from_file(
|
346
|
+
# sheet_id:,
|
347
|
+
# file:,
|
348
|
+
# file_type:,
|
349
|
+
# file_length:,
|
350
|
+
# params: {},
|
351
|
+
# header_overrides: {}
|
352
|
+
# )
|
353
|
+
# endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
354
|
+
# :post,
|
355
|
+
# ['sheets', :sheet_id, 'import'],
|
356
|
+
# body_type: :file
|
357
|
+
# )
|
358
|
+
# content_type = file_type_to_content_type(file_type)
|
359
|
+
# request_spec = Smartsheet::API::RequestSpec.new(
|
360
|
+
# params: params,
|
361
|
+
# header_overrides: header_overrides,
|
362
|
+
# file_spec: Smartsheet::API::ImportObjectFileSpec.new(file, file_length, content_type)
|
363
|
+
# )
|
364
|
+
# client.make_request(endpoint_spec, request_spec)
|
365
|
+
# end
|
366
|
+
|
367
|
+
# def import_and_replace_sheet_from_file_path(
|
368
|
+
# sheet_id:,
|
369
|
+
# path:,
|
370
|
+
# file_type:,
|
371
|
+
# params: {},
|
372
|
+
# header_overrides: {}
|
373
|
+
# )
|
374
|
+
# endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
375
|
+
# :post,
|
376
|
+
# ['sheets', :sheet_id, 'import'],
|
377
|
+
# body_type: :file
|
378
|
+
# )
|
379
|
+
# content_type = file_type_to_content_type(file_type)
|
380
|
+
# request_spec = Smartsheet::API::RequestSpec.new(
|
381
|
+
# params: params,
|
382
|
+
# header_overrides: header_overrides,
|
383
|
+
# file_spec: Smartsheet::API::ImportPathFileSpec.new(path, content_type)
|
384
|
+
# )
|
385
|
+
# client.make_request(endpoint_spec, request_spec)
|
386
|
+
# end
|
387
|
+
|
388
|
+
def copy(sheet_id:, body:, params: {}, header_overrides: {})
|
389
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
390
|
+
:post,
|
391
|
+
['sheets', :sheet_id, 'copy'],
|
392
|
+
body_type: :json
|
393
|
+
)
|
394
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
395
|
+
params: params,
|
396
|
+
header_overrides: header_overrides,
|
397
|
+
body: body,
|
398
|
+
sheet_id: sheet_id
|
399
|
+
)
|
400
|
+
client.make_request(endpoint_spec, request_spec)
|
401
|
+
end
|
402
|
+
|
403
|
+
def move(sheet_id:, body:, params: {}, header_overrides: {})
|
404
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
405
|
+
:post,
|
406
|
+
['sheets', :sheet_id, 'move'],
|
407
|
+
body_type: :json
|
408
|
+
)
|
409
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
410
|
+
params: params,
|
411
|
+
header_overrides: header_overrides,
|
412
|
+
body: body,
|
413
|
+
sheet_id: sheet_id
|
414
|
+
)
|
415
|
+
client.make_request(endpoint_spec, request_spec)
|
416
|
+
end
|
417
|
+
|
418
|
+
def update(sheet_id:, body:, params: {}, header_overrides: {})
|
419
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
420
|
+
:put,
|
421
|
+
['sheets', :sheet_id],
|
422
|
+
body_type: :json
|
423
|
+
)
|
424
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
425
|
+
params: params,
|
426
|
+
header_overrides: header_overrides,
|
427
|
+
body: body,
|
428
|
+
sheet_id: sheet_id
|
429
|
+
)
|
430
|
+
client.make_request(endpoint_spec, request_spec)
|
431
|
+
end
|
432
|
+
|
433
|
+
def delete(sheet_id:, params: {}, header_overrides: {})
|
434
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(
|
435
|
+
:delete,
|
436
|
+
['sheets', :sheet_id]
|
437
|
+
)
|
438
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
439
|
+
params: params,
|
440
|
+
header_overrides: header_overrides,
|
441
|
+
sheet_id: sheet_id
|
442
|
+
)
|
443
|
+
client.make_request(endpoint_spec, request_spec)
|
444
|
+
end
|
445
|
+
|
446
|
+
def list_for_org(params: {}, header_overrides: {})
|
447
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:get,['users', 'sheets'])
|
448
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
449
|
+
header_overrides: header_overrides,
|
450
|
+
params: params
|
451
|
+
)
|
452
|
+
client.make_request(endpoint_spec, request_spec)
|
453
|
+
end
|
454
|
+
|
455
|
+
def get_publish_status(sheet_id:, params: {}, header_overrides: {})
|
456
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:get,['sheets', :sheet_id, 'publish'])
|
457
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
458
|
+
params: params,
|
459
|
+
header_overrides: header_overrides,
|
460
|
+
sheet_id: sheet_id
|
461
|
+
)
|
462
|
+
client.make_request(endpoint_spec, request_spec)
|
463
|
+
end
|
464
|
+
|
465
|
+
def set_publish_status(sheet_id:, body:, params: {}, header_overrides: {})
|
466
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:put,['sheets', :sheet_id, 'publish'], body_type: :json)
|
467
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
468
|
+
params: params,
|
469
|
+
header_overrides: header_overrides,
|
470
|
+
body: body,
|
471
|
+
sheet_id: sheet_id
|
472
|
+
)
|
473
|
+
client.make_request(endpoint_spec, request_spec)
|
474
|
+
end
|
475
|
+
|
476
|
+
def send_via_email(sheet_id:, body:, params: {}, header_overrides: {})
|
477
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post,['sheets', :sheet_id, 'emails'], body_type: :json)
|
478
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
479
|
+
params: params,
|
480
|
+
header_overrides: header_overrides,
|
481
|
+
body: body,
|
482
|
+
sheet_id: sheet_id
|
483
|
+
)
|
484
|
+
client.make_request(endpoint_spec, request_spec)
|
485
|
+
end
|
486
|
+
|
487
|
+
def list_image_urls(body:, params: {}, header_overrides: {})
|
488
|
+
endpoint_spec = Smartsheet::API::EndpointSpec.new(:post,['imageurls'], body_type: :json)
|
489
|
+
request_spec = Smartsheet::API::RequestSpec.new(
|
490
|
+
params: params,
|
491
|
+
header_overrides: header_overrides,
|
492
|
+
body: body
|
493
|
+
)
|
494
|
+
client.make_request(endpoint_spec, request_spec)
|
495
|
+
end
|
496
|
+
|
497
|
+
private
|
498
|
+
|
499
|
+
def file_type_to_content_type(file_type)
|
500
|
+
mapping = {
|
501
|
+
csv: Constants::CSV_TYPE,
|
502
|
+
xlsx: Constants::OPENXML_SPREADSHEET_TYPE
|
503
|
+
}
|
504
|
+
|
505
|
+
mapping.fetch(file_type) do |_|
|
506
|
+
available_types = mapping.keys.join(', ')
|
507
|
+
|
508
|
+
raise Smartsheet::Error.new(
|
509
|
+
"Unsupported file type: #{file_type}\nValid types: #{available_types}"
|
510
|
+
)
|
511
|
+
end
|
512
|
+
end
|
513
|
+
end
|
514
|
+
end
|