roar-rails 0.1.5 → 0.1.6

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: c33c21876169c4a22758b63518545cc16907738e
4
- data.tar.gz: 7dfd9b6f4acf5d968e6f4610a121f11aa114db61
3
+ metadata.gz: 7fbf7c943c30c7284ff2cf46861318701910e138
4
+ data.tar.gz: e6e6cb5e5816418c71c75d023bbfc61dc4551def
5
5
  SHA512:
6
- metadata.gz: 6a03309f56329e8fc0b7c6697663cc12684bd5aa38120c94e0787700db93ef098dc68f694403aacfa194aea0ef6ce82fd1483843cbfb18c22891d3ec44dd446e
7
- data.tar.gz: 01ff61bf13937790add1c81be32505fd67f41b14321bddc16f292d8ab69ede4cc3a171970940b1719eabd50afc63554eba14fc70a84aca647abd8e64cffd24a0
6
+ metadata.gz: 45631ddc9bfc4f96279e7b1f7538cf33473cf5f6cc5f5cb1abafb4b5b7a149a65e5ec67f95c25c63510821898c9a47d6c7b86aec31270399dbd821bb343339c0
7
+ data.tar.gz: 5d20060c50ce90161bbd93ee41c81cb71e5544ad04c32e428dbf556e69b1d32153f63d7f5c1e5631d7db9bf6f60216d9286ea511cd6a955f35e6ceef4b57dca8
@@ -3,7 +3,6 @@ rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
5
  gemfile:
6
- - Gemfile
7
6
  - gemfiles/Gemfile.rails3-0
8
7
  - gemfiles/Gemfile.rails3-2
9
8
  - gemfiles/Gemfile.rails4-0
@@ -1,3 +1,10 @@
1
+ ## 0.1.6
2
+
3
+ * Added `ControllerAdditions::Render` to support `#render` in controller actions with representers.
4
+ * Roar-rails now works properly with rails-api.
5
+ * `Roar::Rails::Responder` is a class now.
6
+ * Moved `RepresenterComputer` to `Formats`.
7
+
1
8
  ## 0.1.5
2
9
 
3
10
  * Maintenance release, using Uber now and get rid of deprecation warning.
@@ -4,6 +4,8 @@ _Makes using Roar's representers in your Rails app fun._
4
4
 
