Sha256: c680675ace0dd44c7b138f27a57bbe9f1a2eb6b585c70b155bf85be94dec70e6

Contents?: true

Size: 603 Bytes

Versions: 4

Compression:

Stored size: 603 Bytes

Contents

require 'smartsheet/constants'

module Smartsheet
  module API
    # Constructs parameterized URLs for accessing the Smartsheet API
    class UrlBuilder
      def initialize(endpoint_spec, request_spec, base_url)
        @segments = endpoint_spec.url_segments
        @args = request_spec.url_args
        @base_url = base_url
      end

      def build
        segments
          .collect { |seg| seg.is_a?(Symbol) ? args[seg] : seg }
          .unshift(base_url)
          .join('/')
      end

      private

      attr_accessor :segments, :args, :base_url
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
smartsheet-2.77.0 lib/smartsheet/api/url_builder.rb
smartsheet-1.3.0 lib/smartsheet/api/url_builder.rb
smartsheet-1.2.0 lib/smartsheet/api/url_builder.rb
smartsheet-1.1.0 lib/smartsheet/api/url_builder.rb