async-rest 0.4.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99c709ef59de6ef14480af19a3126f41ebe0c632da11c31a70ecc0fd10cdbe28
4
- data.tar.gz: 8f0ec6398542b8c1240dab2d545b876812500429c864d7d7b63195389e1bfa16
3
+ metadata.gz: 548f923968025491a47661619f728208c7c319dc33b03fac48d8a4d28be69ce8
4
+ data.tar.gz: 31da938bb7b4aae9e51d16b2ef81c3877b77e3ec2e69b3c006e405446b922f80
5
5
  SHA512:
6
- metadata.gz: 95d54f61a3b812dbe47e81321a51e6eda5d341fb503339e4700d4662fa18ef4778a45950e661a011cd5ed5f41ab7430bd40f0cb7dce3ea04ebe11a7d115df215
7
- data.tar.gz: 0b607070cd4baaf8dc998f5abbb8b0d256be2285bfe0aa38d347e7beb6575bd03d33c1c9717abac7452dc9f80ea8d8a345ff84db58ebafcac26fd747faf6ed97
6
+ metadata.gz: 0c71a771cdd839421f9de1e242710ce03b101d8339a2154536e667eb332965e7937da61405bea3152de1cbb5571b3aebe53043e68a62cd04d169408cbf4f1608
7
+ data.tar.gz: c3ac3800a1a4c86cda32fc5076c81075947070dbb90f986f026b031fa83bb7b794d6845c3884fef5412f1233f39085395b78f060d771a69b6b72985a7edde155
@@ -67,22 +67,28 @@ module Async
67
67
  attr :headers
68
68
  attr :wrapper
69
69
 
70
- def self.nest(parent, path = nil, *args)
71
- self.new(*args, parent.delegate, parent.reference.dup(path), parent.headers, parent.wrapper)
70
+ def self.with(parent, *args, headers: {}, parameters: nil, path: nil, wrapper: parent.wrapper)
71
+ self.new(*args, parent.delegate, parent.reference.dup(path, parameters), parent.headers.merge(headers), wrapper)
72
72
  end
73
73
 
74
- def nest(path, *args)
75
- self.class.nest(self, path, *args)
74
+ def with(*args, **options)
75
+ self.class.with(self, *args, **options)
76
76
  end
77
77
 
78
- def with(headers)
79
- self.class.new(@delegate, @reference, @headers.merge(headers), @wrapper)
80
- end
81
-
82
- def prepare_request(verb, payload = nil, headers = nil, **parameters)
83
- headers ||= @headers.dup
84
- reference = @reference.dup(nil, parameters)
85
- body = @wrapper.prepare_request(payload, headers)
78
+ def prepare_request(verb, payload = nil, **parameters)
79
+ if parameters.empty?
80
+ reference = @reference
81
+ else
82
+ reference = @reference.dup(nil, parameters)
83
+ end
84
+
85
+ headers = @headers.dup
86
+
87
+ if payload
88
+ body = @wrapper.prepare_request(payload, headers)
89
+ else
90
+ body = nil
91
+ end
86
92
 
87
93
  return HTTP::Request[verb, reference, headers, body]
88
94
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module REST
23
- VERSION = "0.4.0"
23
+ VERSION = "0.5.1"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-30 00:00:00.000000000 Z
11
+ date: 2018-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http