Class: Cassette::Http::Request
- Inherits:
-
Object
- Object
- Cassette::Http::Request
- Defined in:
- lib/cassette/http/request.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get(path, payload, timeout = DEFAULT_TIMEOUT) ⇒ Object
-
#initialize(config = Cassette.config) ⇒ Request
constructor
A new instance of Request.
- #post(path, payload, timeout = DEFAULT_TIMEOUT) ⇒ Object
Constructor Details
#initialize(config = Cassette.config) ⇒ Request
9 10 11 |
# File 'lib/cassette/http/request.rb', line 9 def initialize(config = Cassette.config) self.config = config end |
Class Method Details
.method_missing(name, *args) ⇒ Object
4 5 6 7 |
# File 'lib/cassette/http/request.rb', line 4 def self.method_missing(name, *args) @default_http ||= new @default_http.send(name, *args) end |
Instance Method Details
#get(path, payload, timeout = DEFAULT_TIMEOUT) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/cassette/http/request.rb', line 20 def get(path, payload, timeout = DEFAULT_TIMEOUT) perform(:get, path) do |req| req.params = payload req..timeout = timeout end end |
#post(path, payload, timeout = DEFAULT_TIMEOUT) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/cassette/http/request.rb', line 13 def post(path, payload, timeout = DEFAULT_TIMEOUT) perform(:post, path) do |req| req.body = URI.encode_www_form(payload) req..timeout = timeout end end |