grape-roar 0.2.0 → 0.3.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
  SHA1:
3
- metadata.gz: 0d20b4c91d2e6c8ddf666534169e08e979d1f0b4
4
- data.tar.gz: 80f25794c1901dc9dcbeb5d137dfef37ab634121
3
+ metadata.gz: f093829bf015a0d7e28dfde89dd892ef75f476ad
4
+ data.tar.gz: 510c6d4ca8038ca89c9ffceb08ab4e4f331fdbea
5
5
  SHA512:
6
- metadata.gz: 268ee883eafd778ae6fdaf2a68392426f152532d8354e75e5620c33b869f115a4a4fe5382ad222b70720e95eedf05e612fdebdb12d23542af8942685a393acbf
7
- data.tar.gz: f9c92f7d2a629d6d23937ac1b7017530d467e74bf53be5ab2651b6d3c7991d59fb5c31be6204f95d04b3df4057a65e4f7cd8f3b54d427cb90c9b0375c3af6c88
6
+ metadata.gz: 96fc420d047ff343877c733b2cba4c5a3e5dbec12dd10a4aaa8848145cf60313209cab853e60210783d6c58fc67cfd94d702f6d0e11a349b6d115e75ef2bc557
7
+ data.tar.gz: aa92afe084b80dc6b09677b073a233c04d69ee65b7a0f17b699ffb92da87be20c8a103334fad6a2132ebfd0184deed23d60a4df01b1029eb00769bee6bf0ff3a
@@ -1,3 +1,8 @@
1
+ 0.3.0 (12/31/2014)
2
+ ------------------
3
+
4
+ * Added support for Roar 1.0 - [@dblock](https://github.com/dblock).
5
+
1
6
  0.2.0 (12/18/2014)
2
7
  ------------------
3
8
 
data/Gemfile CHANGED
@@ -7,10 +7,11 @@ group :development do
7
7
  end
8
8
 
9
9
  group :test do
10
- gem 'rspec', '~> 3.0'
10
+ gem 'rspec', '~> 3.1'
11
11
  gem 'rack-test'
12
12
  end
13
13
 
14
14
  group :development, :test do
15
15
  gem 'rubocop', '0.28.0'
16
+ gem 'nokogiri', '1.6.3.1'
16
17
  end
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
1
  Grape::Roar
2
2
  ------------
3
3
 
4
- Use [Roar](https://github.com/apotonick/roar) with [Grape](https://github.com/intridea/grape).
4
+ [![Gem Version](http://img.shields.io/gem/v/grape-roar.svg)](http://badge.fury.io/rb/grape-roar)
5
+ [![Build Status](http://img.shields.io/travis/dblock/grape-roar.svg)](https://travis-ci.org/dblock/grape-roar)
6
+ [![Dependency Status](https://gemnasium.com/dblock/grape-roar.svg)](https://gemnasium.com/dblock/grape-roar)
7
+ [![Code Climate](https://codeclimate.com/github/dblock/grape-roar.svg)](https://codeclimate.com/github/dblock/grape-roar)
5
8
 
6
- [![Build Status](https://secure.travis-ci.org/dblock/grape-roar.png)](http://travis-ci.org/dblock/grape-roar)
9
+ Use [Roar](https://github.com/apotonick/roar) with [Grape](https://github.com/intridea/grape).
7
10
 
8
11
  Demo
9
12
  ----
@@ -21,6 +24,8 @@ gem 'roar'
21
24
  gem 'grape-roar'
22
25
  ```
23
26
 
27
+ If you're upgrading from an older version of this gem, please see [UPGRADING](UPGRADING.md).
28
+
24
29
  Usage
25
30
  -----
26
31
 
@@ -35,12 +40,12 @@ end
35
40
 
36
41
  ### Use Grape's Present
37
42
 
38
- You can use Grape's `present` keyword after including Grape::Roar::Representer into a representer module.
43
+ Include Grape::Roar::Representer into a representer module *after* any Roar mixins, then use Grape's `present` keyword.
39
44
 
40
45
  ```ruby
41
46
  module ProductRepresenter
42
- include Roar::Representer::JSON
43
- include Roar::Representer::Feature::Hypermedia
47
+ include Roar::JSON
48
+ include Roar::Hypermedia
44
49
  include Grape::Roar::Representer
45
50
 
46
51
  property :title
@@ -58,8 +63,8 @@ Presenting collections works the same way. The following example returns an embe
58
63
 
59
64
  ```ruby
60
65
  module ProductsRepresenter
61
- include Roar::Representer::JSON::HAL
62
- include Roar::Representer::Feature::Hypermedia
66
+ include Roar::JSON::HAL
67
+ include Roar::Hypermedia
63
68
  include Grape::Roar::Representer
64
69
 
65
70
  collection :entries, extend: ProductPresenter, as: :products, embedded: true
@@ -78,8 +83,8 @@ The formatter invokes `to_json` on presented objects and provides access to the
78
83
 
79
84
  ```ruby
80
85
  module ProductRepresenter
81
- include Roar::Representer::JSON
82
- include Roar::Representer::Feature::Hypermedia
86
+ include Roar::JSON
87
+ include Roar::Hypermedia
83
88
  include Grape::Roar::Representer
84
89
 
85
90
  link :self do |opts|
@@ -95,8 +100,8 @@ If you prefer to use a decorator class instead of modules.
95
100
 
96
101
  ```ruby
97
102
  class ProductRepresenter < Grape::Roar::Decorator
98
- include Roar::Representer::JSON
99
- include Roar::Representer::Feature::Hypermedia
103
+ include Roar::JSON
104
+ include Roar::Hypermedia
100
105
 
101
106
  link :self do |opts|
102
107
  "#{request(opts).url}/#{represented.id}"
@@ -0,0 +1,11 @@
1
+ Upgrading Grape-Roar
2
+ ====================
3
+
4
+ ### Upgrading to >= 0.3.0
5
+
6
+ This version requires Roar 1.0 or newer.
7
+
8
+ * Make presenter changes according to the [roar changelog](https://github.com/apotonick/roar/blob/master/CHANGES.markdown), specifically replace `Roar::Representer::Feature::Hypermedia` with `Roar::Hypermedia` and `Roar::Representer::JSON` with `Roar::JSON` and adjust any `require` paths.
9
+ * Ensure that `Grape::Roar::Representer` is included *after* any `Roar::JSON` or `Roar::Hypermedia` mixins. You would otherwise get a `TypeError: class or module required` from within `Roar::Representable`.
10
+
11
+
@@ -16,5 +16,5 @@ Gem::Specification.new do |gem|
16
16
  gem.version = Grape::Roar::VERSION
17
17
 
18
18
  gem.add_dependency 'grape'
19
- gem.add_dependency 'roar'
19
+ gem.add_dependency 'roar', '>= 1.0'
20
20
  end
@@ -1,5 +1,5 @@
1
1
  module Grape
2
2
  module Roar
3
- VERSION = '0.2.0'
3
+ VERSION = '0.3.0'
4
4
  end
5
5
  end
@@ -7,8 +7,8 @@ Bundler.setup :default, :test
7
7
  require 'grape'
8
8
 
9
9
  require 'roar'
10
- require 'roar/representer/json'
11
- require 'roar/representer/feature/hypermedia'
10
+ require 'roar/json'
11
+ require 'roar/hypermedia'
12
12
 
13
13
  require 'grape/roar'
14
14
  require 'rack/test'
@@ -1,7 +1,7 @@
1
1
  require 'support/article_representer'
2
2
 
3
3
  class Article
4
- include Roar::Representer::JSON
4
+ include Roar::JSON
5
5
  include ArticleRepresenter
6
6
 
7
7
  attr_accessor :title, :id
@@ -1,6 +1,6 @@
1
1
  module ArticleRepresenter
2
- include Roar::Representer::JSON
3
- include Roar::Representer::Feature::Hypermedia
2
+ include Roar::JSON
3
+ include Roar::Hypermedia
4
4
 
5
5
  property :title
6
6
  property :id
@@ -1,7 +1,7 @@
1
1
  require 'support/order_representer'
2
2
 
3
3
  class Order
4
- include Roar::Representer::JSON
4
+ include Roar::JSON
5
5
  include OrderRepresenter
6
6
 
7
7
  attr_accessor :id, :client_id, :articles
@@ -1,8 +1,8 @@
1
1
  require 'support/article'
2
2
 
3
3
  module OrderRepresenter
4
- include Roar::Representer::JSON
5
- include Roar::Representer::Feature::Hypermedia
4
+ include Roar::JSON
5
+ include Roar::Hypermedia
6
6
 
7
7
  property :id
8
8
  property :client_id
@@ -1,8 +1,8 @@
1
- require 'roar/representer/json/hal'
1
+ require 'roar/json/hal'
2
2
 
3
3
  module ProductRepresenter
4
- include Roar::Representer::JSON
5
- include Roar::Representer::Feature::Hypermedia
4
+ include Roar::JSON
5
+ include Roar::Hypermedia
6
6
  include Grape::Roar::Representer
7
7
 
8
8
  property :title
@@ -1,6 +1,6 @@
1
1
  class UserRepresenter < Grape::Roar::Decorator
2
- include Roar::Representer::JSON
3
- include Roar::Representer::Feature::Hypermedia
2
+ include Roar::JSON
3
+ include Roar::Hypermedia
4
4
 
5
5
  property :name
6
6
  property :id
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-roar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Doubrovkine
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-18 00:00:00.000000000 Z
11
+ date: 2014-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
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
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: roar
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '1.0'
34
34
  type: :runtime
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'
40
+ version: '1.0'
41
41
  description: Use Roar with Grape
42
42
  email:
43
43
  - dblock@dblock.org
@@ -45,17 +45,18 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - .gitignore
49
- - .rspec
50
- - .rubocop.yml
51
- - .rubocop_todo.yml
52
- - .travis.yml
48
+ - ".gitignore"
49
+ - ".rspec"
50
+ - ".rubocop.yml"
51
+ - ".rubocop_todo.yml"
52
+ - ".travis.yml"
53
53
  - CHANGELOG.md
54
54
  - CONTRIBUTING.md
55
55
  - Gemfile
56
56
  - LICENSE
57
57
  - README.md
58
58
  - Rakefile
59
+ - UPGRADING.md
59
60
  - grape-roar.gemspec
60
61
  - lib/grape-roar.rb
61
62
  - lib/grape/roar.rb
@@ -85,17 +86,17 @@ require_paths:
85
86
  - lib
86
87
  required_ruby_version: !ruby/object:Gem::Requirement
87
88
  requirements:
88
- - - '>='
89
+ - - ">="
89
90
  - !ruby/object:Gem::Version
90
91
  version: '0'
91
92
  required_rubygems_version: !ruby/object:Gem::Requirement
92
93
  requirements:
93
- - - '>='
94
+ - - ">="
94
95
  - !ruby/object:Gem::Version
95
96
  version: '0'
96
97
  requirements: []
97
98
  rubyforge_project:
98
- rubygems_version: 2.1.11
99
+ rubygems_version: 2.2.2
99
100
  signing_key:
100
101
  specification_version: 4
101
102
  summary: Enable Resource-Oriented Architectures in Grape API DSL