Module: Smartsheet::GeneralRequest
- Included in:
- Client
- Defined in:
- lib/smartsheet/general_request.rb
Instance Method Summary collapse
-
#request(method:, url_path:, body: nil, params: {}, header_overrides: {}) ⇒ Object
Create a custom request using a provided method and URL path.
-
#request_with_file(method:, url_path:, file:, file_length:, filename:, content_type: '', params: {}, header_overrides: {}) ⇒ Object
Create a custom request using a provided method, URL path, and file details.
-
#request_with_file_from_path(method:, url_path:, path:, filename: nil, content_type: '', params: {}, header_overrides: {}) ⇒ Object
Create a custom request using a provided method, URL path, and filepath details.
Instance Method Details
#request(method:, url_path:, body: nil, params: {}, header_overrides: {}) ⇒ Object
Create a custom request using a provided method and URL path
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/smartsheet/general_request.rb', line 8 def request(method:, url_path:, body: nil, params: {}, header_overrides: {}) spec = body.nil? ? {} : {body_type: :json} endpoint_spec = Smartsheet::API::EndpointSpec.new(method, [url_path], **spec) request_spec = Smartsheet::API::RequestSpec.new( header_overrides: header_overrides, body: body, params: params ) client.make_request(endpoint_spec, request_spec) end |
#request_with_file(method:, url_path:, file:, file_length:, filename:, content_type: '', params: {}, header_overrides: {}) ⇒ Object
Create a custom request using a provided method, URL path, and file details
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/smartsheet/general_request.rb', line 29 def request_with_file( method:, url_path:, file:, file_length:, filename:, content_type: '', params: {}, header_overrides: {} ) endpoint_spec = Smartsheet::API::EndpointSpec.new(method, [url_path], body_type: :file) request_spec = Smartsheet::API::RequestSpec.new( header_overrides: header_overrides, params: params, file_spec: Smartsheet::API::ObjectFileSpec.new(file, filename, file_length, content_type) ) client.make_request(endpoint_spec, request_spec) end |
#request_with_file_from_path(method:, url_path:, path:, filename: nil, content_type: '', params: {}, header_overrides: {}) ⇒ Object
Create a custom request using a provided method, URL path, and filepath details
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/smartsheet/general_request.rb', line 57 def request_with_file_from_path( method:, url_path:, path:, filename: nil, content_type: '', params: {}, header_overrides: {} ) endpoint_spec = Smartsheet::API::EndpointSpec.new(method, [url_path], body_type: :file) request_spec = Smartsheet::API::RequestSpec.new( header_overrides: header_overrides, params: params, file_spec: Smartsheet::API::PathFileSpec.new(path, filename, content_type) ) client.make_request(endpoint_spec, request_spec) end |