async-rest 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +1 -1
- data/async-rest.gemspec +1 -1
- data/lib/async/rest/representation.rb +1 -1
- data/lib/async/rest/resource.rb +11 -10
- data/lib/async/rest/version.rb +1 -1
- data/lib/async/rest/wrapper/json.rb +2 -2
- data/lib/async/rest/wrapper/url_encoded.rb +4 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '016926580e59e99301f924fae62c8f6261d17529bbf86958a40f738e7ed4981a'
|
4
|
+
data.tar.gz: bbaf2ae2a2419be45addbbfffd35a4c2798073268eff97ba8e2fab83da0f20aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fd749effe692063ebab519cd42fbd4df7bc8cb6b168e66d5e938ba0396337afc5fccf5fc206892e086976edaa5620c95114038aa124c65de6b5afcf59f485d9
|
7
|
+
data.tar.gz: fbce09f4608610d801853acf810c2e6452d8c49d0785b1876480bae46293b61119222bf32e89f590e37429541c150b71d06695763ad14c2a839cb339f82da9c3
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -41,7 +41,7 @@ This simple example shows how to use a custom representation to access DNS over
|
|
41
41
|
|
42
42
|
```ruby
|
43
43
|
require 'async/http/server'
|
44
|
-
require 'async/http/
|
44
|
+
require 'async/http/endpoint'
|
45
45
|
|
46
46
|
require 'async/rest/resource'
|
47
47
|
require 'async/rest/representation'
|
data/async-rest.gemspec
CHANGED
@@ -16,7 +16,7 @@ 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.41"
|
20
20
|
|
21
21
|
spec.add_development_dependency "async-rspec", "~> 1.1"
|
22
22
|
|
@@ -65,7 +65,7 @@ module Async
|
|
65
65
|
@wrapper.process_response(request, response)
|
66
66
|
end
|
67
67
|
|
68
|
-
HTTP::
|
68
|
+
::Protocol::HTTP::Methods.each do |name, verb|
|
69
69
|
# TODO when Ruby 3.0 lands, convert this to |payload = nil, **parameters|
|
70
70
|
# Blocked by https://bugs.ruby-lang.org/issues/14183
|
71
71
|
define_method(verb.downcase) do |payload = nil|
|
data/lib/async/rest/resource.rb
CHANGED
@@ -20,18 +20,19 @@
|
|
20
20
|
|
21
21
|
require 'async'
|
22
22
|
require 'async/http/client'
|
23
|
-
require 'async/http/
|
24
|
-
|
25
|
-
require '
|
23
|
+
require 'async/http/endpoint'
|
24
|
+
|
25
|
+
require 'protocol/http/accept_encoding'
|
26
|
+
require 'protocol/http/reference'
|
26
27
|
|
27
28
|
module Async
|
28
29
|
module REST
|
29
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.
|
30
|
-
class Resource < HTTP::Middleware
|
31
|
+
class Resource < ::Protocol::HTTP::Middleware
|
31
32
|
# @param delegate [Async::HTTP::Middleware] the delegate that will handle requests.
|
32
33
|
# @param reference [Async::HTTP::Reference] the resource identifier (base request path/parameters).
|
33
|
-
# @param headers [
|
34
|
-
def initialize(delegate, reference = HTTP::Reference.parse, headers = HTTP::Headers.new)
|
34
|
+
# @param headers [::Protocol::HTTP::Headers] the default headers that will be supplied with the request.
|
35
|
+
def initialize(delegate, reference = ::Protocol::HTTP::Reference.parse, headers = ::Protocol::HTTP::Headers.new)
|
35
36
|
super(delegate)
|
36
37
|
|
37
38
|
@reference = reference
|
@@ -39,12 +40,12 @@ module Async
|
|
39
40
|
end
|
40
41
|
|
41
42
|
def self.connect(url)
|
42
|
-
endpoint = HTTP::
|
43
|
+
endpoint = HTTP::Endpoint.parse(url)
|
43
44
|
|
44
|
-
reference = HTTP::Reference.parse(endpoint.path)
|
45
|
+
reference = ::Protocol::HTTP::Reference.parse(endpoint.path)
|
45
46
|
|
46
47
|
# return HTTP::Client.new(endpoint), reference
|
47
|
-
return HTTP::AcceptEncoding.new(HTTP::Client.new(endpoint)), reference
|
48
|
+
return ::Protocol::HTTP::AcceptEncoding.new(HTTP::Client.new(endpoint)), reference
|
48
49
|
end
|
49
50
|
|
50
51
|
def self.for(url, *args)
|
@@ -91,7 +92,7 @@ module Async
|
|
91
92
|
body = nil
|
92
93
|
end
|
93
94
|
|
94
|
-
return HTTP::Request[verb, @reference, headers, body]
|
95
|
+
return ::Protocol::HTTP::Request[verb, @reference, headers, body]
|
95
96
|
end
|
96
97
|
|
97
98
|
def inspect
|
data/lib/async/rest/version.rb
CHANGED
@@ -20,8 +20,8 @@
|
|
20
20
|
|
21
21
|
require 'json'
|
22
22
|
|
23
|
-
require '
|
24
|
-
require '
|
23
|
+
require 'protocol/http/body/wrapper'
|
24
|
+
require 'protocol/http/body/buffered'
|
25
25
|
|
26
26
|
module Async
|
27
27
|
module REST
|
@@ -45,7 +45,7 @@ module Async
|
|
45
45
|
if payload
|
46
46
|
headers['content-type'] = @content_type
|
47
47
|
|
48
|
-
HTTP::Body::Buffered.new([
|
48
|
+
::Protocol::HTTP::Body::Buffered.new([
|
49
49
|
::Protocol::HTTP::URL.encode(payload)
|
50
50
|
])
|
51
51
|
end
|
@@ -65,7 +65,7 @@ module Async
|
|
65
65
|
return response
|
66
66
|
end
|
67
67
|
|
68
|
-
class Parser < HTTP::Body::Wrapper
|
68
|
+
class Parser < ::Protocol::HTTP::Body::Wrapper
|
69
69
|
def join
|
70
70
|
::Protocol::HTTP::URL.decode(super, symbolize_keys: true)
|
71
71
|
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.8.
|
4
|
+
version: 0.8.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: 2019-05-
|
11
|
+
date: 2019-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.41'
|
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.41'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: async-rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
134
134
|
- !ruby/object:Gem::Version
|
135
135
|
version: '0'
|
136
136
|
requirements: []
|
137
|
-
rubygems_version: 3.0.
|
137
|
+
rubygems_version: 3.0.2
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: A library for RESTful clients (and hopefully servers).
|