gooddata 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.4
1
+ 0.5.5
@@ -149,6 +149,22 @@ module GoodData
149
149
  connection.post path, data, options
150
150
  end
151
151
 
152
+ # Performs a HTTP PUT request.
153
+ #
154
+ # Retuns the JSON response formatted as a Hash object.
155
+ #
156
+ # === Parameters
157
+ #
158
+ # * +path+ - The HTTP path on the GoodData server (must be prefixed with a forward slash)
159
+ # * +data+ - The payload data in the format of a Hash object
160
+ #
161
+ # === Examples
162
+ #
163
+ # GoodData.put '/gdc/projects', { ... }
164
+ def put(path, data, options = {})
165
+ connection.put path, data, options
166
+ end
167
+
152
168
  # Performs a HTTP DELETE request.
153
169
  #
154
170
  # Retuns the JSON response formatted as a Hash object.
@@ -71,7 +71,7 @@ module GoodData
71
71
  GoodData.logger.debug "GET #{path}"
72
72
  ensure_connection
73
73
  b = Proc.new { @server[path].get cookies }
74
- response = (options[:process] == false) ? (b.call) : process_response(options, &b)
74
+ process_response(options, &b)
75
75
  end
76
76
 
77
77
  # Performs a HTTP POST request.
@@ -91,7 +91,27 @@ module GoodData
91
91
  GoodData.logger.debug "POST #{path}, payload: #{payload}"
92
92
  ensure_connection
93
93
  b = Proc.new { @server[path].post payload, cookies }
94
- options[:process] == false ? b.call : process_response(options, &b)
94
+ process_response(options, &b)
95
+ end
96
+
97
+ # Performs a HTTP PUT request.
98
+ #
99
+ # Retuns the JSON response formatted as a Hash object.
100
+ #
101
+ # === Parameters
102
+ #
103
+ # * +path+ - The HTTP path on the GoodData server (must be prefixed with a forward slash)
104
+ # * +data+ - The payload data in the format of a Hash object
105
+ #
106
+ # === Examples
107
+ #
108
+ # Connection.new(username, password).put '/gdc/projects', { ... }
109
+ def put(path, data, options = {})
110
+ payload = data.is_a?(Hash) ? data.to_json : data
111
+ GoodData.logger.debug "PUT #{path}, payload: #{payload}"
112
+ ensure_connection
113
+ b = Proc.new { @server[path].put payload, cookies }
114
+ process_response(options, &b)
95
115
  end
96
116
 
97
117
  # Performs a HTTP DELETE request.
@@ -109,7 +129,7 @@ module GoodData
109
129
  GoodData.logger.debug "DELETE #{path}"
110
130
  ensure_connection
111
131
  b = Proc.new { @server[path].delete cookies }
112
- options[:process] == false ? b.call : process_response(options, &b)
132
+ process_response(options, &b)
113
133
  end
114
134
 
115
135
  # Get the cookies associated with the current connection.
@@ -256,6 +276,8 @@ module GoodData
256
276
  end
257
277
  merge_cookies! response.cookies
258
278
  content_type = response.headers[:content_type]
279
+ return response if options[:process] == false
280
+
259
281
  if content_type == "application/json" || content_type == "application/json;charset=UTF-8" then
260
282
  result = response.to_str == '""' ? {} : JSON.parse(response.to_str)
261
283
  GoodData.logger.debug "Response: #{result.inspect}"
@@ -1,3 +1,3 @@
1
1
  module GoodData
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.5"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- - 4
10
- version: 0.5.4
9
+ - 5
10
+ version: 0.5.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Pavel Kolesnikov
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2012-03-16 00:00:00 Z
19
+ date: 2012-04-18 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  version_requirements: &id001 !ruby/object:Gem::Requirement