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

Simple   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 38
Duplicated Lines 0 %
Metric Value
wmc 11
dl 0
loc 38
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
F initialize() 0 36 11
A url() 0 3 1
A content_type() 0 4 3
A headers() 0 3 1
A method() 0 3 1
A body() 0 3 1
A params() 0 3 1
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