Class: Smartsheet::API::HeaderBuilder

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/smartsheet/api/header_builder.rb

Overview

Constructs headers for accessing the Smartsheet API

Constant Summary

Constants included from Constants

Constants::API_URL, Constants::CSV_TYPE, Constants::DEFAULT_BACKOFF_METHOD, Constants::DEFAULT_MAX_RETRY_TIME, Constants::EXCEL_TYPE, Constants::JSON_TYPE, Constants::OPENXML_SPREADSHEET_TYPE, Constants::PDF_TYPE, Constants::USER_AGENT, Constants::VERSION

Instance Method Summary collapse

Constructor Details

#initialize(token, endpoint_spec, request_spec, app_user_agent: nil, assume_user: nil) ⇒ HeaderBuilder

Returns a new instance of HeaderBuilder.



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

def initialize(token, endpoint_spec, request_spec, app_user_agent: nil, assume_user: nil)
  @token = token
  @endpoint_spec = endpoint_spec
  @request_spec = request_spec
  @app_user_agent = app_user_agent
  @assume_user = assume_user
end

Instance Method Details

#buildObject



18
19
20
21
22
23
24
25
26
# File 'lib/smartsheet/api/header_builder.rb', line 18

def build
  base_headers
      .merge(assume_user)
      .merge(endpoint_headers)
      .merge(content_type)
      .merge(content_disposition)
      .merge(content_length)
      .merge(request_headers)
end