roar 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +19 -0
- data/.github/workflows/ci_jruby.yml +19 -0
- data/.github/workflows/ci_legacy.yml +19 -0
- data/.github/workflows/ci_truffleruby.yml +19 -0
- data/CHANGES.markdown +7 -0
- data/README.markdown +4 -4
- data/lib/roar/coercion.rb +5 -3
- data/lib/roar/version.rb +1 -1
- data/roar.gemspec +3 -2
- data/test/coercion_feature_test.rb +1 -1
- data/test/integration/faraday_http_transport_test.rb +5 -5
- data/test/integration/http_verbs_test.rb +1 -1
- data/test/integration/ssl_server.rb +2 -2
- metadata +29 -12
- data/.travis.yml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2860c24f7eedfa3e4f1f0863055f3914f6ace36ba34cf6ae51fcfcd7c5178c2b
|
4
|
+
data.tar.gz: 3a6ce9a686e587093781eaa0b35618a7573198d4d42092aca23e1a4309e7c8c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0733953718778b1724d81d547ed9b870740417fe77295694615f2af4af31aaf4cf3004988d120d560e311dacc5ab00e1d0dff82468614c7424087e950067f058'
|
7
|
+
data.tar.gz: aa179e38257da2b60502d72b93f1c41fcfa33feb7891308b27d2464180e345a358970e39c1f353428bdcea42af6af54df75a7d51403159e47a0c152563c075ee
|
@@ -0,0 +1,19 @@
|
|
1
|
+
## This file is managed by Terraform.
|
2
|
+
## Do not modify this file directly, as it may be overwritten.
|
3
|
+
## Please open an issue instead.
|
4
|
+
name: CI
|
5
|
+
on: [push, pull_request]
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [2.7, '3.0', '3.1', '3.2']
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
bundler-cache: true
|
19
|
+
- run: bundle exec rake
|
@@ -0,0 +1,19 @@
|
|
1
|
+
## This file is managed by Terraform.
|
2
|
+
## Do not modify this file directly, as it may be overwritten.
|
3
|
+
## Please open an issue instead.
|
4
|
+
name: CI JRuby
|
5
|
+
on: [push, pull_request]
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [jruby, jruby-head]
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
bundler-cache: true
|
19
|
+
- run: bundle exec rake
|
@@ -0,0 +1,19 @@
|
|
1
|
+
## This file is managed by Terraform.
|
2
|
+
## Do not modify this file directly, as it may be overwritten.
|
3
|
+
## Please open an issue instead.
|
4
|
+
name: CI with EOL ruby versions
|
5
|
+
on: [push, pull_request]
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [2.5, 2.6]
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
bundler-cache: true
|
19
|
+
- run: bundle exec rake
|
@@ -0,0 +1,19 @@
|
|
1
|
+
## This file is managed by Terraform.
|
2
|
+
## Do not modify this file directly, as it may be overwritten.
|
3
|
+
## Please open an issue instead.
|
4
|
+
name: CI TruffleRuby
|
5
|
+
on: [push, pull_request]
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
strategy:
|
9
|
+
fail-fast: false
|
10
|
+
matrix:
|
11
|
+
ruby: [truffleruby, truffleruby-head]
|
12
|
+
runs-on: ubuntu-latest
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v3
|
15
|
+
- uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: ${{ matrix.ruby }}
|
18
|
+
bundler-cache: true
|
19
|
+
- run: bundle exec rake
|
data/CHANGES.markdown
CHANGED
data/README.markdown
CHANGED
@@ -4,7 +4,7 @@ _Resource-Oriented Architectures in Ruby._
|
|
4
4
|
|
5
5
|
[![Gitter Chat](https://badges.gitter.im/trailblazer/chat.svg)](https://gitter.im/trailblazer/chat)
|
6
6
|
[![TRB Newsletter](https://img.shields.io/badge/TRB-newsletter-lightgrey.svg)](http://trailblazer.to/newsletter/)
|
7
|
-
[![Build Status](https://
|
7
|
+
[![Build Status](https://github.com/trailblazer/roar/actions/workflows/ci.yml/badge.svg)](https://github.com/trailblazer/roar/actions)
|
8
8
|
[![Gem Version](https://badge.fury.io/rb/roar.svg)](http://badge.fury.io/rb/roar)
|
9
9
|
|
10
10
|
## Table of Contents
|
@@ -296,7 +296,7 @@ We're currently [working on](https://github.com/trailblazer/roar/issues/85) bett
|
|
296
296
|
|
297
297
|
## Coercion
|
298
298
|
|
299
|
-
Roar provides coercion with the [
|
299
|
+
Roar provides coercion with the [dry-types](https://dry-rb.org/gems/dry-types/) gem.
|
300
300
|
|
301
301
|
```ruby
|
302
302
|
require 'roar/coercion'
|
@@ -307,11 +307,11 @@ class SongRepresenter < Roar::Decorator
|
|
307
307
|
include Roar::Coercion
|
308
308
|
|
309
309
|
property :title
|
310
|
-
property :released_at, type: DateTime
|
310
|
+
property :released_at, type: Types::DateTime
|
311
311
|
end
|
312
312
|
```
|
313
313
|
|
314
|
-
The `:type` option allows to set a
|
314
|
+
The `:type` option allows to set a dry-types-compatible type.
|
315
315
|
|
316
316
|
```ruby
|
317
317
|
song = Song.new
|
data/lib/roar/coercion.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
gem
|
2
|
-
require
|
3
|
-
require
|
1
|
+
gem "dry-types", ">= 1.0.0"
|
2
|
+
require "dry-types"
|
3
|
+
require "representable/coercion"
|
4
4
|
|
5
5
|
module Roar
|
6
|
+
Types = Representable::Coercion::Types
|
7
|
+
|
6
8
|
# Use the +:type+ option to specify the conversion type.
|
7
9
|
# class ImmigrantSong
|
8
10
|
# include Roar::JSON
|
data/lib/roar/version.rb
CHANGED
data/roar.gemspec
CHANGED
@@ -19,14 +19,15 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.required_ruby_version = '>= 1.9.3'
|
21
21
|
|
22
|
-
s.add_runtime_dependency "representable", "~> 3.
|
22
|
+
s.add_runtime_dependency "representable", "~> 3.1"
|
23
23
|
|
24
24
|
s.add_development_dependency "rake"
|
25
25
|
s.add_development_dependency "test_xml", "0.1.6"
|
26
26
|
s.add_development_dependency 'minitest', '>= 5.10'
|
27
27
|
s.add_development_dependency "sinatra"
|
28
28
|
s.add_development_dependency "sinatra-contrib"
|
29
|
-
s.add_development_dependency "
|
29
|
+
s.add_development_dependency "webrick"
|
30
30
|
s.add_development_dependency "faraday"
|
31
31
|
s.add_development_dependency "multi_json"
|
32
|
+
s.add_development_dependency "dry-types", ">= 1.0.0"
|
32
33
|
end
|
@@ -8,7 +8,7 @@ class CoercionFeatureTest < MiniTest::Spec
|
|
8
8
|
include Roar::JSON
|
9
9
|
include Roar::Coercion
|
10
10
|
|
11
|
-
property :composed_at, :
|
11
|
+
property :composed_at, type: Types::JSON::DateTime, default: "May 12th, 2012"
|
12
12
|
end
|
13
13
|
|
14
14
|
class ImmigrantSong
|
@@ -35,25 +35,25 @@ class FaradayHttpTransportTest < MiniTest::Spec
|
|
35
35
|
let(:not_found_url) { 'http://localhost:4567/missing-resource' }
|
36
36
|
|
37
37
|
it '#get_uri raises a ResourceNotFound error' do
|
38
|
-
assert_raises(Faraday::
|
38
|
+
assert_raises(Faraday::ResourceNotFound) do
|
39
39
|
@transport.get_uri(uri: not_found_url, as: as).body
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
it '#post_uri raises a ResourceNotFound error' do
|
44
|
-
assert_raises(Faraday::
|
44
|
+
assert_raises(Faraday::ResourceNotFound) do
|
45
45
|
@transport.post_uri(uri: not_found_url, body: body, as: as).body
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
49
49
|
it '#post_uri raises a ResourceNotFound error' do
|
50
|
-
assert_raises(Faraday::
|
50
|
+
assert_raises(Faraday::ResourceNotFound) do
|
51
51
|
@transport.post_uri(uri: not_found_url, body: body, as: as).body
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
it '#delete_uri raises a ResourceNotFound error' do
|
56
|
-
assert_raises(Faraday::
|
56
|
+
assert_raises(Faraday::ResourceNotFound) do
|
57
57
|
@transport.delete_uri(uri: not_found_url, body: body, as: as).body
|
58
58
|
end
|
59
59
|
end
|
@@ -61,7 +61,7 @@ class FaradayHttpTransportTest < MiniTest::Spec
|
|
61
61
|
|
62
62
|
describe 'server errors (500 Internal Server Error)' do
|
63
63
|
it '#get_uri raises a ClientError' do
|
64
|
-
assert_raises(Faraday::
|
64
|
+
assert_raises(Faraday::ServerError) do
|
65
65
|
@transport.get_uri(uri: 'http://localhost:4567/deliberate-error', as: as).body
|
66
66
|
end
|
67
67
|
end
|
@@ -54,7 +54,7 @@ class HttpVerbsTest < MiniTest::Spec
|
|
54
54
|
describe 'a non-existent resource' do
|
55
55
|
it 'handles HTTP errors and raises a ResourceNotFound error with FaradayHttpTransport' do
|
56
56
|
@band.transport_engine = Roar::Transport::Faraday
|
57
|
-
assert_raises(::Faraday::
|
57
|
+
assert_raises(::Faraday::ResourceNotFound) do
|
58
58
|
@band.get(uri: 'http://localhost:4567/bands/anthrax', as: "application/json")
|
59
59
|
end
|
60
60
|
end
|
@@ -6,7 +6,7 @@ require 'sinatra/multi_route'
|
|
6
6
|
|
7
7
|
name = "/C=US/ST=SomeState/L=SomeCity/O=Organization/OU=Unit/CN=localhost"
|
8
8
|
ca = OpenSSL::X509::Name.parse(name)
|
9
|
-
key = OpenSSL::PKey::RSA.new(
|
9
|
+
key = OpenSSL::PKey::RSA.new(2048)
|
10
10
|
crt = OpenSSL::X509::Certificate.new
|
11
11
|
crt.version = 2
|
12
12
|
crt.serial = 1
|
@@ -58,4 +58,4 @@ class SslServer < Sinatra::Base
|
|
58
58
|
end
|
59
59
|
server = ::Rack::Handler::WEBrick
|
60
60
|
|
61
|
-
server.run(SslServer, webrick_options)
|
61
|
+
server.run(SslServer, **webrick_options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: representable
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
19
|
+
version: '3.1'
|
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: '3.
|
26
|
+
version: '3.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,19 +95,19 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: webrick
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: faraday
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: dry-types
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 1.0.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 1.0.0
|
139
153
|
description: Object-oriented representers help you defining nested REST API documents
|
140
154
|
which can then be rendered and parsed using one and the same concept.
|
141
155
|
email:
|
@@ -145,8 +159,11 @@ extensions: []
|
|
145
159
|
extra_rdoc_files: []
|
146
160
|
files:
|
147
161
|
- ".github/ISSUE_TEMPLATE.md"
|
162
|
+
- ".github/workflows/ci.yml"
|
163
|
+
- ".github/workflows/ci_jruby.yml"
|
164
|
+
- ".github/workflows/ci_legacy.yml"
|
165
|
+
- ".github/workflows/ci_truffleruby.yml"
|
148
166
|
- ".gitignore"
|
149
|
-
- ".travis.yml"
|
150
167
|
- CHANGES.markdown
|
151
168
|
- CONTRIBUTING.md
|
152
169
|
- Gemfile
|
@@ -200,7 +217,7 @@ homepage: http://trailblazer.to/gems/roar
|
|
200
217
|
licenses:
|
201
218
|
- MIT
|
202
219
|
metadata: {}
|
203
|
-
post_install_message:
|
220
|
+
post_install_message:
|
204
221
|
rdoc_options: []
|
205
222
|
require_paths:
|
206
223
|
- lib
|
@@ -215,8 +232,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
232
|
- !ruby/object:Gem::Version
|
216
233
|
version: '0'
|
217
234
|
requirements: []
|
218
|
-
rubygems_version: 3.
|
219
|
-
signing_key:
|
235
|
+
rubygems_version: 3.3.18
|
236
|
+
signing_key:
|
220
237
|
specification_version: 4
|
221
238
|
summary: Parse and render REST API documents using representers.
|
222
239
|
test_files: []
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
before_install:
|
3
|
-
- gem install bundler
|
4
|
-
matrix:
|
5
|
-
allow_failures:
|
6
|
-
- rvm: ruby-head
|
7
|
-
fast_finish: true
|
8
|
-
include:
|
9
|
-
- rvm: 2.3.8
|
10
|
-
- rvm: 2.4.6
|
11
|
-
- rvm: 2.5.5
|
12
|
-
- rvm: 2.6.3
|
13
|
-
- rvm: jruby-9.1.15.0
|
14
|
-
env:
|
15
|
-
- JRUBY_OPTS="--client -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-Xss2m -Xcompile.invokedynamic=false -J-Xmx1536m"
|
16
|
-
- rvm: ruby-head
|