Class: Flute::Network
- Inherits:
-
Object
- Object
- Flute::Network
- Defined in:
- lib/flute/network.rb
Instance Method Summary collapse
- #create_manager(max_concurrency: 5) ⇒ Object
- #get(url, params: {}, headers: {}) ⇒ Object
- #make_options(params = {}, headers = {}) ⇒ Object
- #request(url, params: {}, headers: {}, method: :get, body: {}) ⇒ Object
Instance Method Details
#create_manager(max_concurrency: 5) ⇒ Object
25 26 27 |
# File 'lib/flute/network.rb', line 25 def create_manager(max_concurrency: 5) Typhoeus::Hydra.new(max_concurrency: max_concurrency) end |
#get(url, params: {}, headers: {}) ⇒ Object
3 4 5 6 7 |
# File 'lib/flute/network.rb', line 3 def get(url, params: {}, headers: {}) = params, headers response = Typhoeus.get(url, ) Response.new response end |
#make_options(params = {}, headers = {}) ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/flute/network.rb', line 15 def (params={}, headers={}) = { headers: headers, params: params, followlocation: true, accept_encoding: 'gzip' } end |
#request(url, params: {}, headers: {}, method: :get, body: {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/flute/network.rb', line 9 def request(url, params: {}, headers: {}, method: :get, body: {}) = params, headers request = Request.new url, .merge(method: method, body: body) request end |