Sha256: 6f9ffd0168943128a53c17cc9eb0ecd505c2beacd7217b3c160e717976c712e9

Contents?: true

Size: 837 Bytes

Versions: 12

Compression:

Stored size: 837 Bytes

Contents

module RingCentralSdk
  module REST
    module Request
      # Simple is a generic simple request class.
      class Simple < RingCentralSdk::REST::Request::Base
        attr_reader :method
        attr_reader :url
        attr_reader :params
        attr_reader :headers
        attr_reader :body

        def initialize(opts = {})
          @method = opts[:method]
          @url = opts[:url]
          @params = opts[:params]
          @headers = opts[:headers]
          @body = opts[:body].nil? ? {} : opts[:body]
          if @body.is_a? Hash
            @headers = {} unless @headers.is_a? Hash
            @headers['Content-Type'] = 'application/json'
          end
        end

        def content_type
          @headers.is_a?(Hash) ? @headers['Content-Type'] || '' : 'application/json'
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ringcentral_sdk-3.1.0 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-3.0.1 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-3.0.0 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.3.0 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.2.3 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.2.2 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.2.1 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.1.0 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.0.3 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.0.2 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.0.1 lib/ringcentral_sdk/rest/request/simple.rb
ringcentral_sdk-2.0.0 lib/ringcentral_sdk/rest/request/simple.rb