Class: Http2::BaseRequest
- Inherits:
-
Object
- Object
- Http2::BaseRequest
- Defined in:
- lib/http2/base_request.rb
Direct Known Subclasses
Constant Summary collapse
- VALID_ARGUMENTS_POST =
[:post, :url, :default_headers, :headers, :json, :method, :cookies, :on_content, :content_type].freeze
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#debug ⇒ Object
readonly
Returns the value of attribute debug.
-
#http2 ⇒ Object
readonly
Returns the value of attribute http2.
Instance Method Summary collapse
-
#initialize(http2, args) ⇒ BaseRequest
constructor
A new instance of BaseRequest.
- #path ⇒ Object
Constructor Details
#initialize(http2, args) ⇒ BaseRequest
Returns a new instance of BaseRequest.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/http2/base_request.rb', line 6 def initialize(http2, args) @http2 = http2 @args = http2.parse_args(args) @debug = http2.debug @nl = http2.nl @args.each_key do |key| raise "Invalid key: '#{key}'." unless VALID_ARGUMENTS_POST.include?(key) end @conn = @http2.connection end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
2 3 4 |
# File 'lib/http2/base_request.rb', line 2 def args @args end |
#debug ⇒ Object (readonly)
Returns the value of attribute debug.
2 3 4 |
# File 'lib/http2/base_request.rb', line 2 def debug @debug end |
#http2 ⇒ Object (readonly)
Returns the value of attribute http2.
2 3 4 |
# File 'lib/http2/base_request.rb', line 2 def http2 @http2 end |
Instance Method Details
#path ⇒ Object
19 20 21 |
# File 'lib/http2/base_request.rb', line 19 def path @args.fetch(:url) end |