Class: Smartsheet::API::Request

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

Overview

Full specification for a single request to an endpoint

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Request.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/smartsheet/api/request.rb', line 11

def initialize(
    token,
    endpoint_spec,
    request_spec,
    base_url,
    app_user_agent: nil,
    assume_user: nil
)
  @method = endpoint_spec.method
  @url = Smartsheet::API::UrlBuilder.new(endpoint_spec, request_spec, base_url).build
  @headers = Smartsheet::API::HeaderBuilder.new(
    token,
    endpoint_spec,
    request_spec,
    app_user_agent: app_user_agent,
    assume_user: assume_user
  ).build
  @params = request_spec.params
  @body = Smartsheet::API::BodyBuilder.new(endpoint_spec, request_spec).build
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



9
10
11
# File 'lib/smartsheet/api/request.rb', line 9

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



9
10
11
# File 'lib/smartsheet/api/request.rb', line 9

def headers
  @headers
end

#methodObject (readonly)

Returns the value of attribute method.



9
10
11
# File 'lib/smartsheet/api/request.rb', line 9

def method
  @method
end

#paramsObject (readonly)

Returns the value of attribute params.



9
10
11
# File 'lib/smartsheet/api/request.rb', line 9

def params
  @params
end

#urlObject (readonly)

Returns the value of attribute url.



9
10
11
# File 'lib/smartsheet/api/request.rb', line 9

def url
  @url
end

Instance Method Details

#==(other) ⇒ Object



32
33
34
# File 'lib/smartsheet/api/request.rb', line 32

def ==(other)
  other.class == self.class && other.equality_state == equality_state
end