rest 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,22 +17,27 @@ Then use it.
17
17
  GET
18
18
  =========
19
19
 
20
- @rest.get(full_url, options...)
20
+ @rest.get(url, options...)
21
21
 
22
22
  options:
23
23
 
24
- - params - query params for url
25
- - headers
24
+ - :params => query params for url
25
+ - :headers => headers
26
26
 
27
27
  POST
28
28
  ======
29
29
 
30
- @rest.post(full_url, options...)
30
+ @rest.post(url, options...)
31
31
 
32
32
  options:
33
33
 
34
- - headers
35
- - body
34
+ - :body => POST body
35
+ - :headers => headers
36
+
37
+ DELETE
38
+ ======
39
+
40
+ @rest.delete(url, options...)
36
41
 
37
42
 
38
43
 
@@ -1,5 +1,5 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 0
5
- :build:
4
+ :patch: 2
5
+ :build: !!null
@@ -70,6 +70,10 @@ module Rest
70
70
  @wrapper.post(url, req_hash)
71
71
  end
72
72
 
73
+ def put(url, req_hash={})
74
+ @wrapper.put(url, req_hash)
75
+ end
76
+
73
77
  def delete(url, req_hash={})
74
78
  @wrapper.delete(url, req_hash)
75
79
  end
@@ -65,6 +65,20 @@ module Rest
65
65
  response
66
66
  end
67
67
 
68
+ def put(url, req_hash={})
69
+ response = nil
70
+ begin
71
+ req_hash[:method] = :put
72
+ req_hash[:url] = url
73
+ req_hash[:payload] = req_hash[:body] if req_hash[:body]
74
+ r2 = RestClient::Request.execute(req_hash)
75
+ response = RestClientResponseWrapper.new(r2)
76
+ rescue RestClient::Exception => ex
77
+ raise RestClientExceptionWrapper.new(ex)
78
+ end
79
+ response
80
+ end
81
+
68
82
  def delete(url, req_hash={})
69
83
  response = nil
70
84
  begin
@@ -46,6 +46,17 @@ module Rest
46
46
  response
47
47
  end
48
48
 
49
+ def put(url, req_hash={})
50
+ req_hash = default_typhoeus_options.merge(req_hash)
51
+ # puts "REQ_HASH=" + req_hash.inspect
52
+ response = Typhoeus::Request.put(url, req_hash)
53
+ #p response
54
+ if response.timed_out?
55
+ raise TyphoeusTimeoutError.new(response)
56
+ end
57
+ response
58
+ end
59
+
49
60
  def delete(url, req_hash={})
50
61
  req_hash = default_typhoeus_options.merge(req_hash)
51
62
  response = Typhoeus::Request.delete(url, req_hash)
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rest"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Travis Reeder"]
12
- s.date = "2011-12-18"
12
+ s.date = "2012-02-27"
13
13
  s.description = "Rest client wrapper that chooses best installed client."
14
14
  s.email = "travis@iron.io"
15
15
  s.extra_rdoc_files = [
@@ -30,7 +30,7 @@ Gem::Specification.new do |s|
30
30
  s.homepage = "http://www.iron.io"
31
31
  s.require_paths = ["lib"]
32
32
  s.required_ruby_version = Gem::Requirement.new(">= 1.9")
33
- s.rubygems_version = "1.8.11"
33
+ s.rubygems_version = "1.8.15"
34
34
  s.summary = "Rest client wrapper that chooses best installed client."
35
35
 
36
36
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-18 00:00:00.000000000 Z
12
+ date: 2012-02-27 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
- requirement: &13281860 !ruby/object:Gem::Requirement
16
+ requirement: &13172840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *13281860
24
+ version_requirements: *13172840
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rest-client
27
- requirement: &13281380 !ruby/object:Gem::Requirement
27
+ requirement: &13172240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *13281380
35
+ version_requirements: *13172240
36
36
  description: Rest client wrapper that chooses best installed client.
37
37
  email: travis@iron.io
38
38
  executables: []
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
70
  version: '0'
71
71
  requirements: []
72
72
  rubyforge_project:
73
- rubygems_version: 1.8.11
73
+ rubygems_version: 1.8.15
74
74
  signing_key:
75
75
  specification_version: 3
76
76
  summary: Rest client wrapper that chooses best installed client.