async-rest 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/async-rest.gemspec +2 -1
- data/lib/async/rest/error.rb +26 -0
- data/lib/async/rest/representation.rb +2 -1
- data/lib/async/rest/resource.rb +3 -4
- data/lib/async/rest/version.rb +1 -1
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1256dc24f29fc1332acf1548cf62f8e2f4bf293e1ccf34f36f83683b518716
|
4
|
+
data.tar.gz: 2a463fee417542e3b29f63f4bf1b77e35ffc11d8402f426e15e5860d297a4c10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eab724509c865977deec20a08f5ba15fadea3948a02d98f65795874dca94b7e966237b86e85780244b03e8d05cb63bfd18d025dc7092398830c48f8cfa7fee26
|
7
|
+
data.tar.gz: 9a1131bb6b4062c8db19c43c9c2e334dfe0465744dbc41c822125288c7fcb7b20558191902ae8439cdfc0950183b4fbb10b4a9349c6311060fdcc8650f6163fb
|
data/async-rest.gemspec
CHANGED
@@ -16,7 +16,8 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
17
|
spec.require_paths = ["lib"]
|
18
18
|
|
19
|
-
spec.add_dependency "async-http", "~> 0.
|
19
|
+
spec.add_dependency "async-http", "~> 0.42"
|
20
|
+
spec.add_dependency "protocol-http", "~> 0.7"
|
20
21
|
|
21
22
|
spec.add_development_dependency "async-rspec", "~> 1.1"
|
22
23
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
module Async
|
22
|
+
module REST
|
23
|
+
class Error < StandardError
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -18,12 +18,13 @@
|
|
18
18
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
19
|
# THE SOFTWARE.
|
20
20
|
|
21
|
+
require_relative 'error'
|
21
22
|
require_relative 'resource'
|
22
23
|
require_relative 'wrapper/json'
|
23
24
|
|
24
25
|
module Async
|
25
26
|
module REST
|
26
|
-
class RequestFailure <
|
27
|
+
class RequestFailure < Error
|
27
28
|
end
|
28
29
|
|
29
30
|
# REST components perform actions on a resource by using a representation to capture the current or intended state of that resource and transferring that representation between components. A representation is a sequence of bytes, plus representation metadata to describe those bytes. Other commonly used but less precise names for a representation include: document, file, and HTTP message entity, instance, or variant.
|
data/lib/async/rest/resource.rb
CHANGED
@@ -30,7 +30,7 @@ module Async
|
|
30
30
|
# The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a temporal service (e.g. "today's weather in Los Angeles"), a collection of other resources, a non-virtual object (e.g. a person), and so on. In other words, any concept that might be the target of an author's hypertext reference must fit within the definition of a resource. A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time.
|
31
31
|
class Resource < ::Protocol::HTTP::Middleware
|
32
32
|
# @param delegate [Async::HTTP::Middleware] the delegate that will handle requests.
|
33
|
-
# @param reference [
|
33
|
+
# @param reference [::Protocol::HTTP::Reference] the resource identifier (base request path/parameters).
|
34
34
|
# @param headers [::Protocol::HTTP::Headers] the default headers that will be supplied with the request.
|
35
35
|
def initialize(delegate, reference = ::Protocol::HTTP::Reference.parse, headers = ::Protocol::HTTP::Headers.new)
|
36
36
|
super(delegate)
|
@@ -44,7 +44,6 @@ module Async
|
|
44
44
|
|
45
45
|
reference = ::Protocol::HTTP::Reference.parse(endpoint.path)
|
46
46
|
|
47
|
-
# return HTTP::Client.new(endpoint), reference
|
48
47
|
return ::Protocol::HTTP::AcceptEncoding.new(HTTP::Client.new(endpoint)), reference
|
49
48
|
end
|
50
49
|
|
@@ -67,8 +66,8 @@ module Async
|
|
67
66
|
attr :reference
|
68
67
|
attr :headers
|
69
68
|
|
70
|
-
def self.with(parent, *args, headers: {},
|
71
|
-
reference = parent.reference.
|
69
|
+
def self.with(parent, *args, headers: {}, **options)
|
70
|
+
reference = parent.reference.with(**options)
|
72
71
|
|
73
72
|
self.new(*args, parent.delegate, reference, parent.headers.merge(headers))
|
74
73
|
end
|
data/lib/async/rest/version.rb
CHANGED
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.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.42'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.42'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: protocol-http
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.7'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.7'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: async-rspec
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -111,6 +125,7 @@ files:
|
|
111
125
|
- async-rest.gemspec
|
112
126
|
- examples/slack/clean.rb
|
113
127
|
- lib/async/rest.rb
|
128
|
+
- lib/async/rest/error.rb
|
114
129
|
- lib/async/rest/representation.rb
|
115
130
|
- lib/async/rest/resource.rb
|
116
131
|
- lib/async/rest/version.rb
|
@@ -134,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
149
|
- !ruby/object:Gem::Version
|
135
150
|
version: '0'
|
136
151
|
requirements: []
|
137
|
-
rubygems_version: 3.0.
|
152
|
+
rubygems_version: 3.0.3
|
138
153
|
signing_key:
|
139
154
|
specification_version: 4
|
140
155
|
summary: A library for RESTful clients (and hopefully servers).
|