Total Complexity | 11 |
Total Lines | 38 |
Duplicated Lines | 0 % |
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 |
||
41 |