Sha256: 2405d99e97dcb2905bcd67d50c446ef065749407dffedfbb5d71aa65742e78bd

Contents?: true

Size: 662 Bytes

Versions: 2

Compression:

Stored size: 662 Bytes

Contents

require_relative 'url_builder'

module Smartsheet
  module API
    class EndpointSpec
      attr_reader :method, :url_segments, :spec

      def initialize(method, url, **spec)
        @method = method
        @url_segments = url
        @spec = spec
      end

      def requires_auth?
        !spec.key?(:no_auth)
      end

      def requires_body?
        spec.key? :body_type
      end

      def sending_file?
        requires_body? && spec[:body_type] == :file
      end

      def sending_json?
        requires_body? && spec[:body_type] == :json
      end

      def headers
        spec.key?(:headers) ? spec[:headers] : {}
      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/endpoint_spec.rb
smartsheet-1.0.0.beta.0 lib/smartsheet/api/endpoint_spec.rb