roar 1.1.0 → 1.2.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
- SHA1:
3
- metadata.gz: a9315b89b6aa93848741828ab6a94e338677e397
4
- data.tar.gz: c373cdb3f85a40560502cd9ef09ad88363499394
2
+ SHA256:
3
+ metadata.gz: 2860c24f7eedfa3e4f1f0863055f3914f6ace36ba34cf6ae51fcfcd7c5178c2b
4
+ data.tar.gz: 3a6ce9a686e587093781eaa0b35618a7573198d4d42092aca23e1a4309e7c8c2
5
5
  SHA512:
6
- metadata.gz: 059ab5ab647e9ec273976d485715dfed04895dc1538e8331025cea005995a1b9cf9cdb16c7e0ed34441f338594976e09c9ba48ccd071a2846aed5697a81f742c
7
- data.tar.gz: 93101c0816d59b8ffe8465eddb7d5882f132322b1c00f4e44dd960c4b840ac0ce52f4d647245ebdec52682fccfb88c0716ee1c1b4d998c46e5edc6d92753cd4a
6
+ metadata.gz: '0733953718778b1724d81d547ed9b870740417fe77295694615f2af4af31aaf4cf3004988d120d560e311dacc5ab00e1d0dff82468614c7424087e950067f058'
7
+ data.tar.gz: aa179e38257da2b60502d72b93f1c41fcfa33feb7891308b27d2464180e345a358970e39c1f353428bdcea42af6af54df75a7d51403159e47a0c152563c075ee
File without changes
@@ -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
@@ -1,3 +1,14 @@
1
+ # Next
2
+
3
+ # 1.2.0
4
+
5
+ * Allow Representable `>= 3.1`
6
+ * Replace `Virtus` with `Dry-Types`
7
+
8
+ # 1.1.1
9
+
10
+ * Allow Representable 3.x.
11
+
1
12
  # 1.1.0
2
13
 
3
14
  * Require Representable 3.0.x
data/Gemfile CHANGED
@@ -1,17 +1,10 @@
1
- source "http://rubygems.org"
1
+ source "https://rubygems.org"
2
2
 
3
- # Specify your gem's dependencies in roar.gemspec
4
- gemspec
3
+ ruby RUBY_VERSION
5
4
 
6
- install_if -> { RUBY_VERSION > '2.2.2' } do
7
- gem 'sinatra', '~> 2.0.0.beta2'
8
- gem 'sinatra-contrib', github: 'sinatra/sinatra'
9
- end
5
+ gemspec
10
6
 
11
- gem 'nokogiri', '~> 1.6.8'
7
+ gem "nokogiri", ">= 1.8.5"
12
8
 
13
- # gem "representable", path: "../representable"
14
- # gem "representable", github: "apotonick/representable"
15
- # gem "declarative", path: "../declarative"
16
9
  gem "minitest-line"
17
10
  gem "pry"
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://travis-ci.org/trailblazer/roar.svg?branch=master)](https://travis-ci.org/trailblazer/roar)
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
@@ -67,6 +67,12 @@ The roar gem runs with all Ruby versions >= 1.9.3.
67
67
  gem 'roar'
68
68
  ```
69
69
 
70
+ To use roar with Ruby versions < 2.2.0, add a version pin to your Gemfile:
71
+
72
+ ```ruby
73
+ gem 'sinatra', '~> 1.4'
74
+ ```
75
+
70
76
  ### Dependencies
71
77
 
72
78
  Roar does not bundle dependencies for JSON and XML.
@@ -290,7 +296,7 @@ We're currently [working on](https://github.com/trailblazer/roar/issues/85) bett
290
296
 
291
297
  ## Coercion
292
298
 
293
- Roar provides coercion with the [virtus](https://github.com/solnic/virtus) gem.
299
+ Roar provides coercion with the [dry-types](https://dry-rb.org/gems/dry-types/) gem.
294
300
 
295
301
  ```ruby
296
302
  require 'roar/coercion'
@@ -301,11 +307,11 @@ class SongRepresenter < Roar::Decorator
301
307
  include Roar::Coercion
302
308
 
303
309
  property :title
304
- property :released_at, type: DateTime
310
+ property :released_at, type: Types::DateTime
305
311
  end
