typhoeus 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/typhoeus.rb +1 -1
  2. data/lib/typhoeus/request.rb +23 -0
  3. metadata +1 -1
data/lib/typhoeus.rb CHANGED
@@ -14,7 +14,7 @@ require 'typhoeus/request'
14
14
  require 'typhoeus/hydra'
15
15
 
16
16
  module Typhoeus
17
- VERSION = "0.1.5"
17
+ VERSION = "0.1.6"
18
18
 
19
19
  def self.easy_object_pool
20
20
  @easy_objects ||= []
@@ -84,5 +84,28 @@ module Typhoeus
84
84
  def cache_key
85
85
  Digest::SHA1.hexdigest(url)
86
86
  end
87
+
88
+ def self.run(url, params)
89
+ r = new(url, params)
90
+ Typhoeus::Hydra.hydra.queue r
91
+ Typhoeus::Hydra.hydra.run
92
+ r.response
93
+ end
94
+
95
+ def self.get(url, params)
96
+ run(url, params.merge(:method => :get))
97
+ end
98
+
99
+ def self.post(url, params)
100
+ run(url, params.merge(:method => :post))
101
+ end
102
+
103
+ def self.put(url, params)
104
+ run(url, params.merge(:method => :put))
105
+ end
106
+
107
+ def self.delete(url, params)
108
+ run(url, params.merge(:method => :delete))
109
+ end
87
110
  end
88
111
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: typhoeus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Dix