async-rest 0.16.0 → 0.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/async/rest/representation.rb +13 -17
- data/lib/async/rest/resource.rb +4 -0
- data/lib/async/rest/version.rb +1 -1
- data/lib/async/rest/wrapper/generic.rb +3 -2
- data.tar.gz.sig +0 -0
- metadata +2 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b382d2957eae86372238557c07d854d654e3ed63b0e49ffa95250f6cc81b1a6
|
4
|
+
data.tar.gz: 6f01d8c70c1f66a1909892340856893fb1f17a815e2019ecc08a40e0308d5311
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 836f2fea74f220a114ffd6557ad04e46e2ae28b417533e7974ce0fbf45e590367cad640c7c35a292e85f6186257ef74ac4019115198733bfaafce5a7a1de2f1e
|
7
|
+
data.tar.gz: 3391c4a281443add49271025386414b4b5454890b0a069ed2730ec774696b06a9b8a4af402cdbd5576989876b1840144b10af71571c7b2e4337244bf932fe691
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -47,7 +47,7 @@ module Async
|
|
47
47
|
# @returns [Representation] the representation of the resource.
|
48
48
|
def self.for(resource, response, &block)
|
49
49
|
if block_given?
|
50
|
-
return yield(
|
50
|
+
return yield(resource, response, self)
|
51
51
|
else
|
52
52
|
return self.new(resource, value: response.read, metadata: response.headers)
|
53
53
|
end
|
@@ -103,33 +103,29 @@ module Async
|
|
103
103
|
|
104
104
|
# Provides a way to mutate the value of the representation.
|
105
105
|
module Mutable
|
106
|
-
def value
|
107
|
-
|
106
|
+
def post(value)
|
107
|
+
self.class.post(@resource, value) do |resource, response|
|
108
|
+
@value = response.read
|
109
|
+
|
110
|
+
self
|
111
|
+
end
|
108
112
|
end
|
109
113
|
|
110
|
-
def
|
114
|
+
def delete
|
115
|
+
self.class.delete(@resource)
|
116
|
+
end
|
117
|
+
|
118
|
+
def assign(value)
|
111
119
|
if value
|
112
120
|
self.post(value)
|
113
121
|
else
|
114
122
|
self.delete
|
115
123
|
end
|
116
124
|
end
|
117
|
-
|
118
|
-
def assign(value)
|
119
|
-
response = self.call(value)
|
120
|
-
|
121
|
-
response.read
|
122
|
-
|
123
|
-
return @value
|
124
|
-
end
|
125
|
-
|
126
|
-
def update
|
127
|
-
@value = assign(@value)
|
128
|
-
end
|
129
125
|
end
|
130
126
|
|
131
127
|
def inspect
|
132
|
-
"\#<#{self.class} #{@resource.inspect} value=#{@value.inspect}>"
|
128
|
+
"\#<#{self.class} #{@resource.path.inspect} value=#{@value.inspect}>"
|
133
129
|
end
|
134
130
|
end
|
135
131
|
end
|
data/lib/async/rest/resource.rb
CHANGED
data/lib/async/rest/version.rb
CHANGED
@@ -7,8 +7,9 @@ module Async
|
|
7
7
|
module REST
|
8
8
|
module Wrapper
|
9
9
|
class Generic
|
10
|
-
def call(resource,
|
11
|
-
request = ::Protocol::HTTP::Request[
|
10
|
+
def call(resource, method = "GET", payload = nil, &block)
|
11
|
+
request = ::Protocol::HTTP::Request[method, nil]
|
12
|
+
|
12
13
|
self.prepare_request(request, payload)
|
13
14
|
|
14
15
|
response = resource.call(request)
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
@@ -40,7 +40,7 @@ cert_chain:
|
|
40
40
|
Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
|
41
41
|
voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
|
42
42
|
-----END CERTIFICATE-----
|
43
|
-
date: 2024-09-
|
43
|
+
date: 2024-09-13 00:00:00.000000000 Z
|
44
44
|
dependencies:
|
45
45
|
- !ruby/object:Gem::Dependency
|
46
46
|
name: async-http
|
metadata.gz.sig
CHANGED
Binary file
|