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.
14 15 16 17 18 19 |
# File 'lib/drip/request.rb', line 14 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.
5 6 7 |
# File 'lib/drip/request.rb', line 5 def content_type @content_type end |
#http_verb ⇒ Object (readonly)
Returns the value of attribute http_verb.
5 6 7 |
# File 'lib/drip/request.rb', line 5 def http_verb @http_verb end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/drip/request.rb', line 5 def @options end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/drip/request.rb', line 5 def url @url end |
Instance Method Details
#body ⇒ Object
25 26 27 28 29 |
# File 'lib/drip/request.rb', line 25 def body return if http_verb == :get .to_json end |
#verb_klass ⇒ Object
21 22 23 |
# File 'lib/drip/request.rb', line 21 def verb_klass VERB_CLASS_MAPPING[http_verb] end |