Class: RingCentralSdk::REST::Request::Simple
- Defined in:
- lib/ringcentral_sdk/rest/request/simple.rb
Overview
Simple is a generic simple request class.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(opts = {}) ⇒ Simple
constructor
A new instance of Simple.
Constructor Details
#initialize(opts = {}) ⇒ Simple
Returns a new instance of Simple.
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 12 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 |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
10 11 12 |
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 10 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
9 10 11 |
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 9 def headers @headers end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
6 7 8 |
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 6 def method @method end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
8 9 10 |
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 8 def params @params end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 7 def url @url end |
Instance Method Details
#content_type ⇒ Object
24 25 26 |
# File 'lib/ringcentral_sdk/rest/request/simple.rb', line 24 def content_type @headers.is_a?(Hash) ? @headers['Content-Type'] || '' : 'application/json' end |