5
5
  Roar is a framework for parsing and rendering REST documents. For a better overview about representers please check the [roar repository](https://github.com/apotonick/roar#roar).
6
6
 
7
+ Roar-rails gives you conventions and convenient access to a lot of Roar's functionality within your Rails app.
8
+
7
9
  ## Features
8
10
 
9
11
  * Rendering with responders
@@ -93,6 +95,21 @@ class SingersController < ApplicationController
93
95
 
94
96
  You might pass strings as representer names to `::represents`, they will be constantized at run-time when needed.
95
97
 
98
+ ## Rendering with #render
99
+
100
+ In place of `#respond_with`, you can also use `#render` to serialize objects using representers.
101
+
102
+ ```ruby
103
+ class SingersController < ApplicationController
104
+ include Roar::Rails::ControllerAdditions
105
+ include Roar::Rails::ControllerAdditions::Render
106
+
107
+ def show
108
+ singer = Singer.find_by_id(params[:id])
109
+ render json: singer
110
+ end
111
+ end
112
+ ```
96
113
 
97
114
  ### Old API Support
98
115
 
@@ -249,6 +266,20 @@ end
249
266
 
250
267
  Put your representers in `app/representers` and they will be autoloaded by Rails. Also, frequently used modules as media representers and features don't need to be required manually.
251
268
 
269
+ ## Rails 4.1 + HAL
270
+
271
+ **Note**: this is a temporary work-around, we're trying to fix that in Rails/roar-rails itself [May 2014].
272
+
273
+ Rails 4.1 expects you to manually register a global HAL renderer, or `respond_with` will throw the exception `ActionController::MissingRenderer (No renderer defined for format: hal)`.
274
+
275
+ One fix is to add this to `config/initializers/mime_types.rb` right below `Mime::Type.register 'application/hal+json', :hal`:
276
+
277
+ ```ruby
278
+ ActionController::Renderers.add :hal do |obj, options|
279
+ self.content_type ||= Mime[:hal]
280
+ obj.to_hal
281
+ end
282
+ ```
252
283
 
253
284
  ## Contributors
254
285
 
data/TODO.md ADDED
@@ -0,0 +1,2 @@
1
+ * Investigate to what extend we need our own Response in the responder. I want to be able to have additional formats like hal or object-hal without registering (and implementing!) a global renderer
2
+ * Add tests for rails-api (anyone???).
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in roar-rails.gemspec
4
+ gemspec :path => '../'
5
+
6
+ gem 'railties', '~> 4.1.0'
7
+ gem 'actionpack', '~> 4.1.0'
8
+
9
+ gem 'activemodel', '~> 4.1.0'
10
+ gem 'activerecord', '~> 4.1.0'
11
+ gem 'minitest', '~> 5.2.0'
@@ -17,34 +17,25 @@ module Roar::Representer
17
17
  end
18
18
 
19
19
 
20
-
21
20
  module Roar
22
21
  module Rails
23
- def self.rails3_0?
24
- ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 0
25
- end
26
-
27
- def self.rails3_1?
28
- ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 1
22
+ require 'uber/version'
23
+ def self.rails_version
24
+ Uber::Version.new(::ActionPack::VERSION::STRING)
29
25
  end
30
26
 
31
- def self.rails3_2?
32
- ::Rails::VERSION::MAJOR == 3 && ::Rails::VERSION::MINOR == 2
33
- end
34
-
35
- if rails3_0?
27
+ if rails_version.~ 3.0
36
28
  require 'roar/rails/rails3_0_strategy'
37
- elsif rails3_1?
29
+ elsif rails_version.~ 3.1
38
30
  require 'roar/rails/rails3_1_strategy'
39
- elsif rails3_2?
31
+ elsif rails_version.~ 3.2
40
32
  require 'roar/rails/rails3_2_strategy'
41
33
  else
42
34
  require 'roar/rails/rails4_0_strategy'
43
35
  end
44
36
 
45
37
  autoload("TestCase", "roar/rails/test_case")
46
- autoload("ControllerAdditions", "roar/rails/controller_additions")
47
38
  end
48
39
  end
49
40
 
50
-
41
+ require "roar/rails/controller_additions"
@@ -1,5 +1,6 @@
1
1
  require 'uber/inheritable_attr'
2
2
  require 'roar/rails/responder'
3
+ require 'roar/rails/formats'
3
4
 
4
5
  module Roar::Rails
5
6
  module ControllerAdditions
@@ -8,15 +9,13 @@ module Roar::Rails
8
9
  included do
9
10
  extend Uber::InheritableAttr
10
11
  inheritable_attr :represents_options
11
- self.represents_options ||= RepresenterComputer.new
12
+ self.represents_options ||= Formats.new
13
+
14
+ self.responder = Roar::Rails::Responder
12
15
  end
13
16
 
14
17
 
15
18
  module ClassMethods
16
- def responder
17
- Class.new(super).send :include, Roar::Rails::Responder
18
- end
19
-
20
19
  def represents(format, options)
21
20
  represents_options.add(format,options)
22
21
  respond_to format
@@ -63,76 +62,11 @@ module Roar::Rails
63
62
  end
64
63
 
65
64
 
66
- class RepresenterComputer < Hash
67
- def add(format, opts)
68
- # FIXME: use controller_path here as well!
69
- # by pre-computing the representer name we allow "one-step inheritance": if B doesn't call ::represents it "inherits" A's settings.
70
- unless opts.is_a?(Hash)
71
- model_name = opts.name.underscore
72
- opts = {
73
- :entity => add_representer_suffix(model_name),
74
- :collection => add_representer_suffix(model_name.pluralize)
75
- }
76
- end
77
-
78
- self[format] = opts
79
- end
80
-
81
- def for(*args)
82
- name = name_for(*args) or return
83
-
84
- return name if name.is_a?(Module) # i hate is_a? but this is really handy here.
85
- name.camelize.constantize
86
- end
87
-
88
- private
89
- def [](format)
90
- super(format.to_sym) or {}
91
- end
92
-
93
- def name_for(format, model, controller_path) # DISCUSS: should we pass and process options here?
94
- controller_path = Path.new(controller_path) # DISCUSS: could that be done in the initialization, maybe?
95
- options = self[format]
96
-
97
- if detect_collection(model)
98
- options[:collection] or collection_representer(format, model, controller_path)
99
- else
100
- options[:entity] or entity_representer(format, model, controller_path)
101
- end
102
- end
103
-
104
- def collection_representer(format, model, controller_path)
105
- infer_representer(controller_path)
106
- end
107
-
108
- def entity_representer(format, model, controller_path)
109
- model_name = model.class.name.underscore
110
-
111
- if namespace = controller_path.namespace
112
- model_name = "#{namespace}/#{model_name}"
113
- end
114
-
115
- infer_representer(model_name)
116
- end
117
-
118
- def infer_representer(model_name)
119
- add_representer_suffix(model_name).camelize.constantize
120
- end
121
-
122
- def add_representer_suffix(prefix)
123
- "#{prefix}_representer"
124
- end
125
-
126
- def detect_collection(model)
127
- return true if model.kind_of?(Array)
128
- return true if Object.const_defined?("ActiveRecord") and model.kind_of?(ActiveRecord::Relation)
129
- end
130
-
131
- class Path < String
132
- def namespace
133
- return unless ns = self.match(/(.+)\/\w+$/)
134
- ns[1]
135
- end
65
+ # Include if you intend to use roar-rails with <tt>render json: model</tt>.
66
+ module Render
67
+ def render(options)
68
+ format = options.keys.first
69
+ super format => prepare_model_for(format, options.values.first, options)
136
70
  end
137
71
  end
138
72
  end
@@ -0,0 +1,74 @@
1
+ module Roar::Rails
2
+ class Formats < Hash
3
+ def add(format, opts)
4
+ # FIXME: use controller_path here as well!
5
+ # by pre-computing the representer name we allow "one-step inheritance": if B doesn't call ::represents it "inherits" A's settings.
6
+ unless opts.is_a?(Hash)
7
+ model_name = opts.name.underscore
8
+ opts = {
9
+ :entity => add_representer_suffix(model_name),
10
+ :collection => add_representer_suffix(model_name.pluralize)
11
+ }
12
+ end
13
+
14
+ self[format] = opts
15
+ end
16
+
17
+ def for(*args)
18
+ name = name_for(*args) or return
19
+
20
+ return name if name.is_a?(Module) # i hate is_a? but this is really handy here.
21
+ name.camelize.constantize
22
+ end
23
+
24
+ private
25
+ def [](format)
26
+ super(format.to_sym) or {}
27
+ end
28
+
29
+ def name_for(format, model, controller_path) # DISCUSS: should we pass and process options here?
30
+ controller_path = Path.new(controller_path) # DISCUSS: could that be done in the initialization, maybe?
31
+ options = self[format]
32
+
33
+ if detect_collection(model)
34
+ options[:collection] or collection_representer(format, model, controller_path)
35
+ else
36
+ options[:entity] or entity_representer(format, model, controller_path)
37
+ end
38
+ end
39
+
40
+ def collection_representer(format, model, controller_path)
41
+ infer_representer(controller_path)
42
+ end
43
+
44
+ def entity_representer(format, model, controller_path)
45
+ model_name = model.class.name.underscore
46
+
47
+ if namespace = controller_path.namespace
48
+ model_name = "#{namespace}/#{model_name}"
49
+ end
50
+
51
+ infer_representer(model_name)
52
+ end
53
+
54
+ def infer_representer(model_name)
55
+ add_representer_suffix(model_name).camelize.constantize
56
+ end
57
+
58
+ def add_representer_suffix(prefix)
59
+ "#{prefix}_representer"
60
+ end
61
+
62
+ def detect_collection(model)
63
+ return true if model.kind_of?(Array)
64
+ return true if Object.const_defined?("ActiveRecord") and model.kind_of?(ActiveRecord::Relation)
65
+ end
66
+
67
+ class Path < String
68
+ def namespace
69
+ return unless ns = self.match(/(.+)\/\w+$/)
70
+ ns[1]
71
+ end
72
+ end
73
+ end
74
+ end
@@ -1,5 +1,5 @@
1
1
  module Roar::Rails
2
- module Responder
2
+ class Responder < ActionController::Responder
3
3
  module VersionStrategy
4
4
  def prepare_model_for(format, model, *args)
5
5
  # rails <= 3.1 compatibility. #display gets called for empty responses
@@ -1,5 +1,5 @@
1
1
  module Roar::Rails
2
- module Responder
2
+ class Responder < ActionController::Responder
3
3
  module VersionStrategy
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Roar::Rails
2
- module Responder
2
+ class Responder < ActionController::Responder
3
3
  module VersionStrategy
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module Roar::Rails
2
- module Responder
2
+ class Responder < ActionController::Responder
3
3
  module VersionStrategy
4
4
  end
5
5
  end
@@ -0,0 +1,21 @@
1
+ module Roar::Rails
2
+ class Responder < ActionController::Responder
3
+ module VersionStrategy
4
+ extend ActiveSupport::Concern
5
+ included do
6
+ # FIXME: this totally SUCKS, why am i supposed to add a global "renderer" (whatever that is) to handle hal requests. this should be a generic behaviour in Rails core.
7
+ # TODO: replace renderer/responder layer in Rails with a simpler implementation.
8
+ # ActionController.add_renderer :hal do |js, options|
9
+ # self.content_type ||= Mime::HAL
10
+ # js.to_json
11
+ # end
12
+ end
13
+ end
14
+ end
15
+
16
+ module TestCase
17
+ module VersionStrategy
18
+ end
19
+ end
20
+ end
21
+
@@ -5,12 +5,12 @@ module Roar
5
5
  module Rails
6
6
  class Railtie < ::Rails::Railtie
7
7
  config.representer = ActiveSupport::OrderedOptions.new
8
-
8
+
9
9
  initializer "roar.set_configs" do |app|
10
10
  ::Roar::Representer.module_eval do
11
11
  include app.routes.url_helpers
12
- include app.routes.mounted_helpers unless Roar::Rails.rails3_0?
13
-
12
+ include app.routes.mounted_helpers unless Roar::Rails.rails_version.~ 3.0
13
+
14
14
  include UrlMethods # provide an initial #default_url_options.
15
15
  end
16
16
  end
@@ -1,70 +1,72 @@
1
- module Roar::Rails
2
- module Responder
3
- def display(model, *args)
4
- if represent_format?
5
- handle_lonely_collection!(model) and return super # :represent_items_with
1
+ module Roar
2
+ module Rails
3
+ class Responder < ActionController::Responder
4
+ def display(model, *args)
5
+ if represent_format?
6
+ handle_lonely_collection!(model) and return super # :represent_items_with
6
7
 
7
- model = prepare_model_for(format, model, options)
8
- end
8
+ model = prepare_model_for(format, model, options)
9
+ end
9
10
 
10
- super(create_response(model), *args) # AC::Responder: this calls controller.render which calls render_to_body which calls renderer[:json] which calls model.to_json.
11
- end
11
+ super(create_response(model), *args) # AC::Responder: this calls controller.render which calls render_to_body which calls renderer[:json] which calls model.to_json.
12
+ end
12
13
 
13
- private
14
+ private
14
15
 
15
- def default_represented_formats
16
- Rails.application.config.representer.represented_formats
17
- end
16
+ def default_represented_formats
17
+ ::Rails.application.config.representer.represented_formats
18
+ end
18
19
 
19
- # First check for user option overrides, then check for defaults, then trigger
20
- # previous behavior and always represent for the requested format.
21
- def represent_format?
22
- formats = Array((options[:represented_formats] || default_represented_formats || [format]))
23
- formats.include?(format)
24
- end
20
+ # First check for user option overrides, then check for defaults, then trigger
21
+ # previous behavior and always represent for the requested format.
22
+ def represent_format?
23
+ formats = Array((options[:represented_formats] || default_represented_formats || [format]))
24
+ formats.include?(format)
25
+ end
25
26
 
26
- def resourceful?
27
- # FIXME: find out if we have a representer? what about old behaviour?
28
- #resource.respond_to?("to_#{format}")
29
- true
30
- end
27
+ def resourceful?
28
+ # FIXME: find out if we have a representer? what about old behaviour?
29
+ #resource.respond_to?("to_#{format}")
30
+ true
31
+ end
31
32
 
32
- def create_response(model)
33
- render_method = "to_#{format}"
34
- media_format = Mime[format]
35
- Response.new(model.send(render_method, options), media_format)
36
- end
33
+ def create_response(model)
34
+ render_method = "to_#{format}"
35
+ media_format = Mime[format]
36
+ Response.new(model.send(render_method, options), media_format)
37
+ end
37
38
 
38
- def handle_lonely_collection!(collection)
39
- return false unless representer = options.delete(:represent_items_with)
39
+ def handle_lonely_collection!(collection)
40
+ return false unless representer = options.delete(:represent_items_with)
40
41
 
41
- setup_items_with(collection, representer) # convenience API, not recommended since it's missing hypermedia.
42
- true
43
- end
42
+ setup_items_with(collection, representer) # convenience API, not recommended since it's missing hypermedia.
43
+ true
44
+ end
44
45
 
45
- def setup_items_with(collection, representer)
46
- collection.map! do |mdl| # DISCUSS: i don't like changing the method argument here.
47
- representer.prepare(mdl).to_hash(options) # FIXME: huh? and what about XML?
46
+ def setup_items_with(collection, representer)
47
+ collection.map! do |mdl| # DISCUSS: i don't like changing the method argument here.
48
+ representer.prepare(mdl).to_hash(options) # FIXME: huh? and what about XML?
49
+ end
48
50
  end
49
- end
50
51
 
51
52
 
52
- module PrepareModel
53
- def prepare_model_for(format, model, options) # overwritten in VersionStrategy/3.0.
54
- controller.prepare_model_for(format, model, options)
53
+ module PrepareModel
54
+ def prepare_model_for(format, model, options) # overwritten in VersionStrategy/3.0.
55
+ controller.prepare_model_for(format, model, options)
56
+ end
55
57
  end
56
- end
57
- include PrepareModel
58
- include VersionStrategy
58
+ include PrepareModel
59
+ include VersionStrategy
59
60
 
60
61
 
61
- class Response
62
- attr_reader :content_type, :body # DISCUSS: how to add more header fields? #headers?
62
+ class Response
63
+ attr_reader :content_type, :body # DISCUSS: how to add more header fields? #headers?
63
64
 
64
- def initialize(body, content_type)
65
- @body = body
66
- @content_type = content_type
65
+ def initialize(body, content_type)
66
+ @body = body
67
+ @content_type = content_type
68
+ end
67
69
  end
68
70
  end
69
71
  end
70
- end
72
+ end
@@ -1,5 +1,5 @@
1
1
  module Roar
2
2
  module Rails
3
- VERSION = "0.1.5"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
@@ -26,7 +26,7 @@ class ConsumeWithConfigurationTest < ActionController::TestCase
26
26
 
27
27
  module MusicianRepresenter
28
28
  include Roar::Representer::JSON
29
- property :name, :from => :called
29
+ property :name, :as => :called
30
30
  end
31
31
 
32
32
 
@@ -1,6 +1,6 @@
1
1
  module SingerAliasRepresenter
2
2
  include Roar::Representer::JSON
3
3
 
4
- property :name, :from => :alias
4
+ property :name, :as => :alias
5
5
 
6
6
  end
@@ -17,8 +17,8 @@ end
17
17
  class Bassist
18
18
  end
19
19
 
20
- class RepresenterComputerTest < MiniTest::Spec
21
- let (:subject) { Roar::Rails::ControllerAdditions::RepresenterComputer.new }
20
+ class FormatsTest < MiniTest::Spec
21
+ let (:subject) { Roar::Rails::Formats.new }
22
22
 
23
23
  describe "nothing configured" do
24
24
  it "uses model class" do
@@ -100,7 +100,7 @@ class RepresenterComputerTest < MiniTest::Spec
100
100
  :collection => SingersRepresenter) }
