front_end_builds 0.0.18 → 0.0.19

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: b4ada75c0814d64c7fbe84dad45f323ded2ef0ef
4
- data.tar.gz: 0fab1b41c3717a43ab237027ed03eee23c4139b1
3
+ metadata.gz: 2d0062a2dc66d2aaf27e8f7d5b89aac72e34ab47
4
+ data.tar.gz: 9f8a20ba073a3ebd36054294732808fae347e730
5
5
  SHA512:
6
- metadata.gz: 98c4bdcd7d87bcc7cd3a57766500ad1f5a2c914ab99882ab72e4035b2e467472c6ff12de451e3618a8067720cc6e528ba261f5049783c18fd6b12225ad6c0b9b
7
- data.tar.gz: 2fc3c7d9a65446a32106a2406acd44775e362c7219ea5238d4ce5a9be8abe7c25ddfea673132786303478e757eb5f700e21116c70f77d533a904cfeb33711e8b
6
+ metadata.gz: b45a41309333845d763eccb90991ffd8ef06422b1d040599a749d6ab26b238b4953fddf6aed357df6516564834f2dedc147966553aa767ed95b64ec49e9f4d50
7
+ data.tar.gz: b51d329f26b67ebb9be42725751c02f04c61fcb59dd1005068e4d0fc851855d9014e73b454f8628cf890343ae48d45314cb57258a3be16de0a4758c02d99389f
@@ -6,5 +6,16 @@ module FrontEndBuilds
6
6
  send("#{param_method}_rails_#{v}")
7
7
  end
8
8
 
9
+ # Public: A quick helper to create a respond_to block for
10
+ # returning json to the client. Used because `respond_with`
11
+ # is no longer included in Rails.
12
+ def respond_with_json(object, options = {})
13
+ respond_to do |format|
14
+ format.json do
15
+ render options.merge(json: object)
16
+ end
17
+ end
18
+ end
19
+
9
20
  end
10
21
  end
@@ -3,12 +3,11 @@ require_dependency "front_end_builds/application_controller"
3
3
  module FrontEndBuilds
4
4
  class AppsController < ApplicationController
5
5
  before_filter :set_app , :only => [:show, :destroy]
6
- respond_to :json
7
6
 
8
7
  def index
9
8
  apps = App.includes(:recent_builds)
10
9
 
11
- respond_with({
10
+ respond_with_json({
12
11
  apps: apps.map(&:serialize),
13
12
  builds: apps.map(&:recent_builds)
14
13
  .flat_map(&:to_a)
@@ -17,7 +16,7 @@ module FrontEndBuilds
17
16
  end
18
17
 
19
18
  def show
20
- respond_with({
19
+ respond_with_json({
21
20
  app: @app.serialize,
22
21
  builds: @app.recent_builds.map(&:serialize)
23
22
  })
@@ -27,12 +26,12 @@ module FrontEndBuilds
27
26
  @app = FrontEndBuilds::App.new( use_params(:app_create_params) )
28
27
 
29
28
  if @app.save!
30
- respond_with(
29
+ respond_with_json(
31
30
  { app: @app.serialize },
32
31
  location: nil
33
32
  )
34
33
  else
35
- respond_with(
34
+ respond_with_json(
36
35
  { errors: @app.errors },
37
36
  status: :unprocessable_entity
38
37
  )
@@ -41,12 +40,12 @@ module FrontEndBuilds
41
40
 
42
41
  def destroy
43
42
  if @app.destroy
44
- respond_with(
43
+ respond_with_json(
45
44
  { app: { id: @app.id } },
46
45
  location: nil
47
46
  )
48
47
  else
49
- respond_with(
48
+ respond_with_json(
50
49
  {errors: @app.errors},
51
50
  status: :unprocessable_entity
52
51
  )
@@ -3,13 +3,12 @@ require_dependency "front_end_builds/application_controller"
3
3
  module FrontEndBuilds
4
4
  class BuildsController < ApplicationController
5
5
  before_filter :set_app!, only: :create
6
- respond_to :json
7
6
 
8
7
  def index
9
8
  builds = FrontEndBuilds::Build.where(app_id: params[:app_id])
10
- respond_with({
11
- builds: builds.map(&:serialize)
12
- })
9
+ respond_with_json({
10
+ builds: builds.map(&:serialize)
11
+ })
13
12
  end
14
13
 
15
14
  def create
@@ -30,7 +29,7 @@ module FrontEndBuilds
30
29
 
31
30
  def show
32
31
  build = FrontEndBuilds::Build.find(params[:id])
33
- respond_with({
32
+ respond_with_json({
34
33
  build: build.serialize
35
34
  })
36
35
  end
@@ -2,10 +2,8 @@ require_dependency "front_end_builds/application_controller"
2
2
 
3
3
  module FrontEndBuilds
4
4
  class HostAppsController < ApplicationController
5
- respond_to :json
6
-
7
5
  def show
8
- respond_with({
6
+ respond_with_json({
9
7
  host_app: {
10
8
  id: params[:id],
11
9
  name: Rails.application.class.parent_name
@@ -1,3 +1,3 @@
1
1
  module FrontEndBuilds
2
- VERSION = "0.0.18"
2
+ VERSION = "0.0.19"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: front_end_builds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Toronto