Class: RingCentralSdk::REST::Request::Simple

Inherits:
Base
  • Object
show all
Defined in:
lib/ringcentral_sdk/rest/request/simple.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Simple

Returns a new instance of Simple.



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 3

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

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

  def method
    @method
  end

  def url
    @url
  end

  def params
    @params
  end

  def headers
    @headers
  end

  def body
    @body
  end
end

Instance Method Details

#bodyObject



35
36
37
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 35

def body
  @body
end

#content_typeObject



14
15
16
17
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 14

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

#headersObject



31
32
33
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 31

def headers
  @headers
end

#methodObject



19
20
21
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 19

def method
  @method
end

#paramsObject



27
28
29
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 27

def params
  @params
end

#urlObject



23
24
25
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 23

def url
  @url
end