101
101
 
102
102
  it "detects collection in form of ActiveRecord::Relation" do
103
- subject.for(:json, Artist.find(:all), "artists").must_equal SingersRepresenter
103
+ subject.for(:json, Artist.all, "artists").must_equal SingersRepresenter
104
104
  end
105
105
  end
106
106
 
@@ -130,7 +130,7 @@ class RepresenterComputerTest < MiniTest::Spec
130
130
  end
131
131
 
132
132
  class PathTest < MiniTest::Spec
133
- let (:path) { Roar::Rails::ControllerAdditions::RepresenterComputer::Path }
133
+ let (:path) { Roar::Rails::Formats::Path }
134
134
 
135
135
  it { path.new("bands").namespace.must_equal nil }
136
136
  it { path.new("v1/bands").namespace.must_equal "v1" }
@@ -1,6 +1,13 @@
1
1
  require 'test_helper'
2
2
 
3
3
  Mime::Type.register 'application/json+hal', :hal
4
+ if Roar::Rails.rails_version >= 4.1
5
+ ActionController.add_renderer :hal do |js, options|
6
+ self.content_type ||= Mime::HAL
7
+ js.to_json
8
+ end
9
+ end
10
+
4
11
  class HalRendererTest < ActionController::TestCase
5
12
  include Roar::Rails::TestCase