306
312
  ```
307
313
 
308
- The `:type` option allows to set a virtus-compatible type.
314
+ The `:type` option allows to set a dry-types-compatible type.
309
315
 
310
316
  ```ruby
311
317
  song = Song.new
data/lib/roar/coercion.rb CHANGED
@@ -1,8 +1,10 @@
1
- gem 'virtus'
2
- require 'virtus'
3
- require 'representable/coercion'
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
@@ -1,3 +1,3 @@
1
1
  module Roar
2
- VERSION = "1.1.0"
2
+ VERSION = "1.2.0"
3
3
  end
data/roar.gemspec CHANGED
@@ -17,14 +17,17 @@ Gem::Specification.new do |s|
17
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_runtime_dependency "representable", "~> 3.0.0"
20
+ s.required_ruby_version = '>= 1.9.3'
21
21
 
22
- s.add_development_dependency "rake", ">= 0.10.1"
22
+ s.add_runtime_dependency "representable", "~> 3.1"
23
+
24
+ s.add_development_dependency "rake"
23
25
  s.add_development_dependency "test_xml", "0.1.6"
24
26
  s.add_development_dependency 'minitest', '>= 5.10'
25
- s.add_development_dependency "sinatra", '>= 2.0.0'
26
- s.add_development_dependency "sinatra-contrib", '>= 2.0.0'
27
- s.add_development_dependency "virtus", ">= 1.0.0"
27
+ s.add_development_dependency "sinatra"
28
+ s.add_development_dependency "sinatra-contrib"
29
+ s.add_development_dependency "webrick"
28
30
  s.add_development_dependency "faraday"
29
31
  s.add_development_dependency "multi_json"
32
+ s.add_development_dependency "dry-types", ">= 1.0.0"
30
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, :type => DateTime, :default => "May 12th, 2012"
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::Error::ResourceNotFound) do
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::Error::ResourceNotFound) do
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::Error::ResourceNotFound) do
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::Error::ResourceNotFound) do
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::Error::ClientError) do
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::Error::ResourceNotFound) do
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(1024)
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.1.0
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: 2017-01-12 00:00:00.000000000 Z
11
+ date: 2023-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: representable
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 3.0.0
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.0.0
26
+ version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: 0.10.1
33
+ version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 0.10.1
40
+ version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: test_xml
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -72,42 +72,42 @@ dependencies:
72
72
  requirements:
73
73
  - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: 2.0.0
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: 2.0.0
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: sinatra-contrib
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 2.0.0
89
+ version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 2.0.0
96
+ version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: virtus
98
+ name: webrick
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.0.0
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: 1.0.0
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:
@@ -144,12 +158,15 @@ executables: []
144
158
  extensions: []
145
159
  extra_rdoc_files: []
146
160
  files:
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"
147
166
  - ".gitignore"
148
- - ".travis.yml"
149
167
  - CHANGES.markdown
150
168
  - CONTRIBUTING.md
151
169
  - Gemfile
152
- - ISSUE_TEMPLATE.md
153
170
  - LICENSE
154
171
  - README.markdown
155
172
  - Rakefile
@@ -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
@@ -208,16 +225,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
208
225
  requirements:
209
226
  - - ">="
210
227
  - !ruby/object:Gem::Version
211
- version: '0'
228
+ version: 1.9.3
212
229
  required_rubygems_version: !ruby/object:Gem::Requirement
213
230
  requirements:
214
231
  - - ">="
215
232
  - !ruby/object:Gem::Version
216
233
  version: '0'
217
234
  requirements: []
218
- rubyforge_project:
219
- rubygems_version: 2.5.1
220
- signing_key:
235
+ rubygems_version: 3.3.18
236
+ signing_key:
221
237
  specification_version: 4
222
238
  summary: Parse and render REST API documents using representers.
223
239
  test_files: []
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- sudo: false
2
- rvm:
3
- - 1.9.3
4
- - 2.1
5
- - 2.2.6
6
- - 2.3.1
7
- - 2.4.0
8
- - jruby-9.1.6.0
9
- - ruby-head
10
- gemfile:
11
- - Gemfile
12
- # - gemfiles/Gemfile.representable-2.4
13
- before_install:
14
- - gem install bundler
15
- matrix:
16
- allow_failures:
17
- - rvm: ruby-head