Sha256: 8d912dab2a26bf3183da3ae5a7a880ff0fa715f4cb2122aac5140ed189b2ed00

Contents?: true

Size: 916 Bytes

Versions: 2

Compression:

Stored size: 916 Bytes

Contents

require 'smartsheet/api/url_builder'
require 'smartsheet/api/header_builder'
require 'smartsheet/api/body_builder'

module Smartsheet
  module API
    class Request
      attr_reader :method, :url, :headers, :params, :body

      def initialize(token, endpoint_spec, request_spec, base_url, 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, assume_user: assume_user).build
        @params = request_spec.params
        @body = Smartsheet::API::BodyBuilder.new(endpoint_spec, request_spec).build
      end

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

      protected

      def equality_state
        [method, url, headers, params, body]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smartsheet-1.0.0.beta.2 lib/smartsheet/api/request.rb
smartsheet-1.0.0.beta.0 lib/smartsheet/api/request.rb