Class: Smartsheet::API::BodyBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/smartsheet/api/body_builder.rb

Overview

Constructs bodies for accessing the Smartsheet API

Instance Method Summary collapse

Constructor Details

#initialize(endpoint_spec, request_spec) ⇒ BodyBuilder

Returns a new instance of BodyBuilder.



5
6
7
8
# File 'lib/smartsheet/api/body_builder.rb', line 5

def initialize(endpoint_spec, request_spec)
  @endpoint_spec = endpoint_spec
  @request_spec = request_spec
end

Instance Method Details

#buildObject



10
11
12
13
14
15
16
17
18
# File 'lib/smartsheet/api/body_builder.rb', line 10

def build
  if endpoint_spec.sending_json?
    request_spec.json_body
  elsif endpoint_spec.sending_file?
    request_spec.file_body
  else
    request_spec.body
  end
end