6
13
 
@@ -0,0 +1,30 @@
1
+ require 'test_helper'
2
+
3
+ class RenderTest < ActionController::TestCase
4
+ include Roar::Rails::TestCase
5
+
6
+ class SingersController < ActionController::Base
7
+ module SingerRepresenter
8
+ include Roar::Representer::JSON
9
+
10
+ property :name, :as => :title
11
+ end
12
+
13
+ include Roar::Rails::ControllerAdditions
14
+ include Roar::Rails::ControllerAdditions::Render
15
+
16
+ represents :json, :entity => SingerRepresenter
17
+
18
+ def show
19
+ singer = Musician.new("Bumi")
20
+ render :json => singer
21
+ end
22
+ end
23
+
24
+ tests SingersController
25
+
26
+ test "should use Representer for #render" do
27
+ get :show, :id => "bumi", :format => :json
28
+ assert_body '{"title":"Bumi"}'
29
+ end
30
+ end
@@ -378,7 +378,7 @@ class ResponderTest < ActionController::TestCase
378
378
  end
379
379
 
380
380
  def bumi_json
381
- return "[\"Bumi\"]" if Roar::Rails.rails3_0?
381
+ return "[\"Bumi\"]" if Roar::Rails.rails_version.~ 3.0
382
382
  "{\"name\":\"Bumi\"}"
