Sha256: 84719f148801f927fb6ce76aa1b24f0aad2230847c4775fbf63b515ccbbaecfa

Contents?: true

Size: 556 Bytes

Versions: 2

Compression:

Stored size: 556 Bytes

Contents

require 'smartsheet/constants'

module Smartsheet
  module API
    # Methods for building Smartsheet API URLs
    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

2 entries across 2 versions & 1 rubygems

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