Class: Drip::Request
- Inherits:
-
Object
- Object
- Drip::Request
- Defined in:
- lib/drip/request.rb
Constant Summary collapse
- VERB_CLASS_MAPPING =
{ get: Net::HTTP::Get, post: Net::HTTP::Post, put: Net::HTTP::Put, delete: Net::HTTP::Delete }.freeze
Instance Attribute Summary collapse
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#http_verb ⇒ Object
readonly
Returns the value of attribute http_verb.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(http_verb, url, options = {}, content_type = nil) ⇒ Request
constructor
A new instance of Request.
- #verb_klass ⇒ Object
Constructor Details
#initialize(http_verb, url, options = {}, content_type = nil) ⇒ Request
Returns a new instance of Request.
16 17 18 19 20 21 |
# File 'lib/drip/request.rb', line 16 def initialize(http_verb, url, = {}, content_type = nil) @http_verb = http_verb @url = url @options = @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
7 8 9 |
# File 'lib/drip/request.rb', line 7 def content_type @content_type end |
#http_verb ⇒ Object (readonly)
Returns the value of attribute http_verb.
7 8 9 |
# File 'lib/drip/request.rb', line 7 def http_verb @http_verb end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/drip/request.rb', line 7 def @options end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
7 8 9 |
# File 'lib/drip/request.rb', line 7 def url @url end |
Instance Method Details
#body ⇒ Object
27 28 29 30 31 |
# File 'lib/drip/request.rb', line 27 def body return if http_verb == :get .to_json end |
#verb_klass ⇒ Object
23 24 25 |
# File 'lib/drip/request.rb', line 23 def verb_klass VERB_CLASS_MAPPING[http_verb] end |