383
383
  end
384
384
  end
@@ -1,5 +1,4 @@
1
- require 'test/unit'
2
- require 'minitest/spec'
1
+ require 'minitest/autorun'
3
2
  require 'test_xml/mini_test'
4
3
 
5
4
  ENV['RAILS_ENV'] = 'test'
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roar-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-25 00:00:00.000000000 Z
11
+ date: 2014-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: roar
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.11.13
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.11.13
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: test_xml
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.1.6
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
40
  version: 0.1.6
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: actionpack
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: railties
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '>='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 3.0.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '>='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 3.0.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: uber
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '4.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
96
  version: '4.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: activemodel
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
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
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: activerecord
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: sqlite3
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: tzinfo
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: Rails extensions for using Roar in the popular web framework.
@@ -157,26 +157,30 @@ executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - ".gitignore"
161
- - ".travis.yml"
160
+ - .gitignore
161
+ - .travis.yml
162
162
  - CHANGES.markdown
163
163
  - Gemfile
164
164
  - LICENSE
165
165
  - README.markdown
166
166
  - Rakefile
167
+ - TODO.md
167
168
  - gemfiles/Gemfile.rails3-0
168
169
  - gemfiles/Gemfile.rails3-2
169
170
  - gemfiles/Gemfile.rails4-0
