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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 26ab0148b98834201d42e7055654d043077bad78b227d2524f1debff48175654
4
- data.tar.gz: 99fde3b0d62ecca89557ad7bc5161d9fa1396cea16d0ca1885fd76e0d87f22d0
3
+ metadata.gz: 2b382d2957eae86372238557c07d854d654e3ed63b0e49ffa95250f6cc81b1a6
4
+ data.tar.gz: 6f01d8c70c1f66a1909892340856893fb1f17a815e2019ecc08a40e0308d5311
5
5
  SHA512:
6
- metadata.gz: c42fb4730717aa2e916aef02d9fa4ba310acaf6c2a35f6a6f721f4bf9b655196fc09c44ebeedd50bdbba529a823114068d29a4fb9b624c59a7386b9464aefa75
7
- data.tar.gz: f6e76697202ef2141bf9a7b65af0b59139f76174266f800759f5ad9be6202880205f63b899331a1ce6b37574dc008301eff869407493b732d2b9b6b7cd248d76
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(response, resource, self)
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= value
107
- @value = self.assign(value)
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 call(value)
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
@@ -70,6 +70,10 @@ module Async
70
70
  self.class.with(self, **options)
71
71
  end
72
72
 
73
+ def path
74
+ @reference.path
75
+ end
76
+
73
77
  def inspect
74
78
  "\#<#{self.class} #{@reference.inspect} #{@headers.inspect}>"
75
79
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module REST
8
- VERSION = "0.16.0"
8
+ VERSION = "0.18.0"
9
9
  end
10
10
  end
@@ -7,8 +7,9 @@ module Async
7
7
  module REST
8
8
  module Wrapper
9
9
  class Generic
10
- def call(resource, verb = "GET", payload = nil, &block)
11
- request = ::Protocol::HTTP::Request[verb, nil]
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.16.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-12 00:00:00.000000000 Z
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