Completed
Push — master ( 665158...0a74c8 )
by John
01:17
created

Simple.url()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 3
rs 10
1
module RingCentralSdk::REST::Request
2
  class Simple < RingCentralSdk::REST::Request::Base
3
    def initialize(opts = {})
4
      @method = opts[:method]
5
      @url = opts[:url]
6
      @params = opts[:params]
7
      @headers = opts[:headers]
8
      @body = opts[:body].nil? ? {} : opts[:body]
9
      if @body.is_a? Hash 
10
        @headers = {} unless @headers.is_a? Hash 
11
        @headers['Content-Type'] = 'application/json'
12
      end
13
14
      def content_type
15
        ct = @headers.is_a?(Hash) \
16
          ? @headers['Content-Type'] || '' : 'application/json'
17
      end
18
19
      def method
20
        @method
21
      end
22
23
      def url
24
        @url
25
      end
26
27
      def params
28
        @params
29
      end
30
31
      def headers
32
        @headers
33
      end
34
35
      def body
36
        @body
37
      end
38
    end
39
  end
40
end
41