fusionauth_client 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,7 +41,7 @@ module FusionAuth
41
41
  # @param body_handler [BodyHandler] The body handler.
42
42
  # @return [RESTClient] this
43
43
  #
44
- def body_handler(body_handler)
44
+ def rbody_handler(body_handler)
45
45
  @body_handler = body_handler
46
46
  self
47
47
  end
@@ -113,7 +113,7 @@ module FusionAuth
113
113
  if response.url.scheme == 'https'
114
114
  opts[:use_ssl] = true
115
115
  end
116
- if @body_handler != nil
116
+ if @body_handler != nil && @body_handler.type != "FormData"
117
117
  @body_handler.set_headers(@headers)
118
118
  end
119
119
 
@@ -154,7 +154,12 @@ module FusionAuth
154
154
  raise ArgumentError, "Invalid HTTP method #{@method}"
155
155
  end
156
156
 
157
- request.body = response.request
157
+ if @body_handler != nil && @body_handler.type == "FormData"
158
+ request.set_form_data(response.request)
159
+ else
160
+ request.body = response.request
161
+ end
162
+
158
163
  http_response = http.request(request)
159
164
  }
160
165
 
@@ -185,6 +190,11 @@ module FusionAuth
185
190
  self
186
191
  end
187
192
 
193
+ def patch
194
+ @method = 'PATCH'
195
+ self
196
+ end
197
+
188
198
  def post
189
199
  @method = 'POST'
190
200
  self
@@ -289,6 +299,32 @@ module FusionAuth
289
299
  end
290
300
  end
291
301
 
302
+ class FormDataBodyHandler
303
+ attr_accessor :length, :body
304
+
305
+ def initialize(body_object)
306
+ @body = body_object
307
+ end
308
+
309
+ def body_object
310
+ @body
311
+ end
312
+
313
+ def type
314
+ "FormData"
315
+ end
316
+
317
+ #
318
+ # Sets any headers necessary for the body to be processed.
319
+ #
320
+ # @param headers [Hash] The headers hash to add any headers needed by this BodyHandler
321
+ # @return [Object] The object
322
+ def set_headers(headers)
323
+ headers['Content-Type'] = 'application/x-www-form-urlencoded'
324
+ nil
325
+ end
326
+ end
327
+
292
328
  class JSONBodyHandler
293
329
  attr_accessor :length, :body
294
330
 
@@ -304,6 +340,10 @@ module FusionAuth
304
340
  @body
305
341
  end
306
342
 
343
+ def type
344
+ "JSON"
345
+ end
346
+
307
347
  #
308
348
  # Sets any headers necessary for the body to be processed.
309
349
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fusionauth_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.0
4
+ version: 1.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Pontarelli
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-10-30 00:00:00.000000000 Z
12
+ date: 2019-12-09 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: This library contains the Ruby client library that helps you connect
15
15
  your application to FusionAuth.
@@ -51,8 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
51
51
  - !ruby/object:Gem::Version
52
52
  version: '0'
53
53
  requirements: []
54
- rubyforge_project:
55
- rubygems_version: 2.5.1
54
+ rubygems_version: 3.0.2
56
55
  signing_key:
57
56
  specification_version: 4
58
57
  summary: The Ruby client library for FusionAuth