171
+ - gemfiles/Gemfile.rails4-1
170
172
  - lib/generators/rails/USAGE
171
173
  - lib/generators/rails/representer_generator.rb
172
174
  - lib/generators/rails/templates/representer.rb
173
175
  - lib/roar-rails.rb
174
176
  - lib/roar/rails/controller_additions.rb
177
+ - lib/roar/rails/formats.rb
175
178
  - lib/roar/rails/hal.rb
176
179
  - lib/roar/rails/rails3_0_strategy.rb
177
180
  - lib/roar/rails/rails3_1_strategy.rb
178
181
  - lib/roar/rails/rails3_2_strategy.rb
179
182
  - lib/roar/rails/rails4_0_strategy.rb
183
+ - lib/roar/rails/rails4_1_strategy.rb
180
184
  - lib/roar/rails/railtie.rb
181
185
  - lib/roar/rails/responder.rb
182
186
  - lib/roar/rails/test_case.rb
@@ -221,8 +225,9 @@ files:
221
225
  - test/dummy/public/javascripts/rails.js
222
226
  - test/dummy/public/stylesheets/.gitkeep
223
227
  - test/dummy/script/rails
228
+ - test/formats_test.rb
224
229
  - test/json_hal_renderer_test.rb
225
- - test/representer_computer_test.rb
230
+ - test/render_test.rb
226
231
  - test/representer_generator_test.rb
