cyrax 0.4.0.beta → 0.4.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NTJkY2U0ODEzYTY3NzYzNGFjZWIwMWUwMDEwNDM1ZGY4MjBlZTZmYQ==
4
+ OGI4MjM2YWMwNDlmNGQwNzRiZjc3ZTJiMzdlNzBkNTc5NTEyZWFmNQ==
5
5
  data.tar.gz: !binary |-
6
- ZmQwYzVlNWI1Y2RjYzAwNGQ1ZmJiYjYxZjk5NjI0ZmEyM2NlMTZjYw==
6
+ MjE0OGIwMTBjMGFjZjRjMjI5ZTJkNzg1MzdmYTQ0ZjZjMjBmYTcyZg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- OGQyYWE3NzU4NjZkMTE3NzE4Mzc3Y2I0MDUxMTNmMGFiNjQzYTg1NGYzNTk1
10
- OTQyNjNmZmM1Yzg4ZWJlY2I5NWNjNzYxZjc0OTFhNmRkYTRkYmFiODBkYWM3
11
- MzU0OGI0YjUwMjU2OTk0ZjkzYmZiYzFiOTk1YWJiOWMzZTE4YzA=
9
+ MWE5ZmJlZWQ0ZGQyNDBjMDA2YzQwNDlmYjkwNDM2OTIyYjBjZTg3MjU5MWQ0
10
+ NmE3ZmY0M2Y0N2MwNzJjNDkyY2Q2N2NiNGY5OGQyMWQxYjRkZTNiYjcxZDU1
11
+ OWZjNjAxZjJmNjM3MDM3YmRiOWM0YzNkYTRlZTkxOGNhNzM0ZDI=
12
12
  data.tar.gz: !binary |-
13
- ZTZiODY0ZDRkZTAxYTk2ZjcwNWI5YTBhNThkY2Q2MTQ5Njk1YjljMDgzN2Q2
14
- ZmZlYjMzNjJiYmMyNDBmM2U1YThlMWQ0ZWY1MjAwNDlhYTg4MmJmYzgwNjk5
15
- ZGMyODdhOTA1MTU5NTAwMmYwZmRmMWYyYzFmYmUxZDRmYTJhYjg=
13
+ N2U5ZTU5ZWQzNDc0YjMyMDMxZTQ3OGFhYzQyNTdiMzhkYWJiZDI4MTdlMTEx
14
+ NmVmYTk0N2M2MGFiYmU0N2I2MmQ5NWM3YzkzZDlmNWIwMjFkZGEzNTFmZTE5
15
+ OTU5YWUwNWE3NTEzMjBmODEyZGJiNmI1MDA3ZmI1Njc2YzZiZTc=
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Cyrax
1
+ # Cyrax [![Build Status](https://travis-ci.org/droidlabs/cyrax.png)](https://travis-ci.org/droidlabs/cyrax) [![Code Climate](https://codeclimate.com/github/droidlabs/cyrax.png)](https://codeclimate.com/github/droidlabs/cyrax)
2
2
  ![Cyrax](http://images2.wikia.nocookie.net/__cb20121118042055/mk/images/thumb/4/44/CyraxMK9Render.png/322px-CyraxMK9Render.png)
3
3
  > Safeties disabled; combat mode engaged.
4
4
 
@@ -6,17 +6,15 @@ Cyrax is microframework to build layered architecture, one of the core concepts
6
6
 
7
7
  ## Installation
8
8
 
9
- Add this line to your application's Gemfile:
9
+ Add this line to your Gemfile.
10
10
 
11
- gem 'cyrax'
11
+ Rails 4:
12
12
 
13
- And then execute:
13
+ gem 'cyrax', '~> 0.4.0.beta2'
14
14
 
15
- $ bundle
15
+ Rails 3:
16
16
 
17
- Or install it yourself as:
18
-
19
- $ gem install cyrax
17
+ gem 'cyrax', '~> 0.3.8'
20
18
 
21
19
  ## Usage
22
20
 
@@ -29,3 +27,9 @@ Look at `example` folder.
29
27
  3. Commit your changes (`git commit -am 'Add some feature'`)
30
28
  4. Push to the branch (`git push origin my-new-feature`)
31
29
  5. Create new Pull Request
30
+
31
+ ## Thanks for using Cyrax!
32
+
33
+ Hope, you'll enjoy Cyrax!
34
+
35
+ Cheers, [Droid Labs](http://droidlabs.pro).
@@ -44,8 +44,10 @@ module Cyrax::Extensions
44
44
  # Reads a single item from the DB
45
45
  # Used for :show action in controller
46
46
  # @return [Cyrax::Response] response
47
- def read
48
- respond_with find_resource(params[:id])
47
+ def read(&block)
48
+ resource = find_resource(params[:id])
49
+ block.call(resource) if block_given?
50
+ respond_with resource
49
51
  end
50
52
  alias_method :read!, :read
51
53
  alias_method :edit, :read
@@ -2,19 +2,22 @@ module Cyrax::ControllerHelper
2
2
  def respond_with(*args)
3
3
  if args.present? && args.first.is_a?(Cyrax::Response)
4
4
  response, options = *args
5
- default_options = {
5
+ options = {
6
6
  notice: response.notice,
7
7
  error: response.error
8
- }
8
+ }.merge(options || {})
9
+
9
10
  set_resource_from(response)
10
- flash[:notice] = response.notice if response.notice.present?
11
- flash[:error] = response.error if response.error.present?
11
+
12
+ # set flashes
13
+ flash[:notice] = options[:notice] if options[:notice].present?
14
+ flash[:error] = options[:error] if options[:error].present?
12
15
 
13
16
  # convert result to model if possible
14
17
  result = response.result
15
18
  result = result.to_model if result.respond_to?(:to_model)
16
19
 
17
- super(result, default_options.merge(options || {})) do |format|
20
+ super(result, options) do |format|
18
21
  format.json do
19
22
  if result.respond_to?(:errors) && result.errors.present?
20
23
  render json: { errors: result.errors }
data/lib/cyrax/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Cyrax
2
- VERSION = "0.4.0.beta"
2
+ VERSION = "0.4.0.beta2"
3
3
  end
@@ -71,6 +71,7 @@ module Cyrax
71
71
  end
72
72
 
73
73
  describe 'private methods' do
74
+ before { Cyrax.strong_parameters = false }
74
75
  describe '#dirty_resource_attributes' do
75
76
  context 'when params are present' do
76
77
  it 'should return from params by resource_name' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cyrax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.beta
4
+ version: 0.4.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Droidlabs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-11 00:00:00.000000000 Z
11
+ date: 2013-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -52,34 +52,6 @@ dependencies:
52
52
  - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ! '>='
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ! '>='
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rails
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ! '>='
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ! '>='
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
55
  - !ruby/object:Gem::Dependency
84
56
  name: sqlite3
85
57
  requirement: !ruby/object:Gem::Requirement
@@ -95,49 +67,7 @@ dependencies:
95
67
  - !ruby/object:Gem::Version
96
68
  version: '0'
97
69
  - !ruby/object:Gem::Dependency
98
- name: mocha
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ! '>='
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ! '>='
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rspec-rails
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ! '>='
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ! '>='
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: shoulda-matchers
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ! '>='
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ! '>='
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
- - !ruby/object:Gem::Dependency
140
- name: factory_girl_rails
70
+ name: rspec
141
71
  requirement: !ruby/object:Gem::Requirement
142
72
  requirements:
143
73
  - - ! '>='