Sha256: 6f36e68a6f9027f81382103c1ebba79879337d842df5140e752679858836e5c1

Contents?: true

Size: 578 Bytes

Versions: 6

Compression:

Stored size: 578 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

6 entries across 6 versions & 1 rubygems

Version Path
smartsheet-2.101.1 lib/smartsheet/api/url_builder.rb
smartsheet-2.101.0 lib/smartsheet/api/url_builder.rb
smartsheet-2.86.1 lib/smartsheet/api/url_builder.rb
smartsheet-2.86.0 lib/smartsheet/api/url_builder.rb
smartsheet-2.77.2 lib/smartsheet/api/url_builder.rb
smartsheet-1.0.0 lib/smartsheet/api/url_builder.rb