227
232
  - test/representer_test.rb
228
233
  - test/responder_test.rb
@@ -238,63 +243,18 @@ require_paths:
238
243
  - lib
239
244
  required_ruby_version: !ruby/object:Gem::Requirement
240
245
  requirements:
241
- - - ">="
246
+ - - '>='
242
247
  - !ruby/object:Gem::Version
243
248
  version: '0'
244
249
  required_rubygems_version: !ruby/object:Gem::Requirement
245
250
  requirements:
246
- - - ">="
251
+ - - '>='
247
252
  - !ruby/object:Gem::Version
248
253
  version: '0'
249
254
  requirements: []
250
255
  rubyforge_project: roar-rails
251
- rubygems_version: 2.2.1
256
+ rubygems_version: 2.2.2
252
257
  signing_key:
253
258
  specification_version: 4
254
259
  summary: Use Roar in Rails.
255
- test_files:
256
- - test/consume_test.rb
257
- - test/dummy/Rakefile
258
- - test/dummy/app/controllers/application_controller.rb
259
- - test/dummy/app/controllers/bands_controller.rb
260
- - test/dummy/app/controllers/singers_controller.rb
261
- - test/dummy/app/helpers/application_helper.rb
262
- - test/dummy/app/models/artist.rb
263
- - test/dummy/app/representers/band_representer.rb
264
- - test/dummy/app/representers/singer_alias_representer.rb
265
- - test/dummy/app/representers/singer_representer.rb
266
- - test/dummy/app/views/layouts/application.html.erb
267
- - test/dummy/app/views/musician/featured.html.erb
268
- - test/dummy/app/views/musician/featured_with_block.html.erb
269
- - test/dummy/app/views/musician/hamlet.html.haml
270
- - test/dummy/config.ru
271
- - test/dummy/config/application.rb
272
- - test/dummy/config/boot.rb
273
- - test/dummy/config/database.yml
274
- - test/dummy/config/environment.rb
275
- - test/dummy/config/environments/development.rb
276
- - test/dummy/config/environments/production.rb
277
- - test/dummy/config/environments/test.rb
278
- - test/dummy/config/locales/en.yml
279
- - test/dummy/config/routes.rb
280
- - test/dummy/db/test.sqlite3
281
- - test/dummy/public/404.html
282
- - test/dummy/public/422.html
283
- - test/dummy/public/500.html
284
- - test/dummy/public/favicon.ico
285
- - test/dummy/public/javascripts/application.js
286
- - test/dummy/public/javascripts/controls.js
287
- - test/dummy/public/javascripts/dragdrop.js
288
- - test/dummy/public/javascripts/effects.js
289
- - test/dummy/public/javascripts/prototype.js
290
- - test/dummy/public/javascripts/rails.js
291
- - test/dummy/public/stylesheets/.gitkeep
292
- - test/dummy/script/rails
293
- - test/json_hal_renderer_test.rb
294
- - test/representer_computer_test.rb
295
- - test/representer_generator_test.rb
296
- - test/representer_test.rb
297
- - test/responder_test.rb
298
- - test/test_case_test.rb
299
- - test/test_helper.rb
300
- - test/validations_test.rb
260
+